Skip to content

Commit

Permalink
chore: Run E2E tests in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
flozia committed Sep 2, 2024
1 parent edd158c commit 67367f7
Show file tree
Hide file tree
Showing 14 changed files with 611 additions and 622 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Build

on: [push]
on:
pull_request:
types: [closed]

jobs:
npm-build:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker_build_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Build Docker image and publish

on:
push:
branches: [ main ]
pull_request:
types: [closed]
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docker_check.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Build Docker image check
on:
pull_request:
types: [closed]
jobs:
docker_build:
name: Build Docker image
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_pr_full.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Monitor E2E Full Test Suite
name: Monitor E2E Test Suite (full)
on: push
jobs:
e2e-tests:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_pr_smoke.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Monitor E2E Smoke Test Suite
name: Monitor E2E Test Suite (smoke)
on:
push:
branches: [ main ]
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/preview_deploy_gcp.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Deploy Preview

on:
on:
pull_request:
types: [closed]

env:
PROJECT_ID: ${{ secrets.GCP_PROJECT }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/reference_linter.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: Lint Reference Files
on:
push:
pull_request:
workflow_dispatch:
types: [closed]
jobs:
l10n-lint:
runs-on: ubuntu-latest
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/unittests.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Unit Tests

on: [push]
on:
pull_request:
types: [closed]

jobs:
unit-tests:
Expand Down
7 changes: 5 additions & 2 deletions playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,14 @@ export default defineConfig({
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,

/* Limit the number of failures */
maxFailures: process.env.CI ? 1 : undefined,

/* Retry on CI only */
retries: process.env.CI ? 1 : 0,

/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Use all of the available wokers in CI and use default locally. */
workers: process.env.CI ? "100%" : undefined,

/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: process.env.CI ? [['github'], ['html']] : 'html',
Expand Down
117 changes: 57 additions & 60 deletions src/e2e/specs/auth.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,74 +4,71 @@

import { test, expect } from "../fixtures/basePage.js";

test.describe.skip(
`${process.env.E2E_TEST_ENV} - Authentication flow verification @smoke`,
() => {
test.beforeEach(async ({ landingPage }) => {
await landingPage.open();
test.describe(`${process.env.E2E_TEST_ENV} - Authentication flow verification @smoke`, () => {
test.beforeEach(async ({ landingPage }) => {
await landingPage.open();
});

test("Verify sign up with new user", async ({
page,
authPage,
landingPage,
}, testInfo) => {
// speed up test by ignore non necessary requests
await page.route(/(analytics)/, async (route) => {
await route.abort();
});

test("Verify sign up with new user", async ({
page,
authPage,
landingPage,
}, testInfo) => {
// speed up test by ignore non necessary requests
await page.route(/(analytics)/, async (route) => {
await route.abort();
});
// start authentication flow
await landingPage.goToSignIn();

// start authentication flow
await landingPage.goToSignIn();
// Fill out sign up form
const randomEmail = `${Date.now()}[email protected]`;
await authPage.signUp(randomEmail, page);

// Fill out sign up form
const randomEmail = `${Date.now()}[email protected]`;
await authPage.signUp(randomEmail, page);
// assert successful login
const successUrl =
process.env.E2E_TEST_ENV === "local"
? "/user/dashboard"
: "/user/welcome";
expect(page.url()).toBe(`${process.env.E2E_TEST_BASE_URL}${successUrl}`);

// assert successful login
const successUrl =
process.env.E2E_TEST_ENV === "local"
? "/user/dashboard"
: "/user/welcome";
expect(page.url()).toBe(`${process.env.E2E_TEST_BASE_URL}${successUrl}`);
await testInfo.attach(
`${process.env.E2E_TEST_ENV}-signup-monitor-dashboard.png`,
{
body: await page.screenshot(),
contentType: "image/png",
},
);
});

await testInfo.attach(
`${process.env.E2E_TEST_ENV}-signup-monitor-dashboard.png`,
{
body: await page.screenshot(),
contentType: "image/png",
},
);
test("Verify sign in with existing user", async ({
page,
authPage,
landingPage,
dashboardPage,
}, testInfo) => {
// speed up test by ignore non necessary requests
await page.route(/(analytics)/, async (route) => {
await route.abort();
});

test("Verify sign in with existing user", async ({
page,
authPage,
landingPage,
dashboardPage,
}, testInfo) => {
// speed up test by ignore non necessary requests
await page.route(/(analytics)/, async (route) => {
await route.abort();
});

// start authentication flow
await landingPage.goToSignIn();
// start authentication flow
await landingPage.goToSignIn();

// sign in
await authPage.signIn(process.env.E2E_TEST_ACCOUNT_EMAIL as string);
// sign in
await authPage.signIn(process.env.E2E_TEST_ACCOUNT_EMAIL as string);

// assert successful login
await expect(dashboardPage.fixedTab).toBeVisible();
await expect(dashboardPage.actionNeededTab).toBeVisible();
// assert successful login
await expect(dashboardPage.fixedTab).toBeVisible();
await expect(dashboardPage.actionNeededTab).toBeVisible();

await testInfo.attach(
`${process.env.E2E_TEST_ENV}-signin-monitor-dashboard.png`,
{
body: await page.screenshot(),
contentType: "image/png",
},
);
});
},
);
await testInfo.attach(
`${process.env.E2E_TEST_ENV}-signin-monitor-dashboard.png`,
{
body: await page.screenshot(),
contentType: "image/png",
},
);
});
});
Loading

0 comments on commit 67367f7

Please sign in to comment.