Skip to content

Commit 31bfeb3

Browse files
Merge branch 'main' into fix/touch-spuntik-windows
2 parents dd298be + 9de3e55 commit 31bfeb3

File tree

5 files changed

+52
-22
lines changed

5 files changed

+52
-22
lines changed

e2e/constants/e2e.constants.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const TIMEOUT_BASE = 15000;
2+
3+
export const TIMEOUT_SHORT = {timeout: TIMEOUT_BASE};
4+
export const TIMEOUT_AVERAGE = {timeout: 2 * TIMEOUT_BASE};
5+
export const TIMEOUT_LONG = {timeout: 4 * TIMEOUT_BASE};

e2e/constants/test-ids.constants.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ export const testIds = {
44
auth: {
55
signInII: 'btn-sign-in-ii'
66
},
7+
launchpad: {
8+
launch: 'btn-launch-first-satellite',
9+
launchExtraSatellite: 'btn-launch-extra-satellite',
10+
actions: 'btn-open-actions'
11+
},
712
createSatellite: {
8-
launch: 'btn-launch-satellite',
913
create: 'btn-create-satellite',
1014
input: 'input-satellite-name',
1115
website: 'input-radio-satellite-website',
@@ -18,7 +22,8 @@ export const testIds = {
1822
},
1923
navbar: {
2024
openWallet: 'btn-open-wallet',
21-
getIcp: 'btn-get-icp'
25+
getIcp: 'btn-get-icp',
26+
getCycles: 'btn-get-cycles'
2227
},
2328
createAnalytics: {
2429
navLink: 'link-analytics-dashboard',

e2e/page-objects/console.page.ts

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {InternetIdentityPage} from '@dfinity/internet-identity-playwright';
22
import {notEmptyString} from '@dfinity/utils';
33
import {PrincipalText, PrincipalTextSchema} from '@dfinity/zod-schemas';
44
import {expect} from '@playwright/test';
5+
import {TIMEOUT_AVERAGE, TIMEOUT_SHORT} from '../constants/e2e.constants';
56
import {testIds} from '../constants/test-ids.constants';
67
import {IdentityPage, type IdentityPageParams} from './identity.page';
78
import {SatellitePage} from './satellite.page';
@@ -48,13 +49,31 @@ export class ConsolePage extends IdentityPage {
4849
await this.#consoleIIPage.waitReady({url: CONTAINER_URL, canisterId: INTERNET_IDENTITY_ID});
4950
}
5051

51-
async createSatellite({kind}: {kind: 'website' | 'application'}): Promise<void> {
52-
await expect(this.page.getByTestId(testIds.createSatellite.launch)).toBeVisible({
53-
timeout: 20000
54-
});
52+
async createSatellite(params: {kind: 'website' | 'application'}): Promise<void> {
53+
await expect(this.page.getByTestId(testIds.launchpad.launch)).toBeVisible(TIMEOUT_AVERAGE);
54+
55+
await this.page.getByTestId(testIds.launchpad.launch).click();
56+
57+
await this.createSatelliteWizard(params);
58+
}
59+
60+
async openCreateAdditionalSatelliteWizard(params: {
61+
kind: 'website' | 'application';
62+
}): Promise<void> {
63+
await expect(this.page.getByTestId(testIds.launchpad.actions)).toBeVisible(TIMEOUT_AVERAGE);
5564

56-
await this.page.getByTestId(testIds.createSatellite.launch).click();
65+
await this.page.getByTestId(testIds.launchpad.actions).click();
5766

67+
await expect(this.page.getByTestId(testIds.launchpad.launchExtraSatellite)).toBeVisible(
68+
TIMEOUT_AVERAGE
69+
);
70+
71+
await this.page.getByTestId(testIds.launchpad.launchExtraSatellite).click();
72+
73+
await this.createSatelliteWizard(params);
74+
}
75+
76+
private async createSatelliteWizard({kind}: {kind: 'website' | 'application'}): Promise<void> {
5877
await expect(this.page.getByTestId(testIds.createSatellite.create)).toBeVisible({
5978
timeout: 15000
6079
});
@@ -64,19 +83,19 @@ export class ConsolePage extends IdentityPage {
6483

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

67-
await expect(this.page.getByTestId(testIds.createSatellite.continue)).toBeVisible({
68-
timeout: 20000
69-
});
86+
await expect(this.page.getByTestId(testIds.createSatellite.continue)).toBeVisible(
87+
TIMEOUT_AVERAGE
88+
);
7089

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

7493
async visitSatelliteSite(
7594
{title}: {title: string} = {title: 'Juno / Satellite'}
7695
): Promise<SatellitePage> {
77-
await expect(this.page.getByTestId(testIds.satelliteOverview.visit)).toBeVisible({
78-
timeout: 20000
79-
});
96+
await expect(this.page.getByTestId(testIds.satelliteOverview.visit)).toBeVisible(
97+
TIMEOUT_AVERAGE
98+
);
8099

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

@@ -93,16 +112,16 @@ export class ConsolePage extends IdentityPage {
93112
});
94113
}
95114

96-
async getICP(): Promise<void> {
115+
async getCycles(): Promise<void> {
97116
await expect(this.page.getByTestId(testIds.navbar.openWallet)).toBeVisible();
98117

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

101-
await expect(this.page.getByTestId(testIds.navbar.getIcp)).toBeVisible();
120+
await expect(this.page.getByTestId(testIds.navbar.getCycles)).toBeVisible();
102121

103-
await this.page.getByTestId(testIds.navbar.getIcp).click();
122+
await this.page.getByTestId(testIds.navbar.getCycles).click();
104123

105-
await expect(this.page.getByText('55.0001')).toBeVisible({timeout: 65000});
124+
await expect(this.page.getByText('330.010 T Cycles')).toBeVisible({timeout: 65000});
106125
}
107126

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

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

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

148-
await expect(this.page.getByText('Access Key Added')).toBeVisible({timeout: 10000});
167+
await expect(this.page.getByText('Access Key Added')).toBeVisible(TIMEOUT_SHORT);
149168
}
150169
}

e2e/page-objects/satellite.page.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {expect} from '@playwright/test';
2+
import {TIMEOUT_AVERAGE} from '../constants/e2e.constants';
23
import {IdentityPage} from './identity.page';
34

45
export class SatellitePage extends IdentityPage {
@@ -10,7 +11,7 @@ export class SatellitePage extends IdentityPage {
1011
return await this.page.title();
1112
},
1213
{
13-
timeout: 30000,
14+
...TIMEOUT_AVERAGE,
1415
intervals: [1_000, 2_000, 10_000]
1516
}
1617
)

e2e/snapshots.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ const snapshotTests = ({satelliteKind}: {satelliteKind: 'website' | 'application
6464

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

67-
await consolePage.getICP();
67+
await consolePage.getCycles();
6868

6969
await consolePage.goto();
7070

71-
await consolePage.createSatellite({kind: 'application'});
71+
await consolePage.openCreateAdditionalSatelliteWizard({kind: 'application'});
7272

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

0 commit comments

Comments
 (0)