Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2ee3b75
Add email activation function for user registration in Keycloak
akafazov Oct 8, 2025
bb59cf2
Update local-setup/e2e/test-register-and-navigate.test.ts
akafazov Oct 8, 2025
a1133a1
add requested changes by copilot
akafazov Oct 8, 2025
3f7bfc8
Merge branch 'main' into fix/e2e-tests
akafazov Oct 9, 2025
b6e7235
Merge branch 'main' into fix/e2e-tests
akafazov Oct 9, 2025
bf9fb2f
Merge branch 'main' into fix/e2e-tests
akafazov Oct 9, 2025
d69b5b3
use mailpit for email verification
akafazov Oct 9, 2025
93c9bee
Merge remote-tracking branch 'origin/main' into fix/e2e-tests
akafazov Oct 9, 2025
edbe3f2
Merge remote-tracking branch 'origin/main' into fix/e2e-tests
nexus49 Oct 9, 2025
68fb100
fix: update welcome message selector in registration test
akafazov Oct 9, 2025
57b4c01
fix: replace waitForSelector with textContent for welcome message ver…
akafazov Oct 9, 2025
e607505
fix: add sleep before Playwright installation to ensure stability
akafazov Oct 9, 2025
bb0da05
refactor: clean up test code and improve readability
akafazov Oct 10, 2025
b1d1805
refactor: clean up navigation and login code in registration test
akafazov Oct 10, 2025
1c34d2f
Merge branch 'main' into fix/e2e-tests
akafazov Oct 10, 2025
5d3420c
chore: upload test artefacts
akafazov Oct 10, 2025
6900018
fix: enable conditional execution for uploading Playwright artefacts
akafazov Oct 10, 2025
bd8397c
refactor: reorganize screenshot capture in registration test
akafazov Oct 10, 2025
c7aee57
refactor: enhance email activation flow in registration test
akafazov Oct 10, 2025
340cfd8
refactor test
akafazov Oct 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/kind-localsetup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ jobs:
cd local-setup/e2e
npm install
npm ci
npx playwright install
npx playwright install
sleep 20

# Step 10: Run the end-to-end tests
- name: End2End tests
Expand All @@ -112,3 +113,12 @@ jobs:
curl -ki https://portal.dev.local:8443
cd local-setup/e2e/
npx playwright test

- name: Upload Playwright artefacts
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-artifacts
path: |
local-setup/e2e/test-results/
local-setup/e2e/*.png
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ ocm/.ocm/transport.ctf/
registry-ca.pem
.ocm/.ocmconfig
local-setup/rootCA.pem
local-setup/e2e/node_modules/
11 changes: 10 additions & 1 deletion Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -459,4 +459,13 @@ tasks:
ocm:build-apply:iterate:
cmds:
- task: ocm:build:component
- task: ocm:kustomize:apply
- task: ocm:kustomize:apply

test:portal-e2e:
cmds:
- |
pushd local-setup/e2e
npm ci
npx playwright install
npx playwright test
popd
54 changes: 39 additions & 15 deletions local-setup/e2e/test-register-and-navigate.test.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,50 @@
import test, { expect } from '@playwright/test';
import test, { expect, Page } from '@playwright/test';

test.describe('Home Page', () => {
test('Register and navigate to portal', async ({ page }) => {
await page.goto('https://portal.dev.local:8443/');
const portalBaseUrl = 'https://portal.dev.local:8443/';

// Interact with the page
await page.click('text=Register');
async function activateUserEmailViaMailpit(
page: Page,
userEmail: string
): Promise<Page> {
await page.goto(`${portalBaseUrl}mailpit/`);
await page.click(`text=To: ${userEmail}`);
const emailFrame = page.frameLocator('#preview-html');

// Wait for the new page to open when clicking the verification link
const [newPage] = await Promise.all([
page.context().waitForEvent('page'),
emailFrame.locator('text=Link to e-mail address verification').click(),
]);

return newPage;
}

// Fill in registration form
await page.fill('input[name="email"]', '[email protected]');
await page.fill('input[id="password"]', 'MyPass1234');
await page.fill('input[id="password-confirm"]', 'MyPass1234');
await page.fill('input[id="firstName"]', 'Firstname');
await page.fill('input[id="lastName"]', 'Lastname');
test.describe('Home Page', () => {
const userEmail = '[email protected]';
const userPassword = 'MyPass1234';
const firstName = 'Firstname';
const lastName = 'Lastname';

// Wait for navigation after clicking register
test('Register and navigate to portal', async ({ page }) => {
await page.goto(portalBaseUrl);
await page.click('text=Register');
await page.fill('input[name="email"]', userEmail);
await page.fill('input[id="password"]', userPassword);
await page.fill('input[id="password-confirm"]', userPassword);
await page.fill('input[id="firstName"]', firstName);
await page.fill('input[id="lastName"]', lastName);

await Promise.all([
page.waitForNavigation({ waitUntil: 'networkidle' }),
page.click('input[value="Register"]')
]);

const title = await page.title();
expect(title).toBe('Platform Mesh Portal');
const newPage = await activateUserEmailViaMailpit(page, userEmail);

// Wait for the new page to load and check for the existence of specific text
await newPage.waitForLoadState('domcontentloaded');
const verificationText = await newPage.getByText("Welcome to the Platform Mesh Portal!");
await expect(verificationText).toBeVisible();

});
});
Loading