From 5bba2e9545308123da9172632caafaef672ba089 Mon Sep 17 00:00:00 2001 From: Filipe Freire Date: Tue, 11 Oct 2022 09:56:12 +0100 Subject: [PATCH] [INS-2022] Initial exploration multiple test projects (#5244) * Initial exploration multiple test projects * Replace duplicate scenario with one to be filled in * Simplify number of playwright project configs * Fix testMatch setting on playwright config * Edit github actions to distinguish between CI and Release runs --- .github/workflows/test.yml | 11 +++++++++-- package.json | 6 +++--- packages/insomnia-smoke-test/playwright.config.ts | 14 ++++++++++++++ .../tests/prerelease/basic-interactions.test.ts | 9 +++++++++ .../tests/{ => smoke}/app.test.ts | 4 ++-- .../tests/{ => smoke}/git-sync.test.ts | 2 +- .../tests/{ => smoke}/graphql.test.ts | 4 ++-- .../tests/{ => smoke}/grpc.test.ts | 4 ++-- .../tests/{ => smoke}/oauth-gitlab.test.ts | 2 +- .../tests/{ => smoke}/oauth.test.ts | 4 ++-- .../tests/{ => smoke}/openapi.test.ts | 2 +- .../tests/{ => smoke}/websocket.test.ts | 4 ++-- 12 files changed, 48 insertions(+), 18 deletions(-) create mode 100644 packages/insomnia-smoke-test/tests/prerelease/basic-interactions.test.ts rename packages/insomnia-smoke-test/tests/{ => smoke}/app.test.ts (97%) rename packages/insomnia-smoke-test/tests/{ => smoke}/git-sync.test.ts (97%) rename packages/insomnia-smoke-test/tests/{ => smoke}/graphql.test.ts (94%) rename packages/insomnia-smoke-test/tests/{ => smoke}/grpc.test.ts (90%) rename packages/insomnia-smoke-test/tests/{ => smoke}/oauth-gitlab.test.ts (97%) rename packages/insomnia-smoke-test/tests/{ => smoke}/oauth.test.ts (98%) rename packages/insomnia-smoke-test/tests/{ => smoke}/openapi.test.ts (93%) rename packages/insomnia-smoke-test/tests/{ => smoke}/websocket.test.ts (96%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 43da0ce011..b5b13a3a72 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,8 +53,15 @@ jobs: NODE_OPTIONS: '--max_old_space_size=6144' run: npm run app-build - - name: Run app smoke tests - run: npm run test:smoke:build + - name: Run Smoke tests (CI) + # Partial Smoke test run, for regular CI triggers + if: "!startsWith(github.head_ref, 'release/')" + run: npm run test:build --prefix packages/insomnia-smoke-test -- --project=Smoke + + - name: Run Smoke tests (Release) + # Full Smoke test run, for Release PRs + if: "startsWith(github.head_ref, 'release/')" + run: npm run test:build --prefix packages/insomnia-smoke-test - name: Set Inso CLI variables id: inso-variables diff --git a/package.json b/package.json index 599f14bbc5..5d44d30784 100644 --- a/package.json +++ b/package.json @@ -29,9 +29,9 @@ "app-package": "npm run build --prefix packages/insomnia && npm run package --prefix packages/insomnia", "app-bump-version": "npm run bump-version --prefix packages/insomnia", "preinstall": "node ./scripts/check-version.js", - "test:smoke:dev": "npm run test:dev --prefix packages/insomnia-smoke-test", - "test:smoke:build": "npm run test:build --prefix packages/insomnia-smoke-test", - "test:smoke:package": "npm run test:package --prefix packages/insomnia-smoke-test", + "test:smoke:dev": "npm run test:dev --prefix packages/insomnia-smoke-test -- --project=Smoke", + "test:smoke:build": "npm run test:build --prefix packages/insomnia-smoke-test -- --project=Smoke", + "test:smoke:package": "npm run test:package --prefix packages/insomnia-smoke-test -- --project=Smoke", "test:smoke:cli": "npm run test:cli --prefix packages/insomnia-smoke-test", "hard-reset": "npm run clean && npm run bootstrap && npm run app-start", "type-check": "lerna run type-check", diff --git a/packages/insomnia-smoke-test/playwright.config.ts b/packages/insomnia-smoke-test/playwright.config.ts index e0a58e0cfd..2e035160fd 100644 --- a/packages/insomnia-smoke-test/playwright.config.ts +++ b/packages/insomnia-smoke-test/playwright.config.ts @@ -1,6 +1,20 @@ /* eslint-disable filenames/match-exported */ import { PlaywrightTestConfig } from '@playwright/test'; const config: PlaywrightTestConfig = { + projects: [ + { + // Run all tests + name: 'Default', + testMatch: /.*.test.ts/, + retries: 0, + }, + { + // High-confidence smoke/sanity checks + name: 'Smoke', + testMatch: /smoke\/.*.test.ts/, + retries: 0, + }, + ], webServer: { command: 'npm run serve', url: 'http://127.0.0.1:4010', diff --git a/packages/insomnia-smoke-test/tests/prerelease/basic-interactions.test.ts b/packages/insomnia-smoke-test/tests/prerelease/basic-interactions.test.ts new file mode 100644 index 0000000000..a71a55ab99 --- /dev/null +++ b/packages/insomnia-smoke-test/tests/prerelease/basic-interactions.test.ts @@ -0,0 +1,9 @@ +import { expect } from '@playwright/test'; + +import { test } from '../../playwright/test'; + +test('Basic interactions', async ({ }) => { + // TODO(filfreire): add a few scenarios ported from the release checklist + + await expect(true).toBeTruthy(); +}); diff --git a/packages/insomnia-smoke-test/tests/app.test.ts b/packages/insomnia-smoke-test/tests/smoke/app.test.ts similarity index 97% rename from packages/insomnia-smoke-test/tests/app.test.ts rename to packages/insomnia-smoke-test/tests/smoke/app.test.ts index b6fecacb15..d6ef1edbbf 100644 --- a/packages/insomnia-smoke-test/tests/app.test.ts +++ b/packages/insomnia-smoke-test/tests/smoke/app.test.ts @@ -1,7 +1,7 @@ import { expect } from '@playwright/test'; -import { loadFixture } from '../playwright/paths'; -import { test } from '../playwright/test'; +import { loadFixture } from '../../playwright/paths'; +import { test } from '../../playwright/test'; test('can send requests', async ({ app, page }) => { test.slow(process.platform === 'darwin' || process.platform === 'win32', 'Slow app start on these platforms'); diff --git a/packages/insomnia-smoke-test/tests/git-sync.test.ts b/packages/insomnia-smoke-test/tests/smoke/git-sync.test.ts similarity index 97% rename from packages/insomnia-smoke-test/tests/git-sync.test.ts rename to packages/insomnia-smoke-test/tests/smoke/git-sync.test.ts index 0323b968b5..12c594c3fe 100644 --- a/packages/insomnia-smoke-test/tests/git-sync.test.ts +++ b/packages/insomnia-smoke-test/tests/smoke/git-sync.test.ts @@ -1,4 +1,4 @@ -import { test } from '../playwright/test'; +import { test } from '../../playwright/test'; test('Sign in with GitHub', async ({ app, page }) => { await page.locator('text=Setup Git Sync').click(); diff --git a/packages/insomnia-smoke-test/tests/graphql.test.ts b/packages/insomnia-smoke-test/tests/smoke/graphql.test.ts similarity index 94% rename from packages/insomnia-smoke-test/tests/graphql.test.ts rename to packages/insomnia-smoke-test/tests/smoke/graphql.test.ts index b13faa4d59..1d6da1fde3 100644 --- a/packages/insomnia-smoke-test/tests/graphql.test.ts +++ b/packages/insomnia-smoke-test/tests/smoke/graphql.test.ts @@ -1,7 +1,7 @@ import { expect } from '@playwright/test'; -import { loadFixture } from '../playwright/paths'; -import { test } from '../playwright/test'; +import { loadFixture } from '../../playwright/paths'; +import { test } from '../../playwright/test'; test('can render schema and send GraphQL requests', async ({ app, page }) => { test.slow(process.platform === 'darwin' || process.platform === 'win32', 'Slow app start on these platforms'); diff --git a/packages/insomnia-smoke-test/tests/grpc.test.ts b/packages/insomnia-smoke-test/tests/smoke/grpc.test.ts similarity index 90% rename from packages/insomnia-smoke-test/tests/grpc.test.ts rename to packages/insomnia-smoke-test/tests/smoke/grpc.test.ts index 495d3383b7..d66089261d 100644 --- a/packages/insomnia-smoke-test/tests/grpc.test.ts +++ b/packages/insomnia-smoke-test/tests/smoke/grpc.test.ts @@ -1,7 +1,7 @@ import { expect } from '@playwright/test'; -import { loadFixture } from '../playwright/paths'; -import { test } from '../playwright/test'; +import { loadFixture } from '../../playwright/paths'; +import { test } from '../../playwright/test'; test('can send gRPC requests', async ({ app, page }) => { test.slow(process.platform === 'darwin' || process.platform === 'win32', 'Slow app start on these platforms'); diff --git a/packages/insomnia-smoke-test/tests/oauth-gitlab.test.ts b/packages/insomnia-smoke-test/tests/smoke/oauth-gitlab.test.ts similarity index 97% rename from packages/insomnia-smoke-test/tests/oauth-gitlab.test.ts rename to packages/insomnia-smoke-test/tests/smoke/oauth-gitlab.test.ts index d3e880c537..e8fa3777f0 100644 --- a/packages/insomnia-smoke-test/tests/oauth-gitlab.test.ts +++ b/packages/insomnia-smoke-test/tests/smoke/oauth-gitlab.test.ts @@ -1,4 +1,4 @@ -import { test } from '../playwright/test'; +import { test } from '../../playwright/test'; test('Sign in with Gitlab', async ({ app, page }) => { await page.locator('text=Setup Git Sync').click(); diff --git a/packages/insomnia-smoke-test/tests/oauth.test.ts b/packages/insomnia-smoke-test/tests/smoke/oauth.test.ts similarity index 98% rename from packages/insomnia-smoke-test/tests/oauth.test.ts rename to packages/insomnia-smoke-test/tests/smoke/oauth.test.ts index fcd66f5e60..148da44bf1 100644 --- a/packages/insomnia-smoke-test/tests/oauth.test.ts +++ b/packages/insomnia-smoke-test/tests/smoke/oauth.test.ts @@ -1,7 +1,7 @@ import { expect } from '@playwright/test'; -import { loadFixture } from '../playwright/paths'; -import { test } from '../playwright/test'; +import { loadFixture } from '../../playwright/paths'; +import { test } from '../../playwright/test'; test('can make oauth2 requests', async ({ app, page }) => { if (process.platform === 'darwin') { diff --git a/packages/insomnia-smoke-test/tests/openapi.test.ts b/packages/insomnia-smoke-test/tests/smoke/openapi.test.ts similarity index 93% rename from packages/insomnia-smoke-test/tests/openapi.test.ts rename to packages/insomnia-smoke-test/tests/smoke/openapi.test.ts index 6d82047e04..82b20dff4f 100644 --- a/packages/insomnia-smoke-test/tests/openapi.test.ts +++ b/packages/insomnia-smoke-test/tests/smoke/openapi.test.ts @@ -1,6 +1,6 @@ import { expect } from '@playwright/test'; -import { test } from '../playwright/test'; +import { test } from '../../playwright/test'; test('can render Spectral OpenAPI lint errors', async ({ page }) => { await page.click('text=Design'); diff --git a/packages/insomnia-smoke-test/tests/websocket.test.ts b/packages/insomnia-smoke-test/tests/smoke/websocket.test.ts similarity index 96% rename from packages/insomnia-smoke-test/tests/websocket.test.ts rename to packages/insomnia-smoke-test/tests/smoke/websocket.test.ts index 25eac87b3c..d6ab056ae1 100644 --- a/packages/insomnia-smoke-test/tests/websocket.test.ts +++ b/packages/insomnia-smoke-test/tests/smoke/websocket.test.ts @@ -1,7 +1,7 @@ import { expect } from '@playwright/test'; -import { loadFixture } from '../playwright/paths'; -import { test } from '../playwright/test'; +import { loadFixture } from '../../playwright/paths'; +import { test } from '../../playwright/test'; test('can make websocket connection', async ({ app, page }) => { test.slow(process.platform === 'darwin' || process.platform === 'win32', 'Slow app start on these platforms');