-
-
Notifications
You must be signed in to change notification settings - Fork 5
Update e2e tests to support new configuration step order #3389
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,53 +85,53 @@ export async function localizedScreenshots( | |
|
||
const homePageSignUpButtonLocator = page.locator('.login-buttons a').first(); | ||
|
||
for (const localeCode of preset.locales) { | ||
console.log(`Taking screenshots of login process for locale ${localeCode}`); | ||
|
||
await page.goto(preset.rootUrl); | ||
await switchToLocaleOnHomePage(page, localeCode); | ||
await expect(homePageSignUpButtonLocator).toBeVisible(); | ||
if (preset.showArrow) await installMouseFollower(page); | ||
|
||
// Scripture Forge home page | ||
const signUpButtonScreenshotClip = { | ||
x: 0, | ||
y: 0, | ||
width: (await page.viewportSize())!.width, | ||
height: 400 | ||
}; | ||
|
||
await user.hover(homePageSignUpButtonLocator, defaultArrowLocation); | ||
await screenshot( | ||
page, | ||
{ ...context, pageName: 'page_sign_up', locale: localeCode }, | ||
{ clip: signUpButtonScreenshotClip } | ||
); | ||
|
||
// Auth0 login page | ||
await homePageSignUpButtonLocator.click(); | ||
await page.waitForSelector('.auth0-lock-social-button'); | ||
if (preset.showArrow) await installMouseFollower(page); | ||
await user.hover(page.locator('.auth0-lock-social-button').first(), { x: 0.85, y: 0.6 }); | ||
await screenshotElements(page, [page.locator('.auth0-lock-widget-container')], { | ||
...context, | ||
pageName: 'auth0_sign_up_with_pt', | ||
locale: localeCode | ||
}); | ||
await page.locator('.auth0-lock-social-button').first().click(); | ||
|
||
// Paratext login page | ||
await expect(page.getByRole('heading', { name: 'Authorise Application' })).toBeVisible(); | ||
if (preset.showArrow) await installMouseFollower(page); | ||
await page.getByRole('alert').getByText('Warning: This server is for').getByRole('button').click(); | ||
await page.locator('#email').fill('[email protected]'); | ||
await user.hover(page.locator('#password-group').getByRole('button')); | ||
await screenshot( | ||
page, | ||
{ ...context, pageName: 'pt_registry_login', locale: localeCode }, | ||
{ animations: 'disabled' } | ||
); | ||
} | ||
// for (const localeCode of preset.locales) { | ||
// console.log(`Taking screenshots of login process for locale ${localeCode}`); | ||
|
||
// await page.goto(preset.rootUrl); | ||
// await switchToLocaleOnHomePage(page, localeCode); | ||
// await expect(homePageSignUpButtonLocator).toBeVisible(); | ||
// if (preset.showArrow) await installMouseFollower(page); | ||
|
||
// // Scripture Forge home page | ||
// const signUpButtonScreenshotClip = { | ||
// x: 0, | ||
// y: 0, | ||
// width: (await page.viewportSize())!.width, | ||
// height: 400 | ||
// }; | ||
|
||
// await user.hover(homePageSignUpButtonLocator, defaultArrowLocation); | ||
// await screenshot( | ||
// page, | ||
// { ...context, pageName: 'page_sign_up', locale: localeCode }, | ||
// { clip: signUpButtonScreenshotClip } | ||
// ); | ||
|
||
// // Auth0 login page | ||
// await homePageSignUpButtonLocator.click(); | ||
// await page.waitForSelector('.auth0-lock-social-button'); | ||
// if (preset.showArrow) await installMouseFollower(page); | ||
// await user.hover(page.locator('.auth0-lock-social-button').first(), { x: 0.85, y: 0.6 }); | ||
// await screenshotElements(page, [page.locator('.auth0-lock-widget-container')], { | ||
// ...context, | ||
// pageName: 'auth0_sign_up_with_pt', | ||
// locale: localeCode | ||
// }); | ||
// await page.locator('.auth0-lock-social-button').first().click(); | ||
|
||
// // Paratext login page | ||
// await expect(page.getByRole('heading', { name: 'Authorise Application' })).toBeVisible(); | ||
// if (preset.showArrow) await installMouseFollower(page); | ||
// await page.getByRole('alert').getByText('Warning: This server is for').getByRole('button').click(); | ||
// await page.locator('#email').fill('[email protected]'); | ||
// await user.hover(page.locator('#password-group').getByRole('button')); | ||
// await screenshot( | ||
// page, | ||
// { ...context, pageName: 'pt_registry_login', locale: localeCode }, | ||
// { animations: 'disabled' } | ||
// ); | ||
// } | ||
|
||
const shortName = 'SEEDSP2'; | ||
await logInAsPTUser(page, credentials); | ||
|
@@ -207,28 +207,38 @@ export async function localizedScreenshots( | |
await screenshot(page, { ...context, pageName: 'configure_sources_button', locale }); | ||
}); | ||
|
||
const originalViewportSize = await page.viewportSize(); | ||
await page.locator('[data-test-id="configure-button"]').click(); | ||
|
||
const originalViewportSize = await page.viewportSize()!; | ||
// Increase the height of the viewport to ensure all elements are visible | ||
await page.setViewportSize({ width: originalViewportSize.width, height: 1200 }); | ||
|
||
await page.locator('[data-test-id="configure-button"]').click(); | ||
await page.getByRole('combobox').fill('ntv'); | ||
await page.getByRole('option', { name: 'NTV - Nueva Traducción' }).click(); | ||
|
||
const addReference = page.locator('.add-another-project'); | ||
const nextButton = page.locator('.step-button-wrapper').getByRole('button').last(); | ||
|
||
await forEachLocale(async locale => { | ||
await page.getByRole('combobox').fill('ntv'); | ||
await user.hover(page.getByRole('option', { name: 'NTV - Nueva Traducción' }), defaultArrowLocation); | ||
await user.hover(addReference); | ||
await screenshotElements( | ||
page, | ||
[page.locator('app-draft-sources > .draft-sources-stepper'), page.locator('app-draft-sources > .overview')], | ||
{ ...context, pageName: 'configure_sources_draft_source', locale }, | ||
{ ...context, pageName: 'configure_sources_draft_reference', locale }, | ||
{ margin: 8 } | ||
); | ||
}); | ||
await page.getByRole('combobox').fill('ntv'); | ||
await page.getByRole('option', { name: 'NTV - Nueva Traducción' }).click(); | ||
await page.getByRole('button', { name: 'Next' }).click(); | ||
await user.click(addReference); | ||
await page.getByRole('combobox').last().fill('dhh94'); | ||
await page.getByRole('option', { name: 'DHH94 - Spanish: Dios Habla' }).click(); | ||
await nextButton.click(); | ||
|
||
await forEachLocale(async locale => { | ||
await user.hover(await page.getByRole('combobox'), defaultArrowLocation); | ||
await page.waitForTimeout(200); // Wait for the hover effect on the input | ||
await page.getByRole('combobox').fill('ntv'); | ||
await page.getByRole('option', { name: 'NTV - Nueva Traducción' }).click(); | ||
await user.hover(nextButton); | ||
await screenshotElements( | ||
page, | ||
[page.locator('app-draft-sources > .draft-sources-stepper'), page.locator('app-draft-sources > .overview')], | ||
|
@@ -239,10 +249,7 @@ export async function localizedScreenshots( | |
|
||
await page.getByRole('combobox').fill('ntv'); | ||
await page.getByRole('option', { name: 'NTV - Nueva Traducción' }).click(); | ||
await user.click(page.getByRole('button', { name: 'Add another reference project' })); | ||
await page.getByRole('combobox').last().fill('dhh94'); | ||
await page.getByRole('option', { name: 'DHH94 - Spanish: Dios Habla' }).click(); | ||
await page.getByRole('button', { name: 'Next' }).click(); | ||
await nextButton.click(); | ||
|
||
await forEachLocale(async locale => { | ||
await user.hover(await page.getByRole('checkbox')); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The non-null assertion operator (!) is unsafe here. The viewportSize() method can return null, and forcing it with ! could cause a runtime error. Use null checking instead:
const originalViewportSize = await page.viewportSize(); if (!originalViewportSize) throw new Error('Viewport size not available');
Copilot uses AI. Check for mistakes.