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: 5 additions & 0 deletions e2e/constants/e2e.constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const TIMEOUT_BASE = 15000;

export const TIMEOUT_SHORT = {timeout: TIMEOUT_BASE};
export const TIMEOUT_AVERAGE = {timeout: 2 * TIMEOUT_BASE};
export const TIMEOUT_LONG = {timeout: 4 * TIMEOUT_BASE};
9 changes: 7 additions & 2 deletions e2e/constants/test-ids.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ export const testIds = {
auth: {
signInII: 'btn-sign-in-ii'
},
launchpad: {
launch: 'btn-launch-first-satellite',
launchExtraSatellite: 'btn-launch-extra-satellite',
actions: 'btn-open-actions'
},
createSatellite: {
launch: 'btn-launch-satellite',
create: 'btn-create-satellite',
input: 'input-satellite-name',
website: 'input-radio-satellite-website',
Expand All @@ -18,7 +22,8 @@ export const testIds = {
},
navbar: {
openWallet: 'btn-open-wallet',
getIcp: 'btn-get-icp'
getIcp: 'btn-get-icp',
getCycles: 'btn-get-cycles'
},
createAnalytics: {
navLink: 'link-analytics-dashboard',
Expand Down
53 changes: 36 additions & 17 deletions e2e/page-objects/console.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {InternetIdentityPage} from '@dfinity/internet-identity-playwright';
import {notEmptyString} from '@dfinity/utils';
import {PrincipalText, PrincipalTextSchema} from '@dfinity/zod-schemas';
import {expect} from '@playwright/test';
import {TIMEOUT_AVERAGE, TIMEOUT_SHORT} from '../constants/e2e.constants';
import {testIds} from '../constants/test-ids.constants';
import {IdentityPage, type IdentityPageParams} from './identity.page';
import {SatellitePage} from './satellite.page';
Expand Down Expand Up @@ -48,13 +49,31 @@ export class ConsolePage extends IdentityPage {
await this.#consoleIIPage.waitReady({url: CONTAINER_URL, canisterId: INTERNET_IDENTITY_ID});
}

async createSatellite({kind}: {kind: 'website' | 'application'}): Promise<void> {
await expect(this.page.getByTestId(testIds.createSatellite.launch)).toBeVisible({
timeout: 20000
});
async createSatellite(params: {kind: 'website' | 'application'}): Promise<void> {
await expect(this.page.getByTestId(testIds.launchpad.launch)).toBeVisible(TIMEOUT_AVERAGE);

await this.page.getByTestId(testIds.launchpad.launch).click();

await this.createSatelliteWizard(params);
}

async openCreateAdditionalSatelliteWizard(params: {
kind: 'website' | 'application';
}): Promise<void> {
await expect(this.page.getByTestId(testIds.launchpad.actions)).toBeVisible(TIMEOUT_AVERAGE);

await this.page.getByTestId(testIds.createSatellite.launch).click();
await this.page.getByTestId(testIds.launchpad.actions).click();

await expect(this.page.getByTestId(testIds.launchpad.launchExtraSatellite)).toBeVisible(
TIMEOUT_AVERAGE
);

await this.page.getByTestId(testIds.launchpad.launchExtraSatellite).click();

await this.createSatelliteWizard(params);
}

private async createSatelliteWizard({kind}: {kind: 'website' | 'application'}): Promise<void> {
await expect(this.page.getByTestId(testIds.createSatellite.create)).toBeVisible({
timeout: 15000
});
Expand All @@ -64,19 +83,19 @@ export class ConsolePage extends IdentityPage {

await this.page.getByTestId(testIds.createSatellite.create).click();

await expect(this.page.getByTestId(testIds.createSatellite.continue)).toBeVisible({
timeout: 20000
});
await expect(this.page.getByTestId(testIds.createSatellite.continue)).toBeVisible(
TIMEOUT_AVERAGE
);

await this.page.getByTestId(testIds.createSatellite.continue).click();
}

async visitSatelliteSite(
{title}: {title: string} = {title: 'Juno / Satellite'}
): Promise<SatellitePage> {
await expect(this.page.getByTestId(testIds.satelliteOverview.visit)).toBeVisible({
timeout: 20000
});
await expect(this.page.getByTestId(testIds.satelliteOverview.visit)).toBeVisible(
TIMEOUT_AVERAGE
);

const satellitePagePromise = this.context.waitForEvent('page');

Expand All @@ -93,16 +112,16 @@ export class ConsolePage extends IdentityPage {
});
}

async getICP(): Promise<void> {
async getCycles(): Promise<void> {
await expect(this.page.getByTestId(testIds.navbar.openWallet)).toBeVisible();

await this.page.getByTestId(testIds.navbar.openWallet).click();

await expect(this.page.getByTestId(testIds.navbar.getIcp)).toBeVisible();
await expect(this.page.getByTestId(testIds.navbar.getCycles)).toBeVisible();

await this.page.getByTestId(testIds.navbar.getIcp).click();
await this.page.getByTestId(testIds.navbar.getCycles).click();

await expect(this.page.getByText('55.0001')).toBeVisible({timeout: 65000});
await expect(this.page.getByText('330.010 T Cycles')).toBeVisible({timeout: 65000});
}

async copySatelliteID(): Promise<string> {
Expand All @@ -128,7 +147,7 @@ export class ConsolePage extends IdentityPage {
await this.goto({path: `/satellite/?s=${satelliteId}&tab=setup`});

const btnLocator = this.page.locator('button', {hasText: 'Add an access key'});
await expect(btnLocator).toBeVisible({timeout: 10000});
await expect(btnLocator).toBeVisible(TIMEOUT_SHORT);
await btnLocator.click();

const form = this.page.locator('form');
Expand All @@ -145,6 +164,6 @@ export class ConsolePage extends IdentityPage {
await expect(submitLocator).toBeEnabled();
await submitLocator.click();

await expect(this.page.getByText('Access Key Added')).toBeVisible({timeout: 10000});
await expect(this.page.getByText('Access Key Added')).toBeVisible(TIMEOUT_SHORT);
}
}
3 changes: 2 additions & 1 deletion e2e/page-objects/satellite.page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {expect} from '@playwright/test';
import {TIMEOUT_AVERAGE} from '../constants/e2e.constants';
import {IdentityPage} from './identity.page';

export class SatellitePage extends IdentityPage {
Expand All @@ -10,7 +11,7 @@ export class SatellitePage extends IdentityPage {
return await this.page.title();
},
{
timeout: 30000,
...TIMEOUT_AVERAGE,
intervals: [1_000, 2_000, 10_000]
}
)
Expand Down
4 changes: 2 additions & 2 deletions e2e/snapshots.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ const snapshotTests = ({satelliteKind}: {satelliteKind: 'website' | 'application

const {consolePage, cliPage} = getTestPages();

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

await consolePage.goto();

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

const satelliteId = await consolePage.copySatelliteID();

Expand Down