From bdc280a8efa7dd85faae4b32bae6f9d2b4a696fc Mon Sep 17 00:00:00 2001 From: Peter Havekes Date: Thu, 23 Oct 2025 13:31:49 +0200 Subject: [PATCH 01/21] Add playwright base --- .github/workflows/playwright.yml | 27 +++++++ playwright/.github/workflows/playwright.yml | 27 +++++++ playwright/.gitignore | 8 +++ playwright/package.json | 11 +++ playwright/playwright.config.ts | 79 +++++++++++++++++++++ playwright/tests/example.spec.ts | 18 +++++ playwright/yarn.lock | 41 +++++++++++ 7 files changed, 211 insertions(+) create mode 100644 .github/workflows/playwright.yml create mode 100644 playwright/.github/workflows/playwright.yml create mode 100644 playwright/.gitignore create mode 100644 playwright/package.json create mode 100644 playwright/playwright.config.ts create mode 100644 playwright/tests/example.spec.ts create mode 100644 playwright/yarn.lock diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml new file mode 100644 index 00000000..a94b6417 --- /dev/null +++ b/.github/workflows/playwright.yml @@ -0,0 +1,27 @@ +name: Playwright Tests +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] +jobs: + test: + timeout-minutes: 60 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: lts/* + - name: Install dependencies + run: npm install -g yarn && yarn + - name: Install Playwright Browsers + run: yarn playwright install --with-deps + - name: Run Playwright tests + run: yarn playwright test + - uses: actions/upload-artifact@v4 + if: ${{ !cancelled() }} + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 diff --git a/playwright/.github/workflows/playwright.yml b/playwright/.github/workflows/playwright.yml new file mode 100644 index 00000000..a94b6417 --- /dev/null +++ b/playwright/.github/workflows/playwright.yml @@ -0,0 +1,27 @@ +name: Playwright Tests +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] +jobs: + test: + timeout-minutes: 60 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: lts/* + - name: Install dependencies + run: npm install -g yarn && yarn + - name: Install Playwright Browsers + run: yarn playwright install --with-deps + - name: Run Playwright tests + run: yarn playwright test + - uses: actions/upload-artifact@v4 + if: ${{ !cancelled() }} + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 diff --git a/playwright/.gitignore b/playwright/.gitignore new file mode 100644 index 00000000..335bd46d --- /dev/null +++ b/playwright/.gitignore @@ -0,0 +1,8 @@ + +# Playwright +node_modules/ +/test-results/ +/playwright-report/ +/blob-report/ +/playwright/.cache/ +/playwright/.auth/ diff --git a/playwright/package.json b/playwright/package.json new file mode 100644 index 00000000..f6be642c --- /dev/null +++ b/playwright/package.json @@ -0,0 +1,11 @@ +{ + "name": "playwright", + "version": "1.0.0", + "main": "index.js", + "license": "MIT", + "devDependencies": { + "@playwright/test": "^1.56.1", + "@types/node": "^24.9.1" + }, + "scripts": {} +} diff --git a/playwright/playwright.config.ts b/playwright/playwright.config.ts new file mode 100644 index 00000000..6dfc0d9b --- /dev/null +++ b/playwright/playwright.config.ts @@ -0,0 +1,79 @@ +import { defineConfig, devices } from '@playwright/test'; + +/** + * Read environment variables from file. + * https://github.com/motdotla/dotenv + */ +// import dotenv from 'dotenv'; +// import path from 'path'; +// dotenv.config({ path: path.resolve(__dirname, '.env') }); + +/** + * See https://playwright.dev/docs/test-configuration. + */ +export default defineConfig({ + testDir: './tests', + /* Run tests in files in parallel */ + fullyParallel: true, + /* Fail the build on CI if you accidentally left test.only in the source code. */ + forbidOnly: !!process.env.CI, + /* Retry on CI only */ + retries: process.env.CI ? 2 : 0, + /* Opt out of parallel tests on CI. */ + workers: process.env.CI ? 1 : undefined, + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ + reporter: 'html', + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ + use: { + /* Base URL to use in actions like `await page.goto('')`. */ + // baseURL: 'http://localhost:3000', + + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ + trace: 'on-first-retry', + }, + + /* Configure projects for major browsers */ + projects: [ + { + name: 'chromium', + use: { ...devices['Desktop Chrome'] }, + }, + + { + name: 'firefox', + use: { ...devices['Desktop Firefox'] }, + }, + + { + name: 'webkit', + use: { ...devices['Desktop Safari'] }, + }, + + /* Test against mobile viewports. */ + // { + // name: 'Mobile Chrome', + // use: { ...devices['Pixel 5'] }, + // }, + // { + // name: 'Mobile Safari', + // use: { ...devices['iPhone 12'] }, + // }, + + /* Test against branded browsers. */ + // { + // name: 'Microsoft Edge', + // use: { ...devices['Desktop Edge'], channel: 'msedge' }, + // }, + // { + // name: 'Google Chrome', + // use: { ...devices['Desktop Chrome'], channel: 'chrome' }, + // }, + ], + + /* Run your local dev server before starting the tests */ + // webServer: { + // command: 'npm run start', + // url: 'http://localhost:3000', + // reuseExistingServer: !process.env.CI, + // }, +}); diff --git a/playwright/tests/example.spec.ts b/playwright/tests/example.spec.ts new file mode 100644 index 00000000..54a906a4 --- /dev/null +++ b/playwright/tests/example.spec.ts @@ -0,0 +1,18 @@ +import { test, expect } from '@playwright/test'; + +test('has title', async ({ page }) => { + await page.goto('https://playwright.dev/'); + + // Expect a title "to contain" a substring. + await expect(page).toHaveTitle(/Playwright/); +}); + +test('get started link', async ({ page }) => { + await page.goto('https://playwright.dev/'); + + // Click the get started link. + await page.getByRole('link', { name: 'Get started' }).click(); + + // Expects page to have a heading with the name of Installation. + await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible(); +}); diff --git a/playwright/yarn.lock b/playwright/yarn.lock new file mode 100644 index 00000000..d250dd94 --- /dev/null +++ b/playwright/yarn.lock @@ -0,0 +1,41 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@playwright/test@^1.56.1": + version "1.56.1" + resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.56.1.tgz#6e3bf3d0c90c5cf94bf64bdb56fd15a805c8bd3f" + integrity sha512-vSMYtL/zOcFpvJCW71Q/OEGQb7KYBPAdKh35WNSkaZA75JlAO8ED8UN6GUNTm3drWomcbcqRPFqQbLae8yBTdg== + dependencies: + playwright "1.56.1" + +"@types/node@^24.9.1": + version "24.9.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-24.9.1.tgz#b7360b3c789089e57e192695a855aa4f6981a53c" + integrity sha512-QoiaXANRkSXK6p0Duvt56W208du4P9Uye9hWLWgGMDTEoKPhuenzNcC4vGUmrNkiOKTlIrBoyNQYNpSwfEZXSg== + dependencies: + undici-types "~7.16.0" + +fsevents@2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" + integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + +playwright-core@1.56.1: + version "1.56.1" + resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.56.1.tgz#24a66481e5cd33a045632230aa2c4f0cb6b1db3d" + integrity sha512-hutraynyn31F+Bifme+Ps9Vq59hKuUCz7H1kDOcBs+2oGguKkWTU50bBWrtz34OUWmIwpBTWDxaRPXrIXkgvmQ== + +playwright@1.56.1: + version "1.56.1" + resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.56.1.tgz#62e3b99ddebed0d475e5936a152c88e68be55fbf" + integrity sha512-aFi5B0WovBHTEvpM3DzXTUaeN6eN0qWnTkKx4NQaH4Wvcmc153PdaY2UBdSYKaGYw+UyWXSVyxDUg5DoPEttjw== + dependencies: + playwright-core "1.56.1" + optionalDependencies: + fsevents "2.3.2" + +undici-types@~7.16.0: + version "7.16.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.16.0.tgz#ffccdff36aea4884cbfce9a750a0580224f58a46" + integrity sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw== From b687a12d253861973180be8d470213d55bd9d3e8 Mon Sep 17 00:00:00 2001 From: Ines Date: Thu, 23 Oct 2025 13:45:18 +0200 Subject: [PATCH 02/21] eerste 2 testjes --- playwright/tests/example.spec.ts | 18 ------- .../tests/myconext-gui-check-for-404s.spec.ts | 53 +++++++++++++++++++ .../myconext-gui-check-home-page.spec.ts | 10 ++++ 3 files changed, 63 insertions(+), 18 deletions(-) delete mode 100644 playwright/tests/example.spec.ts create mode 100644 playwright/tests/myconext-gui-check-for-404s.spec.ts create mode 100644 playwright/tests/myconext-gui-check-home-page.spec.ts diff --git a/playwright/tests/example.spec.ts b/playwright/tests/example.spec.ts deleted file mode 100644 index 54a906a4..00000000 --- a/playwright/tests/example.spec.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test('has title', async ({ page }) => { - await page.goto('https://playwright.dev/'); - - // Expect a title "to contain" a substring. - await expect(page).toHaveTitle(/Playwright/); -}); - -test('get started link', async ({ page }) => { - await page.goto('https://playwright.dev/'); - - // Click the get started link. - await page.getByRole('link', { name: 'Get started' }).click(); - - // Expects page to have a heading with the name of Installation. - await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible(); -}); diff --git a/playwright/tests/myconext-gui-check-for-404s.spec.ts b/playwright/tests/myconext-gui-check-for-404s.spec.ts new file mode 100644 index 00000000..f6326c09 --- /dev/null +++ b/playwright/tests/myconext-gui-check-for-404s.spec.ts @@ -0,0 +1,53 @@ +import { expect, Page, test } from "@playwright/test" + +async function getAllLinksFromPage(page: Page) { + // getByRole('link') only matches visible links + // + // if you want to check all links, you can use a CSS selector + // like 'locator("a")' + const links = page.getByRole("link") + + const allLinks = await links.all() + const allLinkHrefs = await Promise.all( + allLinks.map((link) => link.getAttribute("href")) + ) + const validHrefs = allLinkHrefs.reduce((links, link) => { + expect.soft(link, "link has no a proper href").not.toBeFalsy() + + if (link && !link?.startsWith("mailto:") && !link?.startsWith("#")) + links.add(new URL(link, page.url()).href) + return links + }, new Set()) + + return validHrefs +} + +test.describe("No 404s on Checkly pages", () => { + test(`The docs have no 404s`, async ({ page }, testInfo) => { + await page.goto("https://www.eduid.nl") + const linkUrls = await getAllLinksFromPage(page) + + for (const url of linkUrls) { + await test.step(`Checking link: ${url}`, async () => { + try { + // Note that some hosters / firewalls will block plain requests (Cloudflare, etc.) + // if that's the case for you, consider using `page.goto` + // or excluding particular URLs from the test + const response = await page.request.get(url) + + expect + .soft(response.ok(), `${url} has no green status code`) + .toBeTruthy() + } catch { + expect.soft(null, `${url} has no green status code`).toBeTruthy() + } + }) + } + + testInfo.attach("checked-links.txt", { + body: Array.from(linkUrls).join("\n"), + }) + }) +}) + +// Source: https://github.com/checkly/playwright-examples/blob/main/404-detection/tests/no-404s.spec.ts \ No newline at end of file diff --git a/playwright/tests/myconext-gui-check-home-page.spec.ts b/playwright/tests/myconext-gui-check-home-page.spec.ts new file mode 100644 index 00000000..7a91a7d9 --- /dev/null +++ b/playwright/tests/myconext-gui-check-home-page.spec.ts @@ -0,0 +1,10 @@ +import { test, expect } from '@playwright/test'; + +test('check generale page', async ({ page }) => { + await page.goto('https://test.eduid.nl'); + await page.getByRole('link', {name: 'EN'}).click(); + await expect(page.getByRole('heading', { name: 'eduID', exact: true })).toBeVisible(); + await expect(page.getByRole('button', { name: 'My eduID' })).toBeVisible(); + await expect(page.getByRole('button', { name: 'Create an eduID' }).first()).toBeVisible(); + +}); \ No newline at end of file From 2e5dff4eee2b2a56af4967ad18aa125e77edef37 Mon Sep 17 00:00:00 2001 From: Peter Havekes Date: Thu, 23 Oct 2025 13:54:00 +0200 Subject: [PATCH 03/21] Start server in gha --- .github/workflows/playwright.yml | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index a94b6417..c4223697 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -1,18 +1,39 @@ name: Playwright Tests on: push: - branches: [ main, master ] + branches: [ main ] pull_request: - branches: [ main, master ] + branches: [ main ] jobs: test: timeout-minutes: 60 runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v5 with: - node-version: lts/* + node-version: '24.3.0' + - name: Start MongoDB + uses: supercharge/mongodb-github-action@1.12.0 + with: + mongodb-version: ${{ matrix.mongodb-version }} + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + java-version: 21 + distribution: 'temurin' + cache: 'maven' + - name: Set up cache + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Build with Maven + run: mvn clean install --file pom.xml + - name: Run myconext-server + run : cd myconext-server && mvn spring-boot:run -Dspring-boot.run.profiles=dev - name: Install dependencies run: npm install -g yarn && yarn - name: Install Playwright Browsers From 652b2de8c395dbd13aaf916220995acfee48f537 Mon Sep 17 00:00:00 2001 From: Peter Havekes Date: Thu, 23 Oct 2025 13:57:00 +0200 Subject: [PATCH 04/21] Mongo version in gha --- .github/workflows/playwright.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index c4223697..ee7a6fa7 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -16,7 +16,7 @@ jobs: - name: Start MongoDB uses: supercharge/mongodb-github-action@1.12.0 with: - mongodb-version: ${{ matrix.mongodb-version }} + mongodb-version: 4.4 - name: Set up JDK 21 uses: actions/setup-java@v5 with: From bef37afcad7a00b34b4b7770add789badf7ffabb Mon Sep 17 00:00:00 2001 From: Peter Havekes Date: Thu, 23 Oct 2025 14:06:16 +0200 Subject: [PATCH 05/21] Start frontends in gha --- .github/workflows/playwright.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index ee7a6fa7..0f7aaa09 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -33,8 +33,16 @@ jobs: - name: Build with Maven run: mvn clean install --file pom.xml - name: Run myconext-server - run : cd myconext-server && mvn spring-boot:run -Dspring-boot.run.profiles=dev - - name: Install dependencies + run : cd myconext-server && mvn spring-boot:run -Dspring-boot.run.profiles=dev && + - name: Run account-gui + run: cd account-gui && nvm use && yarn install && yarn dev && + - name: Run myconext--gui + run: cd myconext-gui && nvm use && yarn install && yarn dev && + - name: Run servicedesk-gui + run: cd servcedesk-gui && nvm use && yarn install && yarn dev && + - name: Run public-gui + run: cd public-gui && nvm use && yarn install && yarn dev && + - name: Install dependencies for plarwright run: npm install -g yarn && yarn - name: Install Playwright Browsers run: yarn playwright install --with-deps From 4ce6870bcf7f431d42cafbadcf4cf54a179df906 Mon Sep 17 00:00:00 2001 From: Peter Havekes Date: Thu, 23 Oct 2025 14:11:46 +0200 Subject: [PATCH 06/21] fix --- .github/workflows/playwright.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 0f7aaa09..6fd9e528 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -30,18 +30,18 @@ jobs: key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- - - name: Build with Maven - run: mvn clean install --file pom.xml +# - name: Build with Maven +# run: mvn clean install --file pom.xml - name: Run myconext-server - run : cd myconext-server && mvn spring-boot:run -Dspring-boot.run.profiles=dev && + run : cd myconext-server && mvn spring-boot:run -Dspring-boot.run.profiles=dev & - name: Run account-gui - run: cd account-gui && nvm use && yarn install && yarn dev && + run: cd account-gui && nvm use && yarn install && yarn dev & - name: Run myconext--gui - run: cd myconext-gui && nvm use && yarn install && yarn dev && + run: cd myconext-gui && nvm use && yarn install && yarn dev & - name: Run servicedesk-gui - run: cd servcedesk-gui && nvm use && yarn install && yarn dev && + run: cd servcedesk-gui && nvm use && yarn install && yarn dev & - name: Run public-gui - run: cd public-gui && nvm use && yarn install && yarn dev && + run: cd public-gui && nvm use && yarn install && yarn dev & - name: Install dependencies for plarwright run: npm install -g yarn && yarn - name: Install Playwright Browsers From 94f6e6380f4e189a802a9002a911b2890e7f6d44 Mon Sep 17 00:00:00 2001 From: Peter Havekes Date: Thu, 23 Oct 2025 14:34:20 +0200 Subject: [PATCH 07/21] Add data to mongo --- .github/workflows/playwright.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 6fd9e528..23b3af60 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -17,12 +17,23 @@ jobs: uses: supercharge/mongodb-github-action@1.12.0 with: mongodb-version: 4.4 + - name: Install MongoDB Tools + run: sudo apt-get update && sudo apt-get install -y mongodb-org-shell mongodb-org-tools - name: Set up JDK 21 uses: actions/setup-java@v5 with: java-version: 21 distribution: 'temurin' cache: 'maven' + - name: Load users.json to MongoDB + run: | + mongoimport \ + --host localhost \ + --port 27017 \ + --db myconext \ + --collection users \ + --file myconext-server/src/test/resources/users.json \ + --jsonArray - name: Set up cache uses: actions/cache@v4 with: From 1b3dac6e2280e5da37ecd86a82bce2c57533c12f Mon Sep 17 00:00:00 2001 From: Peter Havekes Date: Thu, 23 Oct 2025 14:38:10 +0200 Subject: [PATCH 08/21] Add data to mongo --- .github/workflows/playwright.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 23b3af60..5a2088a2 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -17,8 +17,6 @@ jobs: uses: supercharge/mongodb-github-action@1.12.0 with: mongodb-version: 4.4 - - name: Install MongoDB Tools - run: sudo apt-get update && sudo apt-get install -y mongodb-org-shell mongodb-org-tools - name: Set up JDK 21 uses: actions/setup-java@v5 with: From ec6c591edc9a55b6f171c34ea6fc79723fb1ca63 Mon Sep 17 00:00:00 2001 From: Peter Havekes Date: Thu, 23 Oct 2025 14:56:55 +0200 Subject: [PATCH 09/21] Add users to mongodb --- .github/workflows/playwright.yml | 16 ++++++++-------- playwright/loadusers.js | 11 +++++++++++ 2 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 playwright/loadusers.js diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 5a2088a2..4cee51d1 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -23,15 +23,15 @@ jobs: java-version: 21 distribution: 'temurin' cache: 'maven' - - name: Load users.json to MongoDB + - name: Install mongosh and import start data in database run: | - mongoimport \ - --host localhost \ - --port 27017 \ - --db myconext \ - --collection users \ - --file myconext-server/src/test/resources/users.json \ - --jsonArray + sudo apt-get install gnupg + wget -qO- https://www.mongodb.org/static/pgp/server-7.0.asc | sudo tee /etc/apt/trusted.gpg.d/server-7.0.asc + echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list + sudo apt-get update + sudo apt-get install -y mongodb-mongosh + mongosh --version + mongosh localhost:27017/myconext playwright/loadusers.js - name: Set up cache uses: actions/cache@v4 with: diff --git a/playwright/loadusers.js b/playwright/loadusers.js new file mode 100644 index 00000000..8aac6e8e --- /dev/null +++ b/playwright/loadusers.js @@ -0,0 +1,11 @@ +const filePath = "../myconext-server/src/test/resources/users.json"; + +try { + const fileContent = fs.readFileSync(filePath, 'utf8'); + const users = JSON.parse(fileContent); + const result = db.users.insertMany(users); + + print(`Successfully inserted ${result.insertedCount} documents into the 'users' collection.`); +} catch (e) { + print(`Error loading or inserting data: ${e.message}`); +} \ No newline at end of file From b9f195c5e70336510d7c077c1e4f47fc92597535 Mon Sep 17 00:00:00 2001 From: Ines Date: Thu, 23 Oct 2025 15:00:33 +0200 Subject: [PATCH 10/21] Inlog test met de locale gebruiker Johnny --- playwright/tests/login.spec.ts | 11 +++++++++++ playwright/tests/login.ts | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 playwright/tests/login.spec.ts create mode 100644 playwright/tests/login.ts diff --git a/playwright/tests/login.spec.ts b/playwright/tests/login.spec.ts new file mode 100644 index 00000000..e773ec32 --- /dev/null +++ b/playwright/tests/login.spec.ts @@ -0,0 +1,11 @@ +import { test, expect } from '@playwright/test'; +import { loginNL } from './login'; + +test('Inloggen op test.eduid.nl in het Nederlands', async ({ page }) => { + await login(page); + await expect(page.getByText('Manage your personal info,')).toBeVisible(); + await expect(page.getByRole('heading', { name: 'Personal info' })).toBeVisible(); + await expect(page.getByRole('heading', { name: 'Data & activity' })).toBeVisible(); + await expect(page.getByRole('heading', { name: 'Security' })).toBeVisible(); + await expect(page.getByRole('heading', { name: 'Account' })).toBeVisible(); +}); \ No newline at end of file diff --git a/playwright/tests/login.ts b/playwright/tests/login.ts new file mode 100644 index 00000000..d35275d1 --- /dev/null +++ b/playwright/tests/login.ts @@ -0,0 +1,16 @@ +import { test, expect } from '@playwright/test'; + +export const login = async (page: Page) => { + await page.goto('http://localhost:3001/'); + await page.getByRole('link', { name: 'EN' }).click(); + await page.getByRole('button', { name: 'My eduID' }).click(); + await page.getByRole('link', { name: 'EN' }).click(); + await page.getByRole('textbox', { name: 'e.g. user@gmail.com' }).click(); + await page.getByRole('textbox', { name: 'e.g. user@gmail.com' }).fill('1234567890@surfguest.nl'); + await page.getByRole('link', { name: 'Next' }).click(); + await page.getByRole('textbox', { name: 'Password' }).click(); + await page.getByRole('textbox', { name: 'Password' }).fill('secret'); + await page.getByRole('link', { name: 'Login', exact: true }).click(); + await page.waitForURL('http://localhost:3001/'); + await expect(page.getByRole('heading', { name: 'Hi Johnny!' })).toBeVisible(); +} From b2fb38f1c7f0f9d2793c1a33bde0c69cc72fd97f Mon Sep 17 00:00:00 2001 From: Peter Havekes Date: Thu, 23 Oct 2025 15:04:30 +0200 Subject: [PATCH 11/21] fixes --- .github/workflows/playwright.yml | 6 +++--- playwright/loadusers.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 4cee51d1..2a2fbabf 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -52,11 +52,11 @@ jobs: - name: Run public-gui run: cd public-gui && nvm use && yarn install && yarn dev & - name: Install dependencies for plarwright - run: npm install -g yarn && yarn + run: cd playwright && npm install -g yarn && yarn - name: Install Playwright Browsers - run: yarn playwright install --with-deps + run: cd playwright && yarn playwright install --with-deps - name: Run Playwright tests - run: yarn playwright test + run: cd playwright && yarn playwright test - uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: diff --git a/playwright/loadusers.js b/playwright/loadusers.js index 8aac6e8e..c6bf4c6f 100644 --- a/playwright/loadusers.js +++ b/playwright/loadusers.js @@ -1,4 +1,4 @@ -const filePath = "../myconext-server/src/test/resources/users.json"; +const filePath = "./myconext-server/src/test/resources/users.json"; try { const fileContent = fs.readFileSync(filePath, 'utf8'); @@ -8,4 +8,4 @@ try { print(`Successfully inserted ${result.insertedCount} documents into the 'users' collection.`); } catch (e) { print(`Error loading or inserting data: ${e.message}`); -} \ No newline at end of file +} From 7b7af2212c980772a0e6811a7677d03b41de6c43 Mon Sep 17 00:00:00 2001 From: Ines Date: Thu, 23 Oct 2025 15:14:58 +0200 Subject: [PATCH 12/21] Update login.ts --- playwright/tests/login.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playwright/tests/login.ts b/playwright/tests/login.ts index d35275d1..769b24e5 100644 --- a/playwright/tests/login.ts +++ b/playwright/tests/login.ts @@ -6,7 +6,7 @@ export const login = async (page: Page) => { await page.getByRole('button', { name: 'My eduID' }).click(); await page.getByRole('link', { name: 'EN' }).click(); await page.getByRole('textbox', { name: 'e.g. user@gmail.com' }).click(); - await page.getByRole('textbox', { name: 'e.g. user@gmail.com' }).fill('1234567890@surfguest.nl'); + await page.getByRole('textbox', { name: 'e.g. user@gmail.com' }).fill('jdoe@example.com'); await page.getByRole('link', { name: 'Next' }).click(); await page.getByRole('textbox', { name: 'Password' }).click(); await page.getByRole('textbox', { name: 'Password' }).fill('secret'); From 10f654e1a39c5d797669305eede28e1ad38c3b5b Mon Sep 17 00:00:00 2001 From: Peter Havekes Date: Thu, 23 Oct 2025 15:15:47 +0200 Subject: [PATCH 13/21] No need for nvm --- .github/workflows/playwright.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 2a2fbabf..08d4585d 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -42,15 +42,15 @@ jobs: # - name: Build with Maven # run: mvn clean install --file pom.xml - name: Run myconext-server - run : cd myconext-server && mvn spring-boot:run -Dspring-boot.run.profiles=dev & + run : cd myconext-server && mvn spring-boot:run & - name: Run account-gui - run: cd account-gui && nvm use && yarn install && yarn dev & + run: cd account-gui && yarn install && yarn dev & - name: Run myconext--gui - run: cd myconext-gui && nvm use && yarn install && yarn dev & + run: cd myconext-gui && yarn install && yarn dev & - name: Run servicedesk-gui - run: cd servcedesk-gui && nvm use && yarn install && yarn dev & + run: cd servcedesk-gui && yarn install && yarn dev & - name: Run public-gui - run: cd public-gui && nvm use && yarn install && yarn dev & + run: cd public-gui && yarn install && yarn dev & - name: Install dependencies for plarwright run: cd playwright && npm install -g yarn && yarn - name: Install Playwright Browsers From 3ce235a5d8bf2d456816390fb16a04c48b445510 Mon Sep 17 00:00:00 2001 From: Ines Date: Thu, 23 Oct 2025 15:28:31 +0200 Subject: [PATCH 14/21] login test verbeteren --- playwright/tests/login.spec.ts | 14 ++++++++++++-- playwright/tests/login.ts | 16 ---------------- 2 files changed, 12 insertions(+), 18 deletions(-) delete mode 100644 playwright/tests/login.ts diff --git a/playwright/tests/login.spec.ts b/playwright/tests/login.spec.ts index e773ec32..52372a53 100644 --- a/playwright/tests/login.spec.ts +++ b/playwright/tests/login.spec.ts @@ -1,8 +1,18 @@ import { test, expect } from '@playwright/test'; -import { loginNL } from './login'; test('Inloggen op test.eduid.nl in het Nederlands', async ({ page }) => { - await login(page); + await page.goto('http://localhost:3002/'); + await page.getByRole('link', { name: 'EN' }).click(); + await page.getByRole('button', { name: 'My eduID' }).click(); + await page.getByRole('link', { name: 'EN' }).click(); + await page.getByRole('textbox', { name: 'e.g. user@gmail.com' }).click(); + await page.getByRole('textbox', { name: 'e.g. user@gmail.com' }).fill('jdoe@example.com'); + await page.getByRole('link', { name: 'Next' }).click(); + await page.getByRole('textbox', { name: 'Password' }).click(); + await page.getByRole('textbox', { name: 'Password' }).fill('secret'); + await page.getByRole('link', { name: 'Login', exact: true }).click(); + await page.waitForURL('http://localhost:3001/'); + await expect(page.getByRole('heading', { name: 'Hi Johnny!' })).toBeVisible(); await expect(page.getByText('Manage your personal info,')).toBeVisible(); await expect(page.getByRole('heading', { name: 'Personal info' })).toBeVisible(); await expect(page.getByRole('heading', { name: 'Data & activity' })).toBeVisible(); diff --git a/playwright/tests/login.ts b/playwright/tests/login.ts deleted file mode 100644 index 769b24e5..00000000 --- a/playwright/tests/login.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test, expect } from '@playwright/test'; - -export const login = async (page: Page) => { - await page.goto('http://localhost:3001/'); - await page.getByRole('link', { name: 'EN' }).click(); - await page.getByRole('button', { name: 'My eduID' }).click(); - await page.getByRole('link', { name: 'EN' }).click(); - await page.getByRole('textbox', { name: 'e.g. user@gmail.com' }).click(); - await page.getByRole('textbox', { name: 'e.g. user@gmail.com' }).fill('jdoe@example.com'); - await page.getByRole('link', { name: 'Next' }).click(); - await page.getByRole('textbox', { name: 'Password' }).click(); - await page.getByRole('textbox', { name: 'Password' }).fill('secret'); - await page.getByRole('link', { name: 'Login', exact: true }).click(); - await page.waitForURL('http://localhost:3001/'); - await expect(page.getByRole('heading', { name: 'Hi Johnny!' })).toBeVisible(); -} From 0008a51ded3a969c0d34d98eb5f50024b8f0fed1 Mon Sep 17 00:00:00 2001 From: Ines Date: Thu, 23 Oct 2025 15:57:43 +0200 Subject: [PATCH 15/21] add main to playwright (#1021) * Run servicedesk locally on port 3003 * Update README.md add public-gui - and sync with PH commit to give servicedesk localhost 3003 and public-gui localhost 3002 (which was the same) * Update README.md typo fix --------- Co-authored-by: Peter Havekes --- README.md | 18 +++++++++++++++--- servicedesk-gui/vite.config.js | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 17c1c482..7cd2fbf4 100644 --- a/README.md +++ b/README.md @@ -74,12 +74,24 @@ yarn dev ``` There is no home page, you'll need to visit an SP and choose eduID to login. -### The servicdedesk-gui +### The servicedesk-gui -The myconext service desk is also build with Svelte and to get initially started: +The myconext servicedesk is also build with Svelte and to get initially started: ``` -cd servicdedesk-gui +cd servicedesk-gui +yarn install +yarn dev +``` + +Browse to the [application homepage](http://localhost:3003/). + +### The public-gui + +The myconext public gui can also be build with Svelte and to get initially started: + +``` +cd public-gui yarn install yarn dev ``` diff --git a/servicedesk-gui/vite.config.js b/servicedesk-gui/vite.config.js index 1c03f066..6b2f779e 100644 --- a/servicedesk-gui/vite.config.js +++ b/servicedesk-gui/vite.config.js @@ -12,7 +12,7 @@ export default defineConfig({ } )], server: { - port: 3002, + port: 3003, open: true, proxy: { '/myconext/api': { From bec0ebfb45d7125de68e837ee33d207e313fd5e1 Mon Sep 17 00:00:00 2001 From: Peter Havekes Date: Thu, 23 Oct 2025 16:17:52 +0200 Subject: [PATCH 16/21] Run myconext-server in dev mode --- .github/workflows/playwright.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 08d4585d..75d245fe 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -42,13 +42,13 @@ jobs: # - name: Build with Maven # run: mvn clean install --file pom.xml - name: Run myconext-server - run : cd myconext-server && mvn spring-boot:run & + run : cd myconext-server && mvn spring-boot:run -Dspring-boot.run.profiles=dev & - name: Run account-gui run: cd account-gui && yarn install && yarn dev & - name: Run myconext--gui run: cd myconext-gui && yarn install && yarn dev & - name: Run servicedesk-gui - run: cd servcedesk-gui && yarn install && yarn dev & + run: cd servicedesk-gui && yarn install && yarn dev & - name: Run public-gui run: cd public-gui && yarn install && yarn dev & - name: Install dependencies for plarwright From beabc7102efe7dff21857b6e606ba2ddef4f643a Mon Sep 17 00:00:00 2001 From: Ines Date: Thu, 23 Oct 2025 16:21:06 +0200 Subject: [PATCH 17/21] Update test-tests to localhost --- playwright/tests/login.spec.ts | 21 ------------------- .../tests/myconext-gui-check-for-404s.spec.ts | 2 +- .../myconext-gui-check-home-page.spec.ts | 2 +- 3 files changed, 2 insertions(+), 23 deletions(-) delete mode 100644 playwright/tests/login.spec.ts diff --git a/playwright/tests/login.spec.ts b/playwright/tests/login.spec.ts deleted file mode 100644 index 52372a53..00000000 --- a/playwright/tests/login.spec.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test('Inloggen op test.eduid.nl in het Nederlands', async ({ page }) => { - await page.goto('http://localhost:3002/'); - await page.getByRole('link', { name: 'EN' }).click(); - await page.getByRole('button', { name: 'My eduID' }).click(); - await page.getByRole('link', { name: 'EN' }).click(); - await page.getByRole('textbox', { name: 'e.g. user@gmail.com' }).click(); - await page.getByRole('textbox', { name: 'e.g. user@gmail.com' }).fill('jdoe@example.com'); - await page.getByRole('link', { name: 'Next' }).click(); - await page.getByRole('textbox', { name: 'Password' }).click(); - await page.getByRole('textbox', { name: 'Password' }).fill('secret'); - await page.getByRole('link', { name: 'Login', exact: true }).click(); - await page.waitForURL('http://localhost:3001/'); - await expect(page.getByRole('heading', { name: 'Hi Johnny!' })).toBeVisible(); - await expect(page.getByText('Manage your personal info,')).toBeVisible(); - await expect(page.getByRole('heading', { name: 'Personal info' })).toBeVisible(); - await expect(page.getByRole('heading', { name: 'Data & activity' })).toBeVisible(); - await expect(page.getByRole('heading', { name: 'Security' })).toBeVisible(); - await expect(page.getByRole('heading', { name: 'Account' })).toBeVisible(); -}); \ No newline at end of file diff --git a/playwright/tests/myconext-gui-check-for-404s.spec.ts b/playwright/tests/myconext-gui-check-for-404s.spec.ts index f6326c09..4427cc4f 100644 --- a/playwright/tests/myconext-gui-check-for-404s.spec.ts +++ b/playwright/tests/myconext-gui-check-for-404s.spec.ts @@ -24,7 +24,7 @@ async function getAllLinksFromPage(page: Page) { test.describe("No 404s on Checkly pages", () => { test(`The docs have no 404s`, async ({ page }, testInfo) => { - await page.goto("https://www.eduid.nl") + await page.goto("http://localhost:3002") const linkUrls = await getAllLinksFromPage(page) for (const url of linkUrls) { diff --git a/playwright/tests/myconext-gui-check-home-page.spec.ts b/playwright/tests/myconext-gui-check-home-page.spec.ts index 7a91a7d9..0fdf5b29 100644 --- a/playwright/tests/myconext-gui-check-home-page.spec.ts +++ b/playwright/tests/myconext-gui-check-home-page.spec.ts @@ -1,7 +1,7 @@ import { test, expect } from '@playwright/test'; test('check generale page', async ({ page }) => { - await page.goto('https://test.eduid.nl'); + await page.goto('http://localhost:3002'); await page.getByRole('link', {name: 'EN'}).click(); await expect(page.getByRole('heading', { name: 'eduID', exact: true })).toBeVisible(); await expect(page.getByRole('button', { name: 'My eduID' })).toBeVisible(); From 0e3047cb4ead596391b2d9085cb0b3c188836fb7 Mon Sep 17 00:00:00 2001 From: Peter Havekes Date: Thu, 23 Oct 2025 16:21:24 +0200 Subject: [PATCH 18/21] cleanup --- .github/workflows/playwright.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 75d245fe..ef20c448 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -42,15 +42,13 @@ jobs: # - name: Build with Maven # run: mvn clean install --file pom.xml - name: Run myconext-server - run : cd myconext-server && mvn spring-boot:run -Dspring-boot.run.profiles=dev & - - name: Run account-gui - run: cd account-gui && yarn install && yarn dev & - - name: Run myconext--gui - run: cd myconext-gui && yarn install && yarn dev & - - name: Run servicedesk-gui - run: cd servicedesk-gui && yarn install && yarn dev & - - name: Run public-gui - run: cd public-gui && yarn install && yarn dev & + run : cd myconext-server && mvn spring-boot:run -Dspring-boot.run.profiles=dev && sleep 20 & + - name: Run GUIs + run: | + cd account-gui && yarn install && yarn dev && sleep 10 & + cd myconext-gui && yarn install && yarn dev && sleep 10 & + cd servicedesk-gui && yarn install && yarn dev && sleep 10 & + cd public-gui && yarn install && yarn dev && sleep 10 & - name: Install dependencies for plarwright run: cd playwright && npm install -g yarn && yarn - name: Install Playwright Browsers From 8dd1079c619da8594cece1a70ad81c9687210db1 Mon Sep 17 00:00:00 2001 From: Peter Havekes Date: Thu, 23 Oct 2025 16:29:03 +0200 Subject: [PATCH 19/21] fix --- .github/workflows/playwright.yml | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index ef20c448..ccd370c5 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -23,15 +23,15 @@ jobs: java-version: 21 distribution: 'temurin' cache: 'maven' - - name: Install mongosh and import start data in database - run: | - sudo apt-get install gnupg - wget -qO- https://www.mongodb.org/static/pgp/server-7.0.asc | sudo tee /etc/apt/trusted.gpg.d/server-7.0.asc - echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list - sudo apt-get update - sudo apt-get install -y mongodb-mongosh - mongosh --version - mongosh localhost:27017/myconext playwright/loadusers.js + # - name: Install mongosh and import start data in database + # run: | + # sudo apt-get install gnupg + # wget -qO- https://www.mongodb.org/static/pgp/server-7.0.asc | sudo tee /etc/apt/trusted.gpg.d/server-7.0.asc + # echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list + # sudo apt-get update + # sudo apt-get install -y mongodb-mongosh + # mongosh --version + # mongosh localhost:27017/myconext playwright/loadusers.js - name: Set up cache uses: actions/cache@v4 with: @@ -43,12 +43,14 @@ jobs: # run: mvn clean install --file pom.xml - name: Run myconext-server run : cd myconext-server && mvn spring-boot:run -Dspring-boot.run.profiles=dev && sleep 20 & - - name: Run GUIs - run: | - cd account-gui && yarn install && yarn dev && sleep 10 & - cd myconext-gui && yarn install && yarn dev && sleep 10 & - cd servicedesk-gui && yarn install && yarn dev && sleep 10 & - cd public-gui && yarn install && yarn dev && sleep 10 & + - name: Run account-gui + run: cd account-gui && yarn install && yarn dev && sleep 10 & + - name: Run myconext-gui + run: cd myconext-gui && yarn install && yarn dev && sleep 10 & + - name: Run servicedesk-gui + run: cd servicedesk-gui && yarn install && yarn dev && sleep 10 & + - name: Run public-gui + run: cd public-gui && yarn install && yarn dev && sleep 10 & - name: Install dependencies for plarwright run: cd playwright && npm install -g yarn && yarn - name: Install Playwright Browsers From d1295007c64048e9c9320e469a668f57e262d23d Mon Sep 17 00:00:00 2001 From: Ines Date: Thu, 23 Oct 2025 16:55:24 +0200 Subject: [PATCH 20/21] fix? --- .github/workflows/playwright.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index ccd370c5..1bc3571e 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -42,15 +42,15 @@ jobs: # - name: Build with Maven # run: mvn clean install --file pom.xml - name: Run myconext-server - run : cd myconext-server && mvn spring-boot:run -Dspring-boot.run.profiles=dev && sleep 20 & + run : cd myconext-server && mvn spring-boot:run -Dspring-boot.run.profiles=dev && sleep 30 - name: Run account-gui - run: cd account-gui && yarn install && yarn dev && sleep 10 & + run: cd account-gui && yarn install && yarn dev && sleep 10 - name: Run myconext-gui - run: cd myconext-gui && yarn install && yarn dev && sleep 10 & + run: cd myconext-gui && yarn install && yarn dev && sleep 10 - name: Run servicedesk-gui - run: cd servicedesk-gui && yarn install && yarn dev && sleep 10 & + run: cd servicedesk-gui && yarn install && yarn dev && sleep 10 - name: Run public-gui - run: cd public-gui && yarn install && yarn dev && sleep 10 & + run: cd public-gui && yarn install && yarn dev && sleep 10 - name: Install dependencies for plarwright run: cd playwright && npm install -g yarn && yarn - name: Install Playwright Browsers From 724c627bebbe2742f1ec7477f05f4c1c95e0255f Mon Sep 17 00:00:00 2001 From: Ines Date: Thu, 23 Oct 2025 17:31:00 +0200 Subject: [PATCH 21/21] unfix --- .github/workflows/playwright.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 1bc3571e..2d79f46b 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -42,15 +42,15 @@ jobs: # - name: Build with Maven # run: mvn clean install --file pom.xml - name: Run myconext-server - run : cd myconext-server && mvn spring-boot:run -Dspring-boot.run.profiles=dev && sleep 30 + run : cd myconext-server && mvn spring-boot:run -Dspring-boot.run.profiles=dev && sleep 30 & - name: Run account-gui - run: cd account-gui && yarn install && yarn dev && sleep 10 + run: cd account-gui && yarn install && yarn dev && sleep 10 & - name: Run myconext-gui - run: cd myconext-gui && yarn install && yarn dev && sleep 10 + run: cd myconext-gui && yarn install && yarn dev && sleep 10 & - name: Run servicedesk-gui - run: cd servicedesk-gui && yarn install && yarn dev && sleep 10 + run: cd servicedesk-gui && yarn install && yarn dev && sleep 10 & - name: Run public-gui - run: cd public-gui && yarn install && yarn dev && sleep 10 + run: cd public-gui && yarn install && yarn dev && sleep 10 & - name: Install dependencies for plarwright run: cd playwright && npm install -g yarn && yarn - name: Install Playwright Browsers