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
15 changes: 15 additions & 0 deletions e2e/page-objects/console.page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {InternetIdentityPage} from '@dfinity/internet-identity-playwright';
import {notEmptyString} from '@dfinity/utils';
import {PrincipalTextSchema} from '@dfinity/zod-schemas';
import {expect} from '@playwright/test';
import {testIds} from '../constants/test-ids.constants';
import {IdentityPage, type IdentityPageParams} from './identity.page';
Expand Down Expand Up @@ -84,4 +86,17 @@ export class ConsolePage extends IdentityPage {
context: this.context
});
}

async copySatelliteID(): Promise<string> {
await expect(this.page.getByTestId(testIds.satelliteOverview.copySatelliteId)).toBeVisible();

await this.page.getByTestId(testIds.satelliteOverview.copySatelliteId).click();

const satelliteId = await this.page.evaluate(() => navigator.clipboard.readText());

expect(notEmptyString(satelliteId)).toBeTruthy();
expect(PrincipalTextSchema.safeParse(satelliteId).success).toBeTruthy();

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

Expand Down Expand Up @@ -30,13 +29,7 @@ export const initTestSuite = (): (() => TestSuitePages) => {

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

// TODO: replace with a testId that copies to Satellite ID from the Overview
const currentUrl = await page.evaluate(() => document.location.href);
const url = URL.parse(currentUrl);
assertNonNullish(url);
const urlParams = new URLSearchParams(url.searchParams);
const satelliteId = urlParams.get('s');
assertNonNullish(satelliteId);
const satelliteId = await consolePage.copySatelliteID();

cliPage = await CliPage.initWithEmulatorLogin({satelliteId});
});
Expand Down
3 changes: 2 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export default defineConfig({
testIdAttribute: 'data-tid',
baseURL: 'http://localhost:5866',
trace: 'on',
...(DEV && {headless: false})
...(DEV && {headless: false}),
permissions: ['clipboard-read', 'clipboard-write']
},
projects: [
{
Expand Down