Commit 7c68a134 authored by Vincent Ogloblinsky's avatar Vincent Ogloblinsky
Browse files

feat(tool): e2e tests

parent 5b32ff9b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -31,3 +31,7 @@
/.tmpl/
.angular/*
src/assets/kicker-aggregated-orange.json
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
+50 −38
Original line number Diff line number Diff line
@@ -4,19 +4,24 @@ include:
    - project: '$TBC_NAMESPACE/angular'
      ref: '4'
      file: '/templates/gitlab-ci-angular.yml'
    # Playwright template
    - project: 'to-be-continuous/playwright'
      ref: '1.3.0'
      file: '/templates/gitlab-ci-playwright.yml'
    # S3 template
    - project: '$TBC_NAMESPACE/s3'
      ref: '7'
      file: '/templates/gitlab-ci-s3.yml'

variables:
  NG_CLI_IMAGE: "registry.hub.docker.com/trion/ng-cli-karma:16.2.9"
  NG_BUILD_ARGS: "build --configuration production"
    NG_CLI_IMAGE: 'registry.hub.docker.com/trion/ng-cli-karma:16.2.9'
    NG_BUILD_ARGS: 'build --configuration production'
    # deploy: landing page (static/), mkdocs build (public/), Angular build (kicker/dist/) and aggregated kicker (kicker-aggregated/)
  S3_DEPLOY_FILES: "dist/kicker/"
  S3_PROD_DISABLED: "true"
  S3_STAGING_DISABLED: "true"
    S3_DEPLOY_FILES: 'dist/kicker/'
    S3_PROD_DISABLED: 'true'
    S3_STAGING_DISABLED: 'true'
    S3_REVIEW_PREFIX: ${CI_COMMIT_REF_SLUG}
    PLAYWRIGHT_IMAGE: 'mcr.microsoft.com/playwright:v1.41.2-jammy'

stages:
    - build
@@ -25,6 +30,13 @@ stages:
    - publish
    - production

playwright:
    script:
        - mkdir -p -m 777 reports
        - npx playwright install chrome
        - npx playwright install msedge
        - PLAYWRIGHT_JUNIT_OUTPUT_NAME=reports/playwright.xunit.xml npx playwright test ${TRACE+--debug} --reporter=junit $PLAYWRIGHT_EXTRA_ARGS

# override Angular build job to run build only (no tests)
ng-build:
    script:
@@ -41,7 +53,7 @@ pages:
        # generate build.info
        - echo -e "Build date= $(date)\nGit Commit Ref= $CI_COMMIT_REF_NAME\nGit Commit SHA= $CI_COMMIT_SHA\n" > public/build.info
    artifacts:
    name: "kicker app from $CI_COMMIT_REF_SLUG"
        name: 'kicker app from $CI_COMMIT_REF_SLUG'
        paths:
            - public
        expire_in: 1 day

e2e-tests/test.spec.ts

0 → 100644
+12 −0
Original line number Diff line number Diff line
import { test, expect } from '@playwright/test';

test('Has title and simple select', async ({ page }) => {
    await page.goto('/');
    await expect(page).toHaveTitle(/to be continuous - Kicker/);

    const buildSelector = page.locator('#build-choice');
    await buildSelector.selectOption({ value: 'to-be-continuous_angular' });

    await page.waitForTimeout(3000);
    await expect(page.locator('body')).toContainText('Angular lint analysis');
});
+60 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@
                "@angular/compiler-cli": "18.1.0",
                "@angular/language-service": "18.1.0",
                "@biomejs/biome": "1.8.3",
                "@playwright/test": "^1.45.2",
                "@types/node": "20.14.10",
                "ts-node": "10.9.2",
                "typescript": "^5.4.5"
@@ -2446,6 +2447,21 @@
                "node": ">=14"
            }
        },
        "node_modules/@playwright/test": {
            "version": "1.45.2",
            "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.45.2.tgz",
            "integrity": "sha512-JxG9eq92ET75EbVi3s+4sYbcG7q72ECeZNbdBlaMkGcNbiDQ4cAi8U2QP5oKkOx+1gpaiL1LDStmzCaEM1Z6fQ==",
            "dev": true,
            "dependencies": {
                "playwright": "1.45.2"
            },
            "bin": {
                "playwright": "cli.js"
            },
            "engines": {
                "node": ">=18"
            }
        },
        "node_modules/@popperjs/core": {
            "version": "2.11.8",
            "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",
@@ -7082,6 +7098,50 @@
                "nice-napi": "^1.0.2"
            }
        },
        "node_modules/playwright": {
            "version": "1.45.2",
            "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.45.2.tgz",
            "integrity": "sha512-ReywF2t/0teRvNBpfIgh5e4wnrI/8Su8ssdo5XsQKpjxJj+jspm00jSoz9BTg91TT0c9HRjXO7LBNVrgYj9X0g==",
            "dev": true,
            "dependencies": {
                "playwright-core": "1.45.2"
            },
            "bin": {
                "playwright": "cli.js"
            },
            "engines": {
                "node": ">=18"
            },
            "optionalDependencies": {
                "fsevents": "2.3.2"
            }
        },
        "node_modules/playwright-core": {
            "version": "1.45.2",
            "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.45.2.tgz",
            "integrity": "sha512-ha175tAWb0dTK0X4orvBIqi3jGEt701SMxMhyujxNrgd8K0Uy5wMSwwcQHtyB4om7INUkfndx02XnQ2p6dvLDw==",
            "dev": true,
            "bin": {
                "playwright-core": "cli.js"
            },
            "engines": {
                "node": ">=18"
            }
        },
        "node_modules/playwright/node_modules/fsevents": {
            "version": "2.3.2",
            "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
            "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
            "dev": true,
            "hasInstallScript": true,
            "optional": true,
            "os": [
                "darwin"
            ],
            "engines": {
                "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
            }
        },
        "node_modules/postcss": {
            "version": "8.4.38",
            "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz",
+38 −37
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@
    "@angular/compiler-cli": "18.1.0",
    "@angular/language-service": "18.1.0",
    "@biomejs/biome": "1.8.3",
    "@playwright/test": "^1.45.2",
    "@types/node": "20.14.10",
    "ts-node": "10.9.2",
    "typescript": "^5.4.5"
Loading