Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
midleman committed Oct 25, 2024
1 parent 47bf353 commit 5531feb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 23 deletions.
12 changes: 2 additions & 10 deletions test/automation/src/positron/positronViewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,11 @@ export class PositronViewer {

constructor(private code: Code) { }

getViewerLocator(locator: string, { nestedFrame }: { nestedFrame?: string } = {}): Locator {
if (nestedFrame) {
return this.viewerFrame.frameLocator(nestedFrame).locator(locator);
}

getViewerLocator(locator: string,): Locator {
return this.viewerFrame.locator(locator);
}

getViewerFrame(nestedFrame?: string): FrameLocator {
if (nestedFrame) {
return this.viewerFrame.frameLocator(nestedFrame);
}

getViewerFrame(): FrameLocator {
return this.viewerFrame;
}

Expand Down
4 changes: 1 addition & 3 deletions test/smoke/src/areas/positron/quarto/quarto.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ describe('Quarto #web', () => {
it('should be able to generate preview [C842891]', async function () {
await app.workbench.quickaccess.runCommand('quarto.preview', { keepOpen: true });

const previewHeader = app.workbench.positronViewer.getViewerLocator('h1', {
nestedFrame: '//iframe'
});
const previewHeader = app.workbench.positronViewer.getViewerFrame().frameLocator('iframe').locator('h1');
await expect(previewHeader).toBeVisible({ timeout: 20000 });
await expect(previewHeader).toHaveText('Diamond sizes');
});
Expand Down
13 changes: 3 additions & 10 deletions test/smoke/src/areas/positron/rmarkdown/rmarkdown.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,9 @@ describe('RMarkdown #web', () => {

// inner most frame has no useful identifying features
// not factoring this locator because its not part of positron
const viewerFrame = app.workbench.positronViewer.getViewerFrame('//iframe');

// not factoring this locator because its not part of positron
const gettingStarted = viewerFrame.locator('h2[data-anchor-id="getting-started"]');

const gettingStartedText = await gettingStarted.innerText();

expect(gettingStartedText).toBe('Getting started');

await app.workbench.positronTerminal.sendKeysToTerminal('Control+C');
const gettingStarted = app.workbench.positronViewer.getViewerFrame().frameLocator('iframe').locator('h2[data-anchor-id="getting-started"]');

await expect(gettingStarted).toBeVisible({ timeout: 30000 });
await expect(gettingStarted).toHaveText('Getting started');
});
});

0 comments on commit 5531feb

Please sign in to comment.