-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure integration tests with Playwright
Add and configure Playwright in vscode-trace-extension package. Add extension-test.spec.ts with a few simple tests. Ignore and exclude test files and folders from build and version control. Partially fixes Issue #34 Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
- Loading branch information
1 parent
af24b05
commit e054dc8
Showing
8 changed files
with
207 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { defineConfig, devices } from '@playwright/test'; | ||
|
||
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
*/ | ||
export default defineConfig({ | ||
testDir: './vscode-trace-extension/src/test/', | ||
/* Run tests in files in parallel */ | ||
fullyParallel: true, | ||
/* Fail the build on CI if you accidentally left test.only in the source code. */ | ||
forbidOnly: !!process.env.CI, | ||
/* Retry on CI only */ | ||
retries: process.env.CI ? 2 : 0, | ||
/* Opt out of parallel tests on CI. */ | ||
workers: process.env.CI ? 1 : undefined, | ||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ | ||
reporter: 'html', | ||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ | ||
use: { | ||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ | ||
trace: 'on-first-retry', | ||
}, | ||
|
||
/* Configure projects for major browsers */ | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] }, | ||
}, | ||
|
||
{ | ||
name: 'firefox', | ||
use: { ...devices['Desktop Firefox'] }, | ||
}, | ||
|
||
{ | ||
name: 'webkit', | ||
use: { ...devices['Desktop Safari'] }, | ||
} | ||
] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.goto('http://localhost:3000'); | ||
await page.getByRole('tab', { name: 'Welcome, preview' }).getByRole('button', { name: /Close/ }).click(); | ||
await page.getByRole('button', { name: 'Never' }).click(); | ||
}); | ||
|
||
test('Open Trace from Explorer', async ({ page }) => { | ||
await page.getByRole('treeitem', { name: '202-bug-hunt' }).locator('a').click(); | ||
await page.getByRole('treeitem', { name: 'cat-kernel' }).locator('a').click({ button: 'right' }); | ||
await page.getByRole('menuitem', { name: 'Open with Trace Viewer' }).hover(); | ||
await page.getByRole('menuitem', { name: 'Open with Trace Viewer' }).click(); | ||
await expect(page.getByRole('tab', { name: 'cat-kernel'})).toBeVisible(); | ||
}); | ||
|
||
test('Open Trace from Trace Viewer', async ({ page }) => { | ||
await page.getByRole('tab', { name: 'Trace Viewer' }).locator('a').click(); | ||
await page.getByRole('button', { name: 'Opened Traces Section' }).hover(); | ||
await page.getByRole('button', { name: 'Open Trace' }).click(); | ||
await page.getByRole('option', { name: '202-bug-hunt' }).locator('a').click(); | ||
await page.getByRole('option', { name: 'cat-kernel' }).locator('a').click(); | ||
await page.waitForTimeout(1000); | ||
await page.getByRole('button', { name: 'OK' }).click(); | ||
await expect(page.getByRole('tab', { name: 'cat-kernel'})).toBeVisible(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters