diff --git a/e2e/snapshots.spec.ts b/e2e/snapshots.spec.ts index 84126a70..670f85a6 100644 --- a/e2e/snapshots.spec.ts +++ b/e2e/snapshots.spec.ts @@ -2,94 +2,103 @@ import {testWithII} from '@dfinity/internet-identity-playwright'; import {expect} from '@playwright/test'; import {initTestSuite} from './utils/init.utils'; -const getTestPages = initTestSuite(); +testWithII.describe.configure({mode: 'serial'}); -const SNAPSHOT_TARGET = {target: 'satellite' as const}; +const snapshotTests = ({satelliteKind}: {satelliteKind: 'website' | 'application'}) => { + testWithII.describe(`satellite ${satelliteKind}`, () => { + const getTestPages = initTestSuite({satelliteKind}); -testWithII('should create and restore a snapshot', async () => { - const {consolePage, cliPage} = getTestPages(); + const SNAPSHOT_TARGET = {target: 'satellite' as const}; - await cliPage.createSnapshot(SNAPSHOT_TARGET); + testWithII('should create and restore a snapshot', async () => { + const {consolePage, cliPage} = getTestPages(); - await cliPage.clearHosting(); + await cliPage.createSnapshot(SNAPSHOT_TARGET); - const satellitePage = await consolePage.visitSatelliteSite({ - title: 'Internet Computer - Error: response verification error' - }); - await satellitePage.assertScreenshot(); + await cliPage.clearHosting(); + + const satellitePage = await consolePage.visitSatelliteSite({ + title: 'Internet Computer - Error: response verification error' + }); + await satellitePage.assertScreenshot(); - await cliPage.restoreSnapshot(SNAPSHOT_TARGET); + await cliPage.restoreSnapshot(SNAPSHOT_TARGET); - await satellitePage.reload(); - await satellitePage.assertScreenshot(); -}); + await satellitePage.reload(); + await satellitePage.assertScreenshot(); + }); -testWithII('should create, download, delete, upload and restore a snapshot', async () => { - testWithII.setTimeout(120_000); + testWithII('should create, download, delete, upload and restore a snapshot', async () => { + testWithII.setTimeout(120_000); - const {consolePage, cliPage} = getTestPages(); + const {consolePage, cliPage} = getTestPages(); - await cliPage.createSnapshot(SNAPSHOT_TARGET); + await cliPage.createSnapshot(SNAPSHOT_TARGET); - const {snapshotFolder} = await cliPage.downloadSnapshot(SNAPSHOT_TARGET); + const {snapshotFolder} = await cliPage.downloadSnapshot(SNAPSHOT_TARGET); - await cliPage.deleteSnapshot(SNAPSHOT_TARGET); + await cliPage.deleteSnapshot(SNAPSHOT_TARGET); - const {snapshotId} = await cliPage.listSnapshot(SNAPSHOT_TARGET); - expect(snapshotId).toBeUndefined(); + const {snapshotId} = await cliPage.listSnapshot(SNAPSHOT_TARGET); + expect(snapshotId).toBeUndefined(); - await cliPage.clearHosting(); + await cliPage.clearHosting(); - const satellitePage = await consolePage.visitSatelliteSite({ - title: 'Internet Computer - Error: response verification error' - }); - await satellitePage.assertScreenshot(); + const satellitePage = await consolePage.visitSatelliteSite({ + title: 'Internet Computer - Error: response verification error' + }); + await satellitePage.assertScreenshot(); - 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(); + }); -testWithII( - 'should create, download, delete, upload and restore a snapshot to another satellite', - async () => { - testWithII.setTimeout(120_000); + testWithII( + 'should create, download, delete, upload and restore a snapshot to another satellite', + async () => { + testWithII.setTimeout(120_000); - const {consolePage, cliPage} = getTestPages(); + const {consolePage, cliPage} = getTestPages(); - await consolePage.getICP(); + await consolePage.getICP(); - await consolePage.goto(); + await consolePage.goto(); - await consolePage.createSatellite({kind: 'application'}); + await consolePage.createSatellite({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(); - } -); +snapshotTests({satelliteKind: 'application'}); +snapshotTests({satelliteKind: 'website'}); diff --git a/e2e/snapshots/snapshots.spec.ts-snapshots/should-create-and-restore-a-snapshot-1-chromium-linux.png b/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-application-should-create-and-restore-a-snapshot-1-chromium-linux.png similarity index 100% rename from e2e/snapshots/snapshots.spec.ts-snapshots/should-create-and-restore-a-snapshot-1-chromium-linux.png rename to e2e/snapshots/snapshots.spec.ts-snapshots/satellite-application-should-create-and-restore-a-snapshot-1-chromium-linux.png diff --git a/e2e/snapshots/snapshots.spec.ts-snapshots/should-create-and-restore-a-snapshot-2-chromium-linux.png b/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-application-should-create-and-restore-a-snapshot-2-chromium-linux.png similarity index 100% rename from e2e/snapshots/snapshots.spec.ts-snapshots/should-create-and-restore-a-snapshot-2-chromium-linux.png rename to e2e/snapshots/snapshots.spec.ts-snapshots/satellite-application-should-create-and-restore-a-snapshot-2-chromium-linux.png diff --git a/e2e/snapshots/snapshots.spec.ts-snapshots/should-create-download-delete-upload-and-restore-a-snapshot-to-another-satellite-1-chromium-linux.png b/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-application-should-create-download--5c0bb-d-and-restore-a-snapshot-to-another-satellite-1-chromium-linux.png similarity index 100% rename from e2e/snapshots/snapshots.spec.ts-snapshots/should-create-download-delete-upload-and-restore-a-snapshot-to-another-satellite-1-chromium-linux.png rename to e2e/snapshots/snapshots.spec.ts-snapshots/satellite-application-should-create-download--5c0bb-d-and-restore-a-snapshot-to-another-satellite-1-chromium-linux.png diff --git a/e2e/snapshots/snapshots.spec.ts-snapshots/should-create-download-delete-upload-and-restore-a-snapshot-2-chromium-linux.png b/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-application-should-create-download--f8300-d-and-restore-a-snapshot-to-another-satellite-2-chromium-linux.png similarity index 100% rename from e2e/snapshots/snapshots.spec.ts-snapshots/should-create-download-delete-upload-and-restore-a-snapshot-2-chromium-linux.png rename to e2e/snapshots/snapshots.spec.ts-snapshots/satellite-application-should-create-download--f8300-d-and-restore-a-snapshot-to-another-satellite-2-chromium-linux.png diff --git a/e2e/snapshots/snapshots.spec.ts-snapshots/should-create-download-delete-upload-and-restore-a-snapshot-1-chromium-linux.png b/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-application-should-create-download-delete-upload-and-restore-a-snapshot-1-chromium-linux.png similarity index 100% rename from e2e/snapshots/snapshots.spec.ts-snapshots/should-create-download-delete-upload-and-restore-a-snapshot-1-chromium-linux.png rename to e2e/snapshots/snapshots.spec.ts-snapshots/satellite-application-should-create-download-delete-upload-and-restore-a-snapshot-1-chromium-linux.png diff --git a/e2e/snapshots/snapshots.spec.ts-snapshots/should-create-download-delete-upload-and-restore-a-snapshot-to-another-satellite-2-chromium-linux.png b/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-application-should-create-download-delete-upload-and-restore-a-snapshot-2-chromium-linux.png similarity index 100% rename from e2e/snapshots/snapshots.spec.ts-snapshots/should-create-download-delete-upload-and-restore-a-snapshot-to-another-satellite-2-chromium-linux.png rename to e2e/snapshots/snapshots.spec.ts-snapshots/satellite-application-should-create-download-delete-upload-and-restore-a-snapshot-2-chromium-linux.png diff --git a/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-website-should-create-and-restore-a-snapshot-1-chromium-linux.png b/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-website-should-create-and-restore-a-snapshot-1-chromium-linux.png new file mode 100644 index 00000000..c6cc43eb Binary files /dev/null and b/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-website-should-create-and-restore-a-snapshot-1-chromium-linux.png differ diff --git a/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-website-should-create-and-restore-a-snapshot-2-chromium-linux.png b/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-website-should-create-and-restore-a-snapshot-2-chromium-linux.png new file mode 100644 index 00000000..7b6610c0 Binary files /dev/null and b/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-website-should-create-and-restore-a-snapshot-2-chromium-linux.png differ diff --git a/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-website-should-create-download-del-3f70f-d-and-restore-a-snapshot-to-another-satellite-2-chromium-linux.png b/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-website-should-create-download-del-3f70f-d-and-restore-a-snapshot-to-another-satellite-2-chromium-linux.png new file mode 100644 index 00000000..7b6610c0 Binary files /dev/null and b/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-website-should-create-download-del-3f70f-d-and-restore-a-snapshot-to-another-satellite-2-chromium-linux.png differ diff --git a/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-website-should-create-download-del-c07c6-d-and-restore-a-snapshot-to-another-satellite-1-chromium-linux.png b/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-website-should-create-download-del-c07c6-d-and-restore-a-snapshot-to-another-satellite-1-chromium-linux.png new file mode 100644 index 00000000..4fbe70d0 Binary files /dev/null and b/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-website-should-create-download-del-c07c6-d-and-restore-a-snapshot-to-another-satellite-1-chromium-linux.png differ diff --git a/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-website-should-create-download-delete-upload-and-restore-a-snapshot-1-chromium-linux.png b/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-website-should-create-download-delete-upload-and-restore-a-snapshot-1-chromium-linux.png new file mode 100644 index 00000000..c6cc43eb Binary files /dev/null and b/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-website-should-create-download-delete-upload-and-restore-a-snapshot-1-chromium-linux.png differ diff --git a/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-website-should-create-download-delete-upload-and-restore-a-snapshot-2-chromium-linux.png b/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-website-should-create-download-delete-upload-and-restore-a-snapshot-2-chromium-linux.png new file mode 100644 index 00000000..7b6610c0 Binary files /dev/null and b/e2e/snapshots/snapshots.spec.ts-snapshots/satellite-website-should-create-download-delete-upload-and-restore-a-snapshot-2-chromium-linux.png differ diff --git a/e2e/utils/init.utils.ts b/e2e/utils/init.utils.ts index a23ef2ae..65165c24 100644 --- a/e2e/utils/init.utils.ts +++ b/e2e/utils/init.utils.ts @@ -7,9 +7,11 @@ interface TestSuitePages { cliPage: CliPage; } -export const initTestSuite = (): (() => TestSuitePages) => { - testWithII.describe.configure({mode: 'serial'}); - +export const initTestSuite = ({ + satelliteKind +}: { + satelliteKind: 'website' | 'application'; +}): (() => TestSuitePages) => { let consolePage: ConsolePage; let cliPage: CliPage; @@ -27,7 +29,7 @@ export const initTestSuite = (): (() => TestSuitePages) => { browser }); - await consolePage.createSatellite({kind: 'website'}); + await consolePage.createSatellite({kind: satelliteKind}); const satelliteId = await consolePage.copySatelliteID();