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
2 changes: 2 additions & 0 deletions test/e2e/fixtures/test-setup/settings.fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export function SettingsFixture(app: Application) {
}

if (waitForReady) {
await app.code.driver.page.waitForTimeout(3000);
await app.code.driver.page.locator('.monaco-workbench').waitFor({ state: 'visible' });
await app.workbench.sessions.expectNoStartUpMessaging();
}
},
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/infra/workbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ export class Workbench {
this.output = new Output(code, this.quickaccess, this.quickInput);
this.console = new Console(code, this.quickInput, this.quickaccess, this.hotKeys, this.contextMenu);
this.modals = new Modals(code, this.toasts, this.console);
this.clipboard = new Clipboard(code, this.hotKeys);
this.sessions = new Sessions(code, this.quickaccess, this.quickInput, this.console);
this.notebooks = new Notebooks(code, this.quickInput, this.quickaccess, this.hotKeys);
this.notebooksVscode = new VsCodeNotebooks(code, this.quickInput, this.quickaccess, this.hotKeys);
this.notebooksPositron = new PositronNotebooks(code, this.quickInput, this.quickaccess, this.hotKeys);
this.notebooksPositron = new PositronNotebooks(code, this.quickInput, this.quickaccess, this.hotKeys, this.clipboard);
this.welcome = new Welcome(code);
this.clipboard = new Clipboard(code, this.hotKeys);
this.terminal = new Terminal(code, this.quickaccess, this.clipboard);
this.viewer = new Viewer(code);
this.editor = new Editor(code);
Expand Down
27 changes: 23 additions & 4 deletions test/e2e/pages/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,38 @@ export class Clipboard {
// Seed the clipboard
await this.setClipboardText(seed);

// Invoke the copy hotkey
await this.hotKeys.copy();

// Wait until clipboard value differs from the seed
await expect
.poll(async () => (await this.getClipboardText()) ?? '', {
.poll(async () => {
await this.hotKeys.copy();
return (await this.getClipboardText()) ?? '';
}, {
message: 'clipboard should change after copy',
timeout: timeoutMs,
intervals: [100, 150, 200, 300, 500, 800],
})
.not.toBe(seed);
}

async cut(timeoutMs = 5000): Promise<void> {
const seed = '__SEED__';
// Seed the clipboard
await this.setClipboardText(seed);

// Wait until clipboard value differs from the seed
await this.hotKeys.cut();

await expect
.poll(async () => {
return (await this.getClipboardText()) ?? '';
}, {
message: 'clipboard should change after cut',
timeout: timeoutMs,
intervals: [100, 150, 200, 300, 500, 800],
})
.not.toBe(seed);
}

async paste(): Promise<void> {
await this.hotKeys.paste();
}
Expand Down
9 changes: 8 additions & 1 deletion test/e2e/pages/hotKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,15 @@ export class HotKeys {
await this.pressHotKeys('Cmd+J K', 'Open workspace settings JSON', true);
}

public async reloadWindow() {
public async reloadWindow(waitForReady = false) {
await this.pressHotKeys('Cmd+R R', 'Reload window');

// wait for workbench to disappear, reappear and be ready
await this.code.driver.page.waitForTimeout(3000);
await this.code.driver.page.locator('.monaco-workbench').waitFor({ state: 'visible' });
if (waitForReady) {
await expect(this.code.driver.page.locator('text=/^Starting up|^Starting|^Preparing|^Discovering( \\w+)? interpreters|starting\\.$/i')).toHaveCount(0, { timeout: 90000 });
}
}

public async openWelcomeWalkthrough() {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/pages/notebooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class Notebooks {
});
}

async addCodeToCellAtIndex(code: string, cellIndex = 0, delay = 0) {
async addCodeToCellAtIndex(cellIndex: number, code: string, delay = 0) {
await test.step('Add code to first cell', async () => {
await this.selectCellAtIndex(cellIndex);
await this.typeInEditor(code, delay);
Expand Down
Loading