Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion e2e/constants/test-ids.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import type {TestIds} from '../types/test-id';

export const testIds = {
auth: {
signInII: 'btn-sign-in-ii'
signInDev: 'btn-sign-in-dev',
switchDevAccount: 'btn-switch-account-dev',
inputDevIdentifier: 'input-dev-identifier',
continueDevAccount: 'btn-continue-dev'
},
launchpad: {
launch: 'btn-launch-first-satellite',
Expand Down
34 changes: 12 additions & 22 deletions e2e/page-objects/console.page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {InternetIdentityPage} from '@dfinity/internet-identity-playwright';
import {notEmptyString} from '@dfinity/utils';
import {PrincipalText, PrincipalTextSchema} from '@dfinity/zod-schemas';
import {expect} from '@playwright/test';
Expand All @@ -8,23 +7,13 @@ import {IdentityPage, type IdentityPageParams} from './identity.page';
import {SatellitePage} from './satellite.page';

export class ConsolePage extends IdentityPage {
readonly #consoleIIPage: InternetIdentityPage;

private constructor(params: IdentityPageParams) {
super(params);

this.#consoleIIPage = new InternetIdentityPage({
page: this.page,
context: this.context,
browser: this.browser
});
}

static async initWithSignIn(params: IdentityPageParams): Promise<ConsolePage> {
const consolePage = new ConsolePage(params);

await consolePage.waitReady();

await consolePage.goto();

await consolePage.signIn();
Expand All @@ -36,19 +25,20 @@ export class ConsolePage extends IdentityPage {
await this.page.goto(path);
}

async signIn(): Promise<void> {
await this.#consoleIIPage.signIn({
passkey: {
selector: `[data-tid=${testIds.auth.signInII}]`
}
});
}
private async signIn(): Promise<void> {
await expect(this.page.getByTestId(testIds.auth.switchDevAccount)).toBeVisible(TIMEOUT_AVERAGE);

await this.page.getByTestId(testIds.auth.switchDevAccount).click();

await expect(this.page.getByTestId(testIds.auth.inputDevIdentifier)).toBeVisible();

await this.page
.getByTestId(testIds.auth.inputDevIdentifier)
.fill(crypto.randomUUID().replaceAll('-', ''));

async waitReady(): Promise<void> {
const CONTAINER_URL = 'http://127.0.0.1:5987';
const INTERNET_IDENTITY_ID = 'rdmx6-jaaaa-aaaaa-aaadq-cai';
await expect(this.page.getByTestId(testIds.auth.continueDevAccount)).toBeVisible();

await this.#consoleIIPage.waitReady({url: CONTAINER_URL, canisterId: INTERNET_IDENTITY_ID});
await this.page.getByTestId(testIds.auth.continueDevAccount).click();
}

async createSatellite(params: {kind: 'website' | 'application'}): Promise<void> {
Expand Down
60 changes: 28 additions & 32 deletions e2e/snapshots.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import {testWithII} from '@dfinity/internet-identity-playwright';
import {expect} from '@playwright/test';
import {expect, test} from '@playwright/test';
import {initTestSuite} from './utils/init.utils';

testWithII.describe.configure({mode: 'serial'});
test.describe.configure({mode: 'serial'});

const snapshotTests = ({satelliteKind}: {satelliteKind: 'website' | 'application'}) => {
testWithII.describe(`satellite ${satelliteKind}`, () => {
test.describe(`satellite ${satelliteKind}`, () => {
const getTestPages = initTestSuite({satelliteKind});

const SNAPSHOT_TARGET = {target: 'satellite' as const};

testWithII('should create and restore a snapshot', async () => {
test('should create and restore a snapshot', async () => {
const {consolePage, cliPage} = getTestPages();

await cliPage.createSnapshot(SNAPSHOT_TARGET);
Expand All @@ -28,8 +27,8 @@ const snapshotTests = ({satelliteKind}: {satelliteKind: 'website' | 'application
await satellitePage.assertScreenshot();
});

testWithII('should create, download, delete, upload and restore a snapshot', async () => {
testWithII.setTimeout(120_000);
test('should create, download, delete, upload and restore a snapshot', async () => {
test.setTimeout(120_000);

const {consolePage, cliPage} = getTestPages();

Expand Down Expand Up @@ -57,46 +56,43 @@ const snapshotTests = ({satelliteKind}: {satelliteKind: 'website' | 'application
await satellitePage.assertScreenshot();
});

testWithII(
'should create, download, delete, upload and restore a snapshot to another satellite',
async () => {
testWithII.setTimeout(120_000);
test('should create, download, delete, upload and restore a snapshot to another satellite', async () => {
test.setTimeout(120_000);

const {consolePage, cliPage} = getTestPages();
const {consolePage, cliPage} = getTestPages();

await consolePage.getCycles();
await consolePage.getCycles();

await consolePage.goto();
await consolePage.goto();

await consolePage.openCreateAdditionalSatelliteWizard({kind: 'application'});
await consolePage.openCreateAdditionalSatelliteWizard({kind: 'application'});

const satelliteId = await consolePage.copySatelliteID();
const satelliteId = await consolePage.copySatelliteID();

await cliPage.toggleSatelliteId({satelliteId});
await cliPage.toggleSatelliteId({satelliteId});

const {accessKey} = await cliPage.whoami();
const {accessKey} = await cliPage.whoami();

await consolePage.addSatelliteAdminAccessKey({accessKey, satelliteId});
await consolePage.addSatelliteAdminAccessKey({accessKey, satelliteId});

await cliPage.deployHosting({clear: true});
await cliPage.deployHosting({clear: true});

await consolePage.goto({path: `/satellite/?s=${satelliteId}`});
await consolePage.goto({path: `/satellite/?s=${satelliteId}`});

const satellitePage = await consolePage.visitSatelliteSite({
title: 'Hello World'
});
await satellitePage.assertScreenshot();
const satellitePage = await consolePage.visitSatelliteSite({
title: 'Hello World'
});
await satellitePage.assertScreenshot();

const {snapshotFolder} = await cliPage.getSnapshotFsFolder();
const {snapshotFolder} = await cliPage.getSnapshotFsFolder();

await cliPage.uploadSnapshot({...SNAPSHOT_TARGET, folder: snapshotFolder});
await cliPage.uploadSnapshot({...SNAPSHOT_TARGET, folder: snapshotFolder});

await cliPage.restoreSnapshot(SNAPSHOT_TARGET);
await cliPage.restoreSnapshot(SNAPSHOT_TARGET);

await satellitePage.reload();
await satellitePage.assertScreenshot();
}
);
await satellitePage.reload();
await satellitePage.assertScreenshot();
});
});
};

Expand Down
8 changes: 4 additions & 4 deletions e2e/utils/init.utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {testWithII} from '@dfinity/internet-identity-playwright';
import {test} from '@playwright/test';
import {CliPage} from '../page-objects/cli.page';
import {ConsolePage} from '../page-objects/console.page';

Expand All @@ -15,8 +15,8 @@ export const initTestSuite = ({
let consolePage: ConsolePage;
let cliPage: CliPage;

testWithII.beforeAll(async ({playwright}) => {
testWithII.setTimeout(120000);
test.beforeAll(async ({playwright}) => {
test.setTimeout(120000);

const browser = await playwright.chromium.launch();

Expand All @@ -36,7 +36,7 @@ export const initTestSuite = ({
cliPage = await CliPage.initWithEmulatorLogin({satelliteId});
});

testWithII.afterAll(async () => {
test.afterAll(async () => {
const results = await Promise.allSettled([consolePage.close(), cliPage.close()]);

if (results.find(({status}) => status === 'rejected')) {
Expand Down
22 changes: 0 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"zod": "^4.3.5"
},
"devDependencies": {
"@dfinity/internet-identity-playwright": "^3.0.0-next-2026-01-31",
"@eslint/eslintrc": "^3.3.3",
"@eslint/js": "^9.39.2",
"@junobuild/functions": "^0.5.5",
Expand Down