Skip to content

Commit b4a66a7

Browse files
committed
Update readme
1 parent d022623 commit b4a66a7

3 files changed

Lines changed: 28 additions & 13 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ artifacts/
2222

2323
# E2E Reports
2424
**/playwright-report/**
25+
**/test-results/**
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
## VS Code CodeQL E2E Tests
22

3-
### Set up
3+
When running the tests locally on a mac a different processor has to be emulated, which makes everythign VERY slow. Hence many timeouts in the test.
4+
5+
### How to use locally
6+
7+
Setup
48

59
- run `docker-compose build` from the e2e test folder `vscode-codeql/extensions/ql-vscode/test/e2e`
610
- run `docker-compose up` from the e2e test folder `vscode-codeql/extensions/ql-vscode/test/e2e`
7-
- run `npx playwright test --ui` from the vscode-codeql folder `vscode-codeql/extensions/ql-vscode`
811

9-
When you've run the test once! remove the volume data, e.g. by running `docker-compose down -v`
12+
Run tests
13+
14+
- run `npx playwright test --ui` from the vscode-codeql folder `vscode-codeql/extensions/ql-vscode` to follow the test while it's running. This UI has a 'locator' tool with which elements on the test screen can be
15+
- use `npx playwright test --debug` to follow the test in real time and interact with the interface, e.g. press enter or input into fields, stop and start
16+
17+
If you get failures after the first test run you can try to remove the volume data, e.g. by running `docker-compose down -v`. Sometimes already existing queries from former runs change the input the extension needs.

extensions/ql-vscode/test/e2e/run-query.spec.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ test("run query and open it from history", async ({ page }) => {
2525
)
2626
.press("Enter");
2727

28-
// Download database
28+
// download database
2929
await page
3030
.getByRole("button", { name: "Download database" })
3131
.click({ timeout: 60000 });
@@ -39,17 +39,26 @@ test("run query and open it from history", async ({ page }) => {
3939
await page.keyboard.type("Run Query on selected");
4040
await page.keyboard.press("Enter");
4141

42-
// select folder for first query run
43-
// await page.getByRole("button", { name: "OK" }).click();
42+
// check if results page is visible
43+
await expect(page.getByText("CodeQL Query Results")).toBeVisible({
44+
timeout: 600000,
45+
});
4446

45-
// check that query was run successfully and results page opens
46-
await page.getByText("Hello world on d3/d3").click({ timeout: 800000 });
47+
// wait for query history item to be finished
48+
await expect(
49+
page
50+
.locator("#list_id_6_0")
51+
.getByLabel("Hello world on d3/d3 -")
52+
.locator("div")
53+
.first(),
54+
).toBeVisible({ timeout: 60000 });
4755

4856
// close results page and open query from history
4957
await page
5058
.getByLabel("CodeQL Query Results, Editor Group")
5159
.getByLabel("Close (Ctrl+F4)")
5260
.click();
61+
5362
await expect(
5463
page
5564
.frameLocator(".webview")
@@ -65,9 +74,6 @@ test("run query and open it from history", async ({ page }) => {
6574
.click();
6675

6776
await expect(
68-
page
69-
.frameLocator('iframe[name="\\34 884429a-d667-4121-932e-99abaa20b599"]')
70-
.frameLocator('iframe[title="CodeQL Query Results"]')
71-
.getByText("#selectalerts32 resultsShow"),
72-
).not.toBeVisible();
77+
page.getByLabel("CodeQL Query Results", { exact: true }).locator("div"),
78+
).toBeVisible({ timeout: 60000 });
7379
});

0 commit comments

Comments
 (0)