Update readme

This commit is contained in:
Nora
2024-01-10 12:59:22 +00:00
parent d022623a9d
commit b4a66a7690
3 changed files with 28 additions and 13 deletions

1
.gitignore vendored
View File

@@ -22,3 +22,4 @@ artifacts/
# E2E Reports
**/playwright-report/**
**/test-results/**

View File

@@ -1,9 +1,17 @@
## VS Code CodeQL E2E Tests
### Set up
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.
### How to use locally
Setup
- run `docker-compose build` from the e2e test folder `vscode-codeql/extensions/ql-vscode/test/e2e`
- run `docker-compose up` from the e2e test folder `vscode-codeql/extensions/ql-vscode/test/e2e`
- run `npx playwright test --ui` from the vscode-codeql folder `vscode-codeql/extensions/ql-vscode`
When you've run the test once! remove the volume data, e.g. by running `docker-compose down -v`
Run tests
- 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
- 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
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.

View File

@@ -25,7 +25,7 @@ test("run query and open it from history", async ({ page }) => {
)
.press("Enter");
// Download database
// download database
await page
.getByRole("button", { name: "Download database" })
.click({ timeout: 60000 });
@@ -39,17 +39,26 @@ test("run query and open it from history", async ({ page }) => {
await page.keyboard.type("Run Query on selected");
await page.keyboard.press("Enter");
// select folder for first query run
// await page.getByRole("button", { name: "OK" }).click();
// check if results page is visible
await expect(page.getByText("CodeQL Query Results")).toBeVisible({
timeout: 600000,
});
// check that query was run successfully and results page opens
await page.getByText("Hello world on d3/d3").click({ timeout: 800000 });
// wait for query history item to be finished
await expect(
page
.locator("#list_id_6_0")
.getByLabel("Hello world on d3/d3 -")
.locator("div")
.first(),
).toBeVisible({ timeout: 60000 });
// close results page and open query from history
await page
.getByLabel("CodeQL Query Results, Editor Group")
.getByLabel("Close (Ctrl+F4)")
.click();
await expect(
page
.frameLocator(".webview")
@@ -65,9 +74,6 @@ test("run query and open it from history", async ({ page }) => {
.click();
await expect(
page
.frameLocator('iframe[name="\\34 884429a-d667-4121-932e-99abaa20b599"]')
.frameLocator('iframe[title="CodeQL Query Results"]')
.getByText("#selectalerts32 resultsShow"),
).not.toBeVisible();
page.getByLabel("CodeQL Query Results", { exact: true }).locator("div"),
).toBeVisible({ timeout: 60000 });
});