Type-check Playwright E2E tests in CI

This commit is contained in:
Vsevolod Kukol
2026-09-12 00:43:57 +02:00
parent b16229d1f8
commit f33187efe1
6 changed files with 31 additions and 10 deletions
+1
View File
@@ -40,6 +40,7 @@ jobs:
- run: npm ci
- run: npm run compile
- run: npm run compile:strict
- run: npm run compile:e2e
format:
runs-on: ubuntu-latest
name: "Check Format"
+1
View File
@@ -227,6 +227,7 @@
"build:ase": "gulp build:ase",
"selfServeDocs": "typedoc",
"compile": "tsc",
"compile:e2e": "tsc -p ./tsconfig.test.json",
"compile:contracts": "tsc -p ./tsconfig.contracts.json",
"compile:strict": "tsc -p ./tsconfig.strict.json",
"format": "prettier --write \"{src,test}/**/*.{ts,tsx,html}\" \"*.{js,html}\"",
+15
View File
@@ -4,6 +4,21 @@ This directory contains end-to-end tests for Cosmos Data Explorer.
These tests **require** that you either deploy, or have access to, several Cosmos test Accounts.
The tests run in [Playwright](https://playwright.dev/), using the official Playwright test framework.
## Type-checking
After installing dependencies, run this command from the repository root:
```shell
npm run compile:e2e
```
This checks all test TypeScript files and `playwright.config.ts` without emitting files,
starting a browser, or connecting to Azure. It also loads the application declarations
needed by code imported from the tests. CI runs this check in the Compile TypeScript job.
`npm run compile` checks the application, not the E2E suite. Playwright's `--list` option
checks test discovery but does not replace TypeScript type-checking.
## Required Resources
To run all the tests, you need:
+2
View File
@@ -118,6 +118,7 @@ function tryGetStandardName(accountType: TestAccount) {
: `${process.env.DE_TEST_ACCOUNT_PREFIX}-`;
return `${actualPrefix}${accountType.toLocaleLowerCase()}`;
}
return undefined;
}
// Maps a base API account type to its dedicated connection string (account key) account.
@@ -474,6 +475,7 @@ export enum CommandBarButton {
ExecuteQuery = "Execute Query",
UploadItem = "Upload Item",
NewDocument = "New Document",
NewItem = "New Item",
View = "View",
}
+3 -3
View File
@@ -64,7 +64,7 @@ for (const { name, databaseId, containerId, documents } of documentTestCases) {
let newDocumentId;
await page.waitForTimeout(5000);
await retry(async () => {
const newDocumentButton = await explorer.waitForCommandBarButton("New Item", 5000);
const newDocumentButton = await explorer.waitForCommandBarButton(CommandBarButton.NewItem, 5000);
await expect(newDocumentButton).toBeVisible();
await expect(newDocumentButton).toBeEnabled();
await newDocumentButton.click();
@@ -79,7 +79,7 @@ for (const { name, databaseId, containerId, documents } of documentTestCases) {
};
await documentsTab.resultsEditor.setText(JSON.stringify(newDocument));
const saveButton = await explorer.waitForCommandBarButton("Save", 5000);
const saveButton = await explorer.waitForCommandBarButton(CommandBarButton.Save, 5000);
await saveButton.click({ timeout: 5000 });
await expect(saveButton).toBeHidden({ timeout: 5000 });
}, 3);
@@ -93,7 +93,7 @@ for (const { name, databaseId, containerId, documents } of documentTestCases) {
await newSpan.click();
await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
const deleteButton = await explorer.waitForCommandBarButton("Delete", 5000);
const deleteButton = await explorer.waitForCommandBarButton(CommandBarButton.Delete, 5000);
await deleteButton.click();
const deleteDialogButton = await explorer.waitForDialogButton("Delete", 5000);
+4 -2
View File
@@ -1,7 +1,9 @@
{
"extends": "./tsconfig.json",
"include": ["./test/**/*"],
"include": ["./test/**/*", "./playwright.config.ts", "./src/**/*.d.ts"],
"compilerOptions": {
"module": "commonjs"
"module": "commonjs",
"lib": ["es2022", "dom"],
"types": ["jest", "node"]
}
}