Skip to content

Commit

Permalink
Add language change test case in main.spec.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
yousefelassal authored Mar 20, 2024
1 parent 906014a commit 480e9be
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/main.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,18 @@ test.describe('translation', () => {
await page.waitForSelector('p:has-text("hola")');
await expect(newTranslation).toHaveText('');
})
test('change language', async ({ page }) => {
const newTranslation = page.getByPlaceholder('Enter text to translate');
const select = page.locator('select');
await select.selectOption('fr');
await newTranslation.fill('hello');
await newTranslation.press('Enter');
await page.waitForSelector('p:has-text("bonjour")');

await expect(page.getByTestId('from-lang')).toHaveText('English');
await expect(page.getByTestId('from-text')).toHaveText('hello');
await expect(page.getByTestId('to-lang')).toHaveText('French');
await expect(page.getByTestId('translated-text')).toHaveText('Bonjour');
})
})

0 comments on commit 480e9be

Please sign in to comment.