digitalfabrik/integreat-app

View on GitHub
e2e-tests/web/test/specs/changeLanguage.e2e.ts

Summary

Maintainability
A
0 mins
Test Coverage
import dashboardPage from '../pageobjects/dashboard.page.js'

describe('change language', () => {
  beforeEach(async () => {
    await dashboardPage.open()
  })

  it('should display language icon', async () => {
    const icon = await dashboardPage.languageIcon
    expect(await icon.isDisplayed()).toBeTruthy()
  })

  it('should open language selector', async () => {
    const languageIcon = await dashboardPage.languageIcon
    await languageIcon.click()

    const languageSelector = await $("*[data-testid='headerActionItemDropDown']")
    await $('=English')
    expect(await languageSelector.isDisplayed()).toBeTruthy()
  })

  it('should change language', async () => {
    expect(await dashboardPage.hasHeadline('Local information')).toBeTruthy()
    const englishContent = await $(`*=Welcome`)
    expect(await englishContent.isDisplayed()).toBeTruthy()

    await dashboardPage.selectLanguage('Deutsch')

    expect(await dashboardPage.hasHeadline('Lokale Informationen')).toBeTruthy()
    const germanContent = await $(`*=Willkommen`)
    expect(await germanContent.isDisplayed()).toBeTruthy()
  })
})