-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WORK IN PROGRESS Create test coverage for e2e User journey #1579
base: master
Are you sure you want to change the base?
Changes from 3 commits
212ea5a
d75bd18
7da8359
8c0bedc
a9a543c
f6e52e9
cad7dd0
dcc4a60
f83032e
87dcd75
048018a
1a20676
e6dbe07
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { Page, expect, test } from '@playwright/test'; | ||
|
||
import { urlConfig } from '../utils/urls'; | ||
|
||
test.describe('Start application details e2e journey in English', () => { | ||
let page: Page; | ||
test.beforeEach(async ({ browser }) => { | ||
const context = await browser.newContext({ | ||
locale: 'en', | ||
}); | ||
page = await context.newPage(); | ||
await page.goto(urlConfig.citizenStartUrl); | ||
}); | ||
test('Start up jourey url is equal to the initial url', async () => { | ||
await expect(page).toHaveURL(urlConfig.citizenStartUrl); | ||
}); | ||
|
||
test('Start up journey page is default to English', async () => { | ||
const htmlLang = await page.evaluate(() => document.documentElement.lang); | ||
|
||
expect(htmlLang).toBe('en'); | ||
}); | ||
test('Start up journey page is to have Cymraeg language link to be visible', async () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these two tests could maybe be merged into one test as they look like they are doing quite similar things? |
||
const linkLocator = page.locator('text=cymraeg'); | ||
await expect(linkLocator).toBeVisible(); | ||
}); | ||
test('Start up journey page clicking Cymraeg langauge changes html language to cy', async () => { | ||
const linkLocator = page.locator('text=cymraeg'); | ||
await linkLocator.click(); | ||
await page.waitForLoadState('load'); | ||
|
||
const htmlLang = await page.evaluate(() => document.documentElement.lang); | ||
|
||
expect(htmlLang).toBe('cy'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. might be worth checking if you continue on the user journey, the language remains welsh and does not change back to english |
||
}); | ||
|
||
test('Start up journey page clicking Cymraeg language clicking english language changes lanuage to en', async () => { | ||
await changePageLanguage(page, 'cymraeg', 'load'); | ||
await changePageLanguage(page, 'english', 'load'); | ||
|
||
const htmlLang = await page.evaluate(() => document.documentElement.lang); | ||
|
||
expect(htmlLang).toBe('en'); | ||
}); | ||
}); | ||
|
||
async function changePageLanguage( | ||
page: Page, | ||
textLanguage: string, | ||
state?: 'load' | 'domcontentloaded' | 'networkidle' | ||
): Promise<void> { | ||
const languageLinkLocator = page.locator('text='.concat(textLanguage)); | ||
await languageLinkLocator.click(); | ||
await page.waitForLoadState(state); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: journey
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test might be not needed as it could be incorporated into the other tests and reduce number of tests being run