Update readme
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -22,3 +22,4 @@ artifacts/
|
|||||||
|
|
||||||
# E2E Reports
|
# E2E Reports
|
||||||
**/playwright-report/**
|
**/playwright-report/**
|
||||||
|
**/test-results/**
|
||||||
@@ -1,9 +1,17 @@
|
|||||||
## VS Code CodeQL E2E Tests
|
## 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 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 `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.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ test("run query and open it from history", async ({ page }) => {
|
|||||||
)
|
)
|
||||||
.press("Enter");
|
.press("Enter");
|
||||||
|
|
||||||
// Download database
|
// download database
|
||||||
await page
|
await page
|
||||||
.getByRole("button", { name: "Download database" })
|
.getByRole("button", { name: "Download database" })
|
||||||
.click({ timeout: 60000 });
|
.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.type("Run Query on selected");
|
||||||
await page.keyboard.press("Enter");
|
await page.keyboard.press("Enter");
|
||||||
|
|
||||||
// select folder for first query run
|
// check if results page is visible
|
||||||
// await page.getByRole("button", { name: "OK" }).click();
|
await expect(page.getByText("CodeQL Query Results")).toBeVisible({
|
||||||
|
timeout: 600000,
|
||||||
|
});
|
||||||
|
|
||||||
// check that query was run successfully and results page opens
|
// wait for query history item to be finished
|
||||||
await page.getByText("Hello world on d3/d3").click({ timeout: 800000 });
|
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
|
// close results page and open query from history
|
||||||
await page
|
await page
|
||||||
.getByLabel("CodeQL Query Results, Editor Group")
|
.getByLabel("CodeQL Query Results, Editor Group")
|
||||||
.getByLabel("Close (Ctrl+F4)")
|
.getByLabel("Close (Ctrl+F4)")
|
||||||
.click();
|
.click();
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
page
|
page
|
||||||
.frameLocator(".webview")
|
.frameLocator(".webview")
|
||||||
@@ -65,9 +74,6 @@ test("run query and open it from history", async ({ page }) => {
|
|||||||
.click();
|
.click();
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
page
|
page.getByLabel("CodeQL Query Results", { exact: true }).locator("div"),
|
||||||
.frameLocator('iframe[name="\\34 884429a-d667-4121-932e-99abaa20b599"]')
|
).toBeVisible({ timeout: 60000 });
|
||||||
.frameLocator('iframe[title="CodeQL Query Results"]')
|
|
||||||
.getByText("#selectalerts32 resultsShow"),
|
|
||||||
).not.toBeVisible();
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user