Skip to content

Commit 59fb900

Browse files
sergiolmseamodio
authored andcommitted
add: base for playwright implementation
1 parent 1f24a33 commit 59fb900

File tree

8 files changed

+110
-4
lines changed

8 files changed

+110
-4
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ images/settings
99
gitlens-*.vsix
1010
tsconfig*.tsbuildinfo
1111
.DS_Store
12+
.wdio-vscode-service
13+
test-results
14+
playwright-report

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18007,6 +18007,7 @@
1800718007
},
1800818008
"devDependencies": {
1800918009
"@eamodio/eslint-lite-webpack-plugin": "0.0.8",
18010+
"@playwright/test": "1.45.1",
1801018011
"@swc/core": "1.7.3",
1801118012
"@twbs/fantasticon": "3.0.0",
1801218013
"@types/mocha": "10.0.7",
@@ -18047,6 +18048,7 @@
1804718048
"lz-string": "1.5.0",
1804818049
"mini-css-extract-plugin": "2.9.0",
1804918050
"mocha": "10.7.0",
18051+
"playwright": "1.45.1",
1805018052
"prettier": "3.1.0",
1805118053
"sass": "1.77.6",
1805218054
"sass-loader": "16.0.0",

tests/playwright/.eslintrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": ["../../.eslintrc.base.json"],
3+
"env": {
4+
"node": true
5+
},
6+
"files": ["**/*"],
7+
"parserOptions": {
8+
"project": "./tsconfig.json"
9+
}
10+
}

tests/playwright/playwright.config.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { defineConfig } from '@playwright/test';
2+
import { TestOptions } from './tests/baseTest';
3+
4+
export default defineConfig({
5+
use: {
6+
headless: true, // Ensure headless mode is enabled
7+
viewport: { width: 1920, height: 1080 },
8+
},
9+
reporter: 'list', // process.env.CI ? 'html' : 'list',
10+
timeout: 30000,
11+
workers: 1,
12+
expect: {
13+
timeout: 30000,
14+
},
15+
globalSetup: './setup',
16+
projects: [
17+
{
18+
name: 'VSCode stable',
19+
use: {
20+
vscodeVersion: 'stable',
21+
},
22+
},
23+
],
24+
});

tests/playwright/setup.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { downloadAndUnzipVSCode } from '@vscode/test-electron/out/download';
2+
3+
export default async () => {
4+
await downloadAndUnzipVSCode('insiders');
5+
await downloadAndUnzipVSCode('stable');
6+
};

tests/playwright/specs/basic2.test.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import path from 'path';
2+
import { downloadAndUnzipVSCode } from '@vscode/test-electron';
3+
import { _electron as electron, test } from '@playwright/test';
4+
import type { ElectronApplication } from '@playwright/test';
5+
6+
let electronApp: ElectronApplication;
7+
8+
const rootPath = path.resolve(__dirname, '../../../');
9+
const args = [
10+
'--verbose',
11+
'--debug',
12+
'--disable-gpu-sandbox', // https://github.com/microsoft/vscode-test/issues/221
13+
'--disable-updates', // https://github.com/microsoft/vscode-test/issues/120
14+
'--disable-workspace-trust',
15+
'--extensionDevelopmentPath=' + rootPath,
16+
'--new-window', // Opens a new session of VS Code instead of restoring the previous session (default).
17+
'--no-sandbox', // https://github.com/microsoft/vscode/issues/84238
18+
'--profile-temp', // "debug in a clean environment"
19+
'--skip-release-notes',
20+
'--skip-welcome',
21+
];
22+
23+
test.beforeEach(async () => {
24+
electronApp = await electron.launch({
25+
executablePath: await downloadAndUnzipVSCode('stable'),
26+
args,
27+
});
28+
});
29+
30+
test('launches vscode', async () => {
31+
const page = await electronApp.firstWindow();
32+
33+
// This should fail, but if it runs it means our vscode instance is running
34+
await page.getByRole('button', { name: 'Some button' }).click();
35+
});
36+
37+
test.afterEach(async () => {
38+
await electronApp?.close();
39+
});

tests/playwright/tsconfig.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extend": "../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"target": "ESNext",
5+
"module": "node",
6+
"moduleResolution": "node",
7+
"strict": true,
8+
"esModuleInterop": true,
9+
"skipLibCheck": true,
10+
"forceConsistentCasingInFileNames": true,
11+
"outDir": "./out",
12+
"sourceMap": true
13+
},
14+
"include": ["**/*.ts"]
15+
}

yarn.lock

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,13 @@
740740
dependencies:
741741
playwright-core "1.45.3"
742742

743+
"@playwright/[email protected]":
744+
version "1.45.1"
745+
resolved "https://registry.npmjs.org/@playwright/test/-/test-1.45.1.tgz#819b90fa43d17000fce5ebd127043fd661938b7a"
746+
integrity sha512-Wo1bWTzQvGA7LyKGIZc8nFSTFf2TkthGIFBR+QVNilvwouGzFd4PYukZe3rvf5PSqjHi1+1NyKSDZKcQWETzaA==
747+
dependencies:
748+
playwright "1.45.1"
749+
743750
"@polka/url@^1.0.0-next.24":
744751
version "1.0.0-next.25"
745752
resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.25.tgz#f077fdc0b5d0078d30893396ff4827a13f99e817"
@@ -6079,10 +6086,10 @@ [email protected]:
60796086
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.45.3.tgz#e77bc4c78a621b96c3e629027534ee1d25faac93"
60806087
integrity sha512-+ym0jNbcjikaOwwSZycFbwkWgfruWvYlJfThKYAlImbxUgdWFO2oW70ojPm4OpE4t6TAo2FY/smM+hpVTtkhDA==
60816088

6082-
playwright@^1.45.0:
6083-
version "1.45.3"
6084-
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.45.3.tgz#75143f73093a6e1467f7097083d2f0846fb8dd2f"
6085-
integrity sha512-QhVaS+lpluxCaioejDZ95l4Y4jSFCsBvl2UZkpeXlzxmqS+aABr5c82YmfMHrL6x27nvrvykJAFpkzT2eWdJww==
6089+
playwright@1.45.1, playwright@^1.45.0:
6090+
version "1.45.1"
6091+
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.45.1.tgz#aaa6b0d6db14796b599d80c6679e63444e942534"
6092+
integrity sha512-Hjrgae4kpSQBr98nhCj3IScxVeVUixqj+5oyif8TdIn2opTCPEzqAqNMeK42i3cWDCVu9MI+ZsGWw+gVR4ISBg==
60866093
dependencies:
60876094
playwright-core "1.45.3"
60886095
optionalDependencies:

0 commit comments

Comments
 (0)