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
21 changes: 21 additions & 0 deletions tests/codegen.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,24 @@ test('test', async ({ page }) => {
});`
}]);
});

test('running test should stop the recording', async ({ activate, showBrowser }) => {
test.skip(!showBrowser);

const { vscode, testController } = await activate({
'playwright.config.js': `module.exports = {}`,
'tests/test.spec.ts': `
import { test } from '@playwright/test';
test('one', () => {});
`,
});

const webView = vscode.webViews.get('pw.extension.settingsView')!;
await webView.getByText('Record new').click();
await expect.poll(() => vscode.lastWithProgressData, { timeout: 0 }).toEqual({ message: 'recording\u2026' });

const testRun = await testController.run();
await expect(testRun).toHaveOutput('passed');

await expect.poll(() => vscode.lastWithProgressData, { timeout: 0 }).toEqual('finished');
});
3 changes: 2 additions & 1 deletion tests/mock/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ export class VSCode {
readonly webViews = new Map<string, Page>();
readonly commandLog: string[] = [];
readonly l10n = new L10n();
lastWithProgressData = undefined;
lastWithProgressData: any;
private _hoverProviders: Map<string, HoverProvider> = new Map();
readonly version: string;
readonly connectionLog: any[] = [];
Expand Down Expand Up @@ -1111,6 +1111,7 @@ export class VSCode {
report: (data: any) => this.lastWithProgressData = data,
};
await callback(progress, new CancellationTokenSource().token);
this.lastWithProgressData = 'finished';
};
this.window.showTextDocument = (document: TextDocument) => {
const editor = new TextEditor(document);
Expand Down
21 changes: 21 additions & 0 deletions tests/pick-selector.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,24 @@ test('should pick locator and use the testIdAttribute from the config', async ({
// TODO: remove as per TODO above.
selectors.setTestIdAttribute('data-testid');
});

test('running test should dismiss the toolbar', async ({ activate, showBrowser }) => {
test.skip(!showBrowser);

const { vscode, testController } = await activate({
'playwright.config.js': `module.exports = {}`,
'tests/test.spec.ts': `
import { test } from '@playwright/test';
test('one', () => {});
`,
});

const settingsView = vscode.webViews.get('pw.extension.settingsView')!;
await settingsView.getByRole('button', { name: 'Pick locator' }).click();
await waitForRecorderMode(vscode, 'inspecting');

const testRun = await testController.run();
await expect(testRun).toHaveOutput('passed');

await waitForRecorderMode(vscode, 'none');
});
Loading