Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions src/SIL.XForge.Scripture/ClientApp/e2e/workflows/generate-draft.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'npm:@playwright/test';
import { Locator, Page } from 'npm:playwright';
import { preset, ScreenshotContext } from '../e2e-globals.ts';
import { E2E_SYNC_DEFAULT_TIMEOUT, preset, ScreenshotContext } from '../e2e-globals.ts';
import {
enableDeveloperMode,
enableDraftingOnProjectAsServalAdmin,
Expand Down Expand Up @@ -203,21 +203,27 @@ export async function generateDraft(
await user.click(page.getByRole('button', { name: 'Save' }));

// Preview and apply chapter 1
await user.click(page.getByRole('radio', { name: bookToDraft }));
await user.click(page.getByRole('button', { name: bookToDraft, exact: true }));
await user.click(page.getByRole('button', { name: 'Add to project' }));
await user.click(page.getByRole('button', { name: 'Overwrite chapter' }));
await user.click(page.locator('app-tab-header').filter({ hasText: DRAFT_PROJECT_SHORT_NAME }));

// Go back to generate draft page and apply all chapters
await user.click(page.getByRole('link', { name: 'Generate draft' }));
await user.click(page.locator('app-draft-preview-books mat-button-toggle:last-child button'));
await user.click(page.getByRole('menuitem', { name: 'Add to project' }));
await user.check(page.getByRole('checkbox', { name: /I understand the draft will overwrite .* in .* project/ }));
await user.click(page.getByRole('button', { name: 'Add to project' }));
await expect(
page.getByRole('heading', { name: `Successfully applied all chapters to ${bookToDraft}` })
).toBeVisible();
await user.click(page.getByRole('button', { name: 'Close' }));
await user.click(page.getByRole('combobox', { name: 'Choose a project' }));
await user.type(DRAFT_PROJECT_SHORT_NAME);
await user.click(page.getByRole('option', { name: `${DRAFT_PROJECT_SHORT_NAME} -` }));
await user.click(page.getByRole('button', { name: 'Next' }));
await user.check(page.getByRole('checkbox', { name: /I understand that existing content will be overwritten/ }));
await user.click(page.getByRole('button', { name: 'Import' }));
await expect(page.getByText('Import complete', { exact: true })).toBeVisible();
await user.click(page.getByRole('button', { name: 'Next' }));
await user.click(page.locator('[data-test-id="step-7-sync"]'));
await expect(page.getByText(`The draft has been imported into ${DRAFT_PROJECT_SHORT_NAME}`)).toBeVisible({
timeout: E2E_SYNC_DEFAULT_TIMEOUT
});
await user.click(page.getByRole('button', { name: 'Done' }));

await screenshot(page, { pageName: 'generate_draft_add_to_project', ...context });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,11 @@ export async function localizedScreenshots(
await user.click(page.getByRole('button', { name: 'Save' }));

await forEachLocale(async locale => {
await user.hover(page.getByRole('radio').first(), defaultArrowLocation);
await user.hover(page.getByRole('button', { name: 'Ruth', exact: true }), defaultArrowLocation);
await screenshot(page, { ...context, pageName: 'draft_complete', locale });
});

await page.getByRole('radio', { name: 'Ruth' }).first().click();
await user.click(page.getByRole('button', { name: 'Ruth', exact: true }));

await expect(page.getByRole('button', { name: 'Add to project' })).toBeVisible({ timeout: 15_000 });

Expand All @@ -461,19 +461,16 @@ export async function localizedScreenshots(
await expect(page.getByText('The draft is ready')).toBeVisible();

await forEachLocale(async locale => {
await page.getByRole('radio').nth(1).click();
await user.hover(page.getByRole('menuitem').last(), defaultArrowLocation);
await user.hover(page.getByRole('button', { name: 'Add to project' }), defaultArrowLocation);
await screenshot(page, { ...context, pageName: 'import_book', locale });
await page.keyboard.press('Escape');
});

await forEachLocale(async locale => {
await page.getByRole('radio').nth(1).click();
await page.getByRole('menuitem').last().click();
await user.click(page.getByRole('button', { name: 'Add to project' }));

await page.getByRole('combobox').fill('seedsp2');
await page.getByRole('option', { name: 'seedsp2 - ' }).click();
await page.getByRole('checkbox').check();
await user.hover(page.getByRole('button').last(), defaultArrowLocation);
await user.hover(page.getByRole('button', { name: 'next' }), defaultArrowLocation);
await screenshotElements(
page,
[page.locator('mat-dialog-container')],
Expand Down
Loading