Skip to content

Commit 1fd6dc5

Browse files
committed
Update e2e tests to support new configuration step order
1 parent aff8cc3 commit 1fd6dc5

File tree

2 files changed

+75
-63
lines changed

2 files changed

+75
-63
lines changed

src/SIL.XForge.Scripture/ClientApp/e2e/workflows/generate-draft.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ export async function generateDraft(
4848
await user.click(page.getByRole('button', { name: 'Configure sources' }));
4949
await screenshot(page, { pageName: 'configure_sources_initial', ...context });
5050

51-
await user.click(page.getByRole('combobox'));
52-
await user.type('ntv');
53-
await user.click(page.getByRole('option', { name: 'NTV - Nueva Traducción' }));
54-
await user.click(page.getByRole('button', { name: 'Next' }));
51+
// Step 1: Reference projects
5552
await user.click(page.getByRole('combobox').first());
5653
await user.type('ntv');
5754
await user.click(page.getByRole('option', { name: 'NTV - Nueva Traducción' }));
@@ -60,6 +57,14 @@ export async function generateDraft(
6057
await user.type('dhh94');
6158
await user.click(page.getByRole('option', { name: 'DHH94 - Spanish: Dios Habla' }));
6259
await user.click(page.getByRole('button', { name: 'Next' }));
60+
61+
// Step 2: Source project
62+
await user.click(page.getByRole('combobox'));
63+
await user.type('ntv');
64+
await user.click(page.getByRole('option', { name: 'NTV - Nueva Traducción' }));
65+
await user.click(page.getByRole('button', { name: 'Next' }));
66+
67+
// Step 3: Main project and other training data
6368
await user.check(page.getByRole('checkbox', { name: 'All the language codes are correct' }));
6469
await screenshot(page, { pageName: 'configure_sources_final', ...context });
6570
await user.click(page.getByRole('button', { name: 'Save & sync' }));

src/SIL.XForge.Scripture/ClientApp/e2e/workflows/localized-screenshots.ts

Lines changed: 66 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -85,53 +85,53 @@ export async function localizedScreenshots(
8585

8686
const homePageSignUpButtonLocator = page.locator('.login-buttons a').first();
8787

88-
for (const localeCode of preset.locales) {
89-
console.log(`Taking screenshots of login process for locale ${localeCode}`);
90-
91-
await page.goto(preset.rootUrl);
92-
await switchToLocaleOnHomePage(page, localeCode);
93-
await expect(homePageSignUpButtonLocator).toBeVisible();
94-
if (preset.showArrow) await installMouseFollower(page);
95-
96-
// Scripture Forge home page
97-
const signUpButtonScreenshotClip = {
98-
x: 0,
99-
y: 0,
100-
width: (await page.viewportSize())!.width,
101-
height: 400
102-
};
103-
104-
await user.hover(homePageSignUpButtonLocator, defaultArrowLocation);
105-
await screenshot(
106-
page,
107-
{ ...context, pageName: 'page_sign_up', locale: localeCode },
108-
{ clip: signUpButtonScreenshotClip }
109-
);
110-
111-
// Auth0 login page
112-
await homePageSignUpButtonLocator.click();
113-
await page.waitForSelector('.auth0-lock-social-button');
114-
if (preset.showArrow) await installMouseFollower(page);
115-
await user.hover(page.locator('.auth0-lock-social-button').first(), { x: 0.85, y: 0.6 });
116-
await screenshotElements(page, [page.locator('.auth0-lock-widget-container')], {
117-
...context,
118-
pageName: 'auth0_sign_up_with_pt',
119-
locale: localeCode
120-
});
121-
await page.locator('.auth0-lock-social-button').first().click();
122-
123-
// Paratext login page
124-
await expect(page.getByRole('heading', { name: 'Authorise Application' })).toBeVisible();
125-
if (preset.showArrow) await installMouseFollower(page);
126-
await page.getByRole('alert').getByText('Warning: This server is for').getByRole('button').click();
127-
await page.locator('#email').fill('[email protected]');
128-
await user.hover(page.locator('#password-group').getByRole('button'));
129-
await screenshot(
130-
page,
131-
{ ...context, pageName: 'pt_registry_login', locale: localeCode },
132-
{ animations: 'disabled' }
133-
);
134-
}
88+
// for (const localeCode of preset.locales) {
89+
// console.log(`Taking screenshots of login process for locale ${localeCode}`);
90+
91+
// await page.goto(preset.rootUrl);
92+
// await switchToLocaleOnHomePage(page, localeCode);
93+
// await expect(homePageSignUpButtonLocator).toBeVisible();
94+
// if (preset.showArrow) await installMouseFollower(page);
95+
96+
// // Scripture Forge home page
97+
// const signUpButtonScreenshotClip = {
98+
// x: 0,
99+
// y: 0,
100+
// width: (await page.viewportSize())!.width,
101+
// height: 400
102+
// };
103+
104+
// await user.hover(homePageSignUpButtonLocator, defaultArrowLocation);
105+
// await screenshot(
106+
// page,
107+
// { ...context, pageName: 'page_sign_up', locale: localeCode },
108+
// { clip: signUpButtonScreenshotClip }
109+
// );
110+
111+
// // Auth0 login page
112+
// await homePageSignUpButtonLocator.click();
113+
// await page.waitForSelector('.auth0-lock-social-button');
114+
// if (preset.showArrow) await installMouseFollower(page);
115+
// await user.hover(page.locator('.auth0-lock-social-button').first(), { x: 0.85, y: 0.6 });
116+
// await screenshotElements(page, [page.locator('.auth0-lock-widget-container')], {
117+
// ...context,
118+
// pageName: 'auth0_sign_up_with_pt',
119+
// locale: localeCode
120+
// });
121+
// await page.locator('.auth0-lock-social-button').first().click();
122+
123+
// // Paratext login page
124+
// await expect(page.getByRole('heading', { name: 'Authorise Application' })).toBeVisible();
125+
// if (preset.showArrow) await installMouseFollower(page);
126+
// await page.getByRole('alert').getByText('Warning: This server is for').getByRole('button').click();
127+
// await page.locator('#email').fill('[email protected]');
128+
// await user.hover(page.locator('#password-group').getByRole('button'));
129+
// await screenshot(
130+
// page,
131+
// { ...context, pageName: 'pt_registry_login', locale: localeCode },
132+
// { animations: 'disabled' }
133+
// );
134+
// }
135135

136136
const shortName = 'SEEDSP2';
137137
await logInAsPTUser(page, credentials);
@@ -207,28 +207,38 @@ export async function localizedScreenshots(
207207
await screenshot(page, { ...context, pageName: 'configure_sources_button', locale });
208208
});
209209

210-
const originalViewportSize = await page.viewportSize();
210+
await page.locator('[data-test-id="configure-button"]').click();
211+
212+
const originalViewportSize = await page.viewportSize()!;
211213
// Increase the height of the viewport to ensure all elements are visible
212214
await page.setViewportSize({ width: originalViewportSize.width, height: 1200 });
213215

214-
await page.locator('[data-test-id="configure-button"]').click();
216+
await page.getByRole('combobox').fill('ntv');
217+
await page.getByRole('option', { name: 'NTV - Nueva Traducción' }).click();
218+
219+
const addReference = page.locator('.add-another-project');
220+
const nextButton = page.locator('.step-button-wrapper').getByRole('button').last();
221+
215222
await forEachLocale(async locale => {
216-
await page.getByRole('combobox').fill('ntv');
217-
await user.hover(page.getByRole('option', { name: 'NTV - Nueva Traducción' }), defaultArrowLocation);
223+
await user.hover(addReference);
218224
await screenshotElements(
219225
page,
220226
[page.locator('app-draft-sources > .draft-sources-stepper'), page.locator('app-draft-sources > .overview')],
221-
{ ...context, pageName: 'configure_sources_draft_source', locale },
227+
{ ...context, pageName: 'configure_sources_draft_reference', locale },
222228
{ margin: 8 }
223229
);
224230
});
225231
await page.getByRole('combobox').fill('ntv');
226232
await page.getByRole('option', { name: 'NTV - Nueva Traducción' }).click();
227-
await page.getByRole('button', { name: 'Next' }).click();
233+
await user.click(addReference);
234+
await page.getByRole('combobox').last().fill('dhh94');
235+
await page.getByRole('option', { name: 'DHH94 - Spanish: Dios Habla' }).click();
236+
await nextButton.click();
228237

229238
await forEachLocale(async locale => {
230-
await user.hover(await page.getByRole('combobox'), defaultArrowLocation);
231-
await page.waitForTimeout(200); // Wait for the hover effect on the input
239+
await page.getByRole('combobox').fill('ntv');
240+
await page.getByRole('option', { name: 'NTV - Nueva Traducción' }).click();
241+
await user.hover(nextButton);
232242
await screenshotElements(
233243
page,
234244
[page.locator('app-draft-sources > .draft-sources-stepper'), page.locator('app-draft-sources > .overview')],
@@ -239,10 +249,7 @@ export async function localizedScreenshots(
239249

240250
await page.getByRole('combobox').fill('ntv');
241251
await page.getByRole('option', { name: 'NTV - Nueva Traducción' }).click();
242-
await user.click(page.getByRole('button', { name: 'Add another reference project' }));
243-
await page.getByRole('combobox').last().fill('dhh94');
244-
await page.getByRole('option', { name: 'DHH94 - Spanish: Dios Habla' }).click();
245-
await page.getByRole('button', { name: 'Next' }).click();
252+
await nextButton.click();
246253

247254
await forEachLocale(async locale => {
248255
await user.hover(await page.getByRole('checkbox'));

0 commit comments

Comments
 (0)