Skip to content

Commit

Permalink
fix new window
Browse files Browse the repository at this point in the history
  • Loading branch information
midleman committed Jan 19, 2025
1 parent 1dba00c commit f6dc133
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
14 changes: 8 additions & 6 deletions test/e2e/pages/editorActionBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,21 @@ export class EditorActionBar {
}

/**
* Verify: Check that the "open in new window" contains the specified title
* Verify: Check that the "open in new window" contains the specified text
* @param isWeb whether the test is running in the web or desktop app
* @param windowTitle the title to verify in the new window
* @param text the text to verify in the new window
*/
async verifyOpenInNewWindow(isWeb: boolean, windowTitle: string) {
async verifyOpenInNewWindow(isWeb: boolean, text: string | RegExp, exact = true) {
if (!isWeb) {
await test.step(`Verify "open new window" contains: ${windowTitle}`, async () => {
await test.step(`Verify "open new window" contains: ${text}`, async () => {
const [newPage] = await Promise.all([
this.page.context().waitForEvent('page'),
this.page.getByLabel('Move into new window').first().click(),
]);
await newPage.waitForLoadState();
await expect(newPage.getByText(windowTitle)).toBeVisible();
await newPage.waitForLoadState('load');
exact
? await expect(newPage.getByText(text, { exact: true })).toBeVisible()
: await expect(newPage.getByText(text)).toBeVisible();
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/editor-action-bar/data-files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ test.describe('Editor Action Bar: Data Files', {
await editorActionBar.clickSplitEditorButton('down');
await editorActionBar.verifySplitEditor('down', testCase.tabName);

await editorActionBar.verifyOpenInNewWindow(app.web, `${testCase.tabName} — qa-example-content`);
await editorActionBar.verifyOpenInNewWindow(app.web, testCase.tabName);
});
}
});
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/tests/editor-action-bar/document-files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ async function verifySplitEditor(tabName: string) {
await editorActionBar.verifySplitEditor('down', tabName);
}

async function verifyOpenInNewWindow(app: Application, title: string) {
await editorActionBar.verifyOpenInNewWindow(app.web, title);
async function verifyOpenInNewWindow(app: Application, text: string) {
await editorActionBar.verifyOpenInNewWindow(app.web, text, false);
}

async function verifyOpenViewerRendersHtml(app: Application, title: string) {
Expand Down

0 comments on commit f6dc133

Please sign in to comment.