diff --git a/playwright/fixtures/app.ts b/playwright/fixtures/app.ts index e792c42e13..d6efefd3cd 100644 --- a/playwright/fixtures/app.ts +++ b/playwright/fixtures/app.ts @@ -1,17 +1,28 @@ import { test as base } from "@playwright/test"; import { MenuPage } from "../pages/menu.page"; -import { OnboardingPage } from "../pages/onboarding.page"; import { CreateSliceModalPage } from "../pages/slices/createSliceModal.page"; +import { CreateTypeModalPage } from "../pages/types/createTypeModal.page"; import { SliceDetailsPage } from "../pages/slices/sliceDetails.page"; import { SliceListPage } from "../pages/slices/sliceList.page"; -import { AddFieldModalPage } from "../pages/slices/addFieldModal.page"; +import { CustomTypesListPage } from "../pages/types/customTypesList.page"; +import { PageTypesListPage } from "../pages/types/pageTypesList.page"; +import { ChangesPage } from "../pages/changes.page"; +import { ChangelogPage } from "../pages/changelog.page"; +import { CustomTypesDetailsPage } from "../pages/types/customTypesDetails.page"; +import { RenameTypeModalPage } from "../pages/types/renameTypeModal.page"; // Declare the types of your fixtures. type MyFixtures = { createSliceModalPage: CreateSliceModalPage; sliceDetailsPage: SliceDetailsPage; sliceListPage: SliceListPage; - onboardingPage: OnboardingPage; + customTypesListPage: CustomTypesListPage; + customTypesDetailsPage: CustomTypesDetailsPage; + createTypeModalPage: CreateTypeModalPage; + renameTypeModalPage: RenameTypeModalPage; + pageTypesListPage: PageTypesListPage; + changesPage: ChangesPage; + changelogPage: ChangelogPage; menu: MenuPage; }; @@ -19,9 +30,6 @@ export const test = base.extend({ menu: async ({ page }, use) => { await use(new MenuPage(page)); }, - onboardingPage: async ({ page }, use) => { - await use(new OnboardingPage(page)); - }, createSliceModalPage: async ({ page }, use) => { await use(new CreateSliceModalPage(page)); }, @@ -31,6 +39,27 @@ export const test = base.extend({ sliceListPage: async ({ page }, use) => { await use(new SliceListPage(page)); }, + customTypesListPage: async ({ page }, use) => { + await use(new CustomTypesListPage(page)); + }, + customTypesDetailsPage: async ({ page }, use) => { + await use(new CustomTypesDetailsPage(page)); + }, + pageTypesListPage: async ({ page }, use) => { + await use(new PageTypesListPage(page)); + }, + createTypeModalPage: async ({ page }, use) => { + await use(new CreateTypeModalPage(page)); + }, + renameTypeModalPage: async ({ page }, use) => { + await use(new RenameTypeModalPage(page)); + }, + changesPage: async ({ page }, use) => { + await use(new ChangesPage(page)); + }, + changelogPage: async ({ page }, use) => { + await use(new ChangelogPage(page)); + }, }); export { expect } from "@playwright/test"; diff --git a/playwright/package-lock.json b/playwright/package-lock.json index 17eae3df55..38a496d8b9 100644 --- a/playwright/package-lock.json +++ b/playwright/package-lock.json @@ -1,11 +1,11 @@ { - "name": "SliceMachine - end to end tests", + "name": "slicemachine-e2e", "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "SliceMachine - end to end tests", + "name": "slicemachine-e2e", "version": "1.0.0", "license": "ISC", "devDependencies": { diff --git a/playwright/package.json b/playwright/package.json index adbfbdfa92..51bcd0003f 100644 --- a/playwright/package.json +++ b/playwright/package.json @@ -1,5 +1,5 @@ { - "name": "SliceMachine - end to end tests", + "name": "slicemachine-e2e", "version": "1.0.0", "description": "", "main": "index.js", diff --git a/playwright/pages/changelog.page.ts b/playwright/pages/changelog.page.ts new file mode 100644 index 0000000000..0d9c18e2e7 --- /dev/null +++ b/playwright/pages/changelog.page.ts @@ -0,0 +1,13 @@ +import { Locator, Page } from "@playwright/test"; + +export class ChangelogPage { + readonly page: Page; + readonly root: Locator; + readonly title: Locator; + + constructor(page: Page) { + this.page = page; + this.root = page.getByRole("main"); + this.title = this.root.getByText("Changelog"); + } +} diff --git a/playwright/pages/changes.page.ts b/playwright/pages/changes.page.ts new file mode 100644 index 0000000000..901f468cbb --- /dev/null +++ b/playwright/pages/changes.page.ts @@ -0,0 +1,15 @@ +import { Locator, Page } from "@playwright/test"; + +export class ChangesPage { + readonly page: Page; + readonly root: Locator; + readonly title: Locator; + readonly pushButton: Locator; + + constructor(page: Page) { + this.page = page; + this.root = page.getByRole("main").first(); + this.title = this.root.getByRole("link", { name: "Changes" }); + this.title = this.root.getByRole("button", { name: "Push Changes" }); + } +} diff --git a/playwright/pages/menu.page.ts b/playwright/pages/menu.page.ts index 9fe142ba43..244060e3c3 100644 --- a/playwright/pages/menu.page.ts +++ b/playwright/pages/menu.page.ts @@ -1,51 +1,33 @@ -import { expect, Locator, Page } from "@playwright/test"; +import { Locator, Page } from "@playwright/test"; export class MenuPage { readonly page: Page; + readonly root: Locator; readonly appHeader: Locator; + readonly pageTypesLink: Locator; readonly customTypesLink: Locator; readonly slicesLink: Locator; readonly changesLink: Locator; readonly tutorialLink: Locator; readonly changelogLink: Locator; readonly appVersion: Locator; - readonly changesIcon: Locator; constructor(page: Page) { this.page = page; - this.appHeader = page.locator("h5", { hasText: "Slice Machine" }); - this.customTypesLink = page.locator("nav a", { hasText: "Custom Types" }); - this.slicesLink = page.locator("nav a", { hasText: "Slices" }); - this.changesLink = page.locator("nav a", { hasText: "Changes" }); - this.tutorialLink = page.locator("a", { hasText: "Video tutorials" }); - this.changelogLink = page.locator("a", { hasText: "Changelog" }); - this.appVersion = page.locator('a[href="/changelog"] > div:nth-child(2)'); - this.appVersion = page.getByTestId('changes-number'); - } - - async gotoCustomTypes() { - await this.customTypesLink.click(); - await expect( - this.page.locator("main a", { hasText: "Custom Types" }) - ).toBeVisible(); - } - - async gotoSlices() { - await this.slicesLink.click(); - await expect( - this.page.locator("main a", { hasText: "Slices" }).first() - ).toBeVisible(); - } - - async gotoChanges() { - await this.changesLink.click(); - await expect( - this.page.locator("main a", { hasText: "Changes" }) - ).toBeVisible(); - } - - async gotoChangelog() { - await this.changelogLink.click(); - await expect(this.page.getByText("All versions")).toBeVisible(); + this.root = page.getByRole("navigation"); + this.appHeader = this.root.locator("h5", { hasText: "Slice Machine" }); + this.pageTypesLink = this.root.getByRole("link", { name: "Page Types" }); + this.customTypesLink = this.root.getByRole("link", { + name: "Custom Types", + }); + this.slicesLink = this.root.getByRole("link", { name: "Slices" }); + this.changesLink = this.root.getByRole("link", { name: "Changes" }); + this.tutorialLink = this.root.getByRole("link", { + name: "Video tutorials", + }); + this.changelogLink = this.page.getByRole("link", { name: "Changelog" }); + this.appVersion = this.root.locator( + 'a[href="/changelog"] > div:nth-child(2)' + ); } } diff --git a/playwright/pages/onboarding.page.ts b/playwright/pages/onboarding.page.ts deleted file mode 100644 index 82b524328b..0000000000 --- a/playwright/pages/onboarding.page.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { expect, Locator, Page } from "@playwright/test"; - -export class OnboardingPage { - readonly page: Page; - readonly welcome: Locator; - readonly startButton: Locator; - readonly continueButton: Locator; - readonly video: Locator; - readonly skip: Locator; - - constructor(page: Page) { - this.page = page; - this.welcome = page.getByText("Welcome to Slice Machine"); - this.skip = page.getByText("skip"); - this.startButton = page.getByRole("button", { name: "Get Started" }); - this.continueButton = page.getByTitle("Continue"); - this.video = page.locator("video"); - } - - async isLoaded() { - await expect(this.startButton).toBeVisible(); - } - - async isVideoPlaying(index: number, videoTitle: string) { - await expect(this.video.nth(index)).toBeVisible(); - await expect(this.video.nth(index)).toHaveJSProperty("paused", false); - await expect( - this.page.getByRole("heading", { name: videoTitle }) - ).toBeVisible(); - } - -} diff --git a/playwright/pages/slices/sliceList.page.ts b/playwright/pages/slices/sliceList.page.ts index 38bf29385f..c19e47c411 100644 --- a/playwright/pages/slices/sliceList.page.ts +++ b/playwright/pages/slices/sliceList.page.ts @@ -2,21 +2,27 @@ import { Locator, Page } from "@playwright/test"; export class SliceListPage { readonly page: Page; + readonly title: Locator; + readonly root: Locator; readonly createButton: Locator; readonly actionIcon: Locator; constructor(page: Page) { this.page = page; - this.createButton = page.getByRole("button", { name: "Create a Slice" }); //create-slice - this.actionIcon = page.getByTestId("slice-action-icon"); + this.root = page.getByRole("main").first(); + this.title = this.root.getByRole("link", { name: "Slices", exact: true }); + this.createButton = this.root + .getByRole("button", { name: "Create one" }) + .or(this.root.getByRole("button", { name: "Create a Slice" })); + this.actionIcon = this.root.getByTestId("slice-action-icon"); } async goto() { await this.page.goto("/slices"); } - getSliceCard(name: string): Locator { - return this.page.getByRole("button", { + getCard(name: string): Locator { + return this.root.getByRole("button", { name: `${name} slice card`, exact: true, }); @@ -24,22 +30,22 @@ export class SliceListPage { async clickSliceCard(name: string) { // Make sure not to accidentaly click on a button that would trigger another action - await this.getSliceCard(name).getByRole("button", { name }).click(); + await this.getCard(name).getByRole("button", { name }).click(); } async openCreateModal() { - await this.createButton.click(); + await this.createButton.first().click(); } async openActionModal(name: string, action: "Rename" | "Delete") { - await this.getSliceCard(name) + await this.getCard(name) .getByTestId("slice-action-icon-dropdown") .getByText(action) .click(); } async openScreenshotModal(name: string) { - await this.getSliceCard(name).getByRole("button", { + await this.getCard(name).getByRole("button", { name: "Update Screenshot", }); } diff --git a/playwright/pages/types/TypesList.page.ts b/playwright/pages/types/TypesList.page.ts new file mode 100644 index 0000000000..171e2c2ec5 --- /dev/null +++ b/playwright/pages/types/TypesList.page.ts @@ -0,0 +1,47 @@ +import { Locator, Page } from "@playwright/test"; + +export class TypesListPage { + readonly page: Page; + readonly root: Locator; + readonly path: string; + readonly title: Locator; + readonly createButton: Locator; + readonly actionIcon: Locator; + + protected constructor(page: Page, title: string, path: string) { + this.page = page; + this.path = path; + this.root = page.getByRole("main"); + this.title = this.root.getByLabel("Breadcrumb").getByText(title); + this.createButton = this.root + .getByTestId("create-ct") + .or( + this.root.getByRole("article").getByRole("button", { name: "Create" }) + ); + this.actionIcon = this.root.getByTestId("ct-action-icon"); + } + + async goto() { + await this.page.goto("/custom-types"); + await this.title.isVisible(); + } + + getRow(name: string): Locator { + return this.page.getByRole("row", { + name, + }); + } + + async clickRow(name: string) { + await this.getRow(name).getByRole("button", { name }).click(); + } + + async openCreateModal() { + await this.createButton.first().click(); + } + + async openActionModal(name: string, action: "Rename" | "Delete") { + await this.getRow(name).locator('[data-testid="editDropdown"]').click(); + await this.page.getByRole("menuitem", { name: action }).click(); + } +} diff --git a/playwright/pages/types/createTypeModal.page.ts b/playwright/pages/types/createTypeModal.page.ts new file mode 100644 index 0000000000..7bec0e3568 --- /dev/null +++ b/playwright/pages/types/createTypeModal.page.ts @@ -0,0 +1,29 @@ +import { expect, Locator, Page } from "@playwright/test"; + +export class CreateTypeModalPage { + readonly page: Page; + readonly title: Locator; + readonly nameInput: Locator; + readonly closeButton: Locator; + readonly cancelButton: Locator; + readonly submitButton: Locator; + + constructor(page: Page) { + this.page = page; + const root = page.getByTestId("create-ct-modal"); + this.title = root.getByRole("heading", { + name: /Create a new (page|custom) type/, + }); + this.nameInput = root.getByTestId("ct-name-input"); + this.closeButton = root.getByRole("button", { name: "Close" }); + this.cancelButton = root.getByRole("button", { name: "Cancel" }); + this.submitButton = root.getByRole("button", { name: "Create" }); + } + + async createType(name: string) { + await expect(this.title).toBeVisible(); + await this.nameInput.fill(name); + await this.submitButton.click(); + await expect(this.title).not.toBeVisible(); + } +} diff --git a/playwright/pages/types/customTypesDetails.page.ts b/playwright/pages/types/customTypesDetails.page.ts new file mode 100644 index 0000000000..2b7a4b1315 --- /dev/null +++ b/playwright/pages/types/customTypesDetails.page.ts @@ -0,0 +1,9 @@ +import { Locator, Page } from "@playwright/test"; +import { TypesListPage } from "./TypesList.page"; +import { TypeDetailsPage } from "./typeDetails.page"; + +export class CustomTypesDetailsPage extends TypeDetailsPage { + constructor(page: Page) { + super(page); + } +} diff --git a/playwright/pages/types/customTypesList.page.ts b/playwright/pages/types/customTypesList.page.ts new file mode 100644 index 0000000000..b878f1ca5b --- /dev/null +++ b/playwright/pages/types/customTypesList.page.ts @@ -0,0 +1,8 @@ +import { Locator, Page } from "@playwright/test"; +import { TypesListPage } from "./TypesList.page"; + +export class CustomTypesListPage extends TypesListPage { + constructor(page: Page) { + super(page, "Custom Types", "/custom-types"); + } +} diff --git a/playwright/pages/types/pageTypesList.page.ts b/playwright/pages/types/pageTypesList.page.ts new file mode 100644 index 0000000000..4478572857 --- /dev/null +++ b/playwright/pages/types/pageTypesList.page.ts @@ -0,0 +1,8 @@ +import { Locator, Page } from "@playwright/test"; +import { TypesListPage } from "./TypesList.page"; + +export class PageTypesListPage extends TypesListPage { + constructor(page: Page) { + super(page, "Page Types", "/page-types"); + } +} diff --git a/playwright/pages/types/renameTypeModal.page.ts b/playwright/pages/types/renameTypeModal.page.ts new file mode 100644 index 0000000000..68a5f5fdf2 --- /dev/null +++ b/playwright/pages/types/renameTypeModal.page.ts @@ -0,0 +1,29 @@ +import { expect, Locator, Page } from "@playwright/test"; + +export class RenameTypeModalPage { + readonly page: Page; + readonly title: Locator; + readonly nameInput: Locator; + readonly closeButton: Locator; + readonly cancelButton: Locator; + readonly submitButton: Locator; + + constructor(page: Page) { + this.page = page; + const root = page.getByRole("dialog", { name: "Rename a custom type" }); + this.title = root.getByRole("heading", { + name: /Rename a (page|custom) type/, + }); + this.nameInput = root.getByTestId("custom-type-name-input"); + this.closeButton = root.getByRole("button", { name: "Close" }); + this.cancelButton = root.getByRole("button", { name: "Cancel" }); + this.submitButton = root.getByRole("button", { name: "Rename" }); + } + + async renameType(newName: string) { + await expect(this.title).toBeVisible(); + await this.nameInput.fill(newName); + await this.submitButton.click(); + await expect(this.title).not.toBeVisible(); + } +} diff --git a/playwright/pages/types/typeDetails.page.ts b/playwright/pages/types/typeDetails.page.ts new file mode 100644 index 0000000000..49830e0aa9 --- /dev/null +++ b/playwright/pages/types/typeDetails.page.ts @@ -0,0 +1,71 @@ +import { expect, Locator, Page } from "@playwright/test"; + +export class TypeDetailsPage { + readonly page: Page; + readonly breadcrumb: Locator; + readonly saveButton: Locator; + + readonly staticZone: Locator; + readonly repeatableZone: Locator; + readonly sliceZoneToggle: Locator; + readonly sliceZonePlaceholder: Locator; + readonly showSnippetsButton: Locator; + readonly hideSnippetsButton: Locator; + readonly toggleSnippetsButton: Locator; + readonly addFieldsModalTitle: Locator; + + constructor(page: Page) { + this.page = page; + + this.breadcrumb = page.getByLabel("Breadcrumb"); + this.saveButton = page.getByRole("button", { name: "Save to File System" }); + + this.sliceZoneToggle = page.getByRole("button", { name: "switch" }); + + this.staticZone = page.getByTestId("ct-static-zone"); + this.repeatableZone = page.getByTestId("slice-repeatable-zone"); + + this.sliceZonePlaceholder = page.getByText( + "Add a field to your Static Zone" + ); + this.sliceZonePlaceholder = page.getByText( + "Add a field to your Repeatable Zone" + ); + + // this.addRepeatableFieldButton = page.getByText("add-Repeatable-field"); + + this.addFieldsModalTitle = page.getByRole("heading", { + name: /^Add a new field$/, + }); + } + + async addField( + type: + | "Rich Text" + | "Image" + | "Link" + | "Link to media" + | "Content Relationship" + | "Select" + | "Boolean" + | "Date" + | "Timestamp" + | "Embed" + | "Number" + | "GeoPoint" + | "Color" + | "Key Text", + name: string, + expectedId: string + ) { + await this.page.getByTestId("add-Static-field").click(); + await expect(this.addFieldsModalTitle).toBeVisible(); + await this.page.getByRole("heading", { name: type }).click(); + await expect(this.addFieldsModalTitle).not.toBeVisible(); + await this.page.getByPlaceholder("Field Name").type(name); + await expect(this.page.getByPlaceholder("e.g. buttonLink")).toHaveValue( + expectedId + ); + await this.page.getByRole("button", { name: "Add", exact: true }).click(); + } +} diff --git a/playwright/playwright.config.ts b/playwright/playwright.config.ts index 623636557a..ae58a70553 100644 --- a/playwright/playwright.config.ts +++ b/playwright/playwright.config.ts @@ -28,45 +28,57 @@ const config: PlaywrightTestConfig = { /* Opt out of parallel tests on CI. */ workers: process.env.CI ? 1 : undefined, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - // reporter: "html", + reporter: "html", // globalSetup: require.resolve('./global-setup.ts'), /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ actionTimeout: 0, /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: "http://localhost:9999", + baseURL: process.env.APP_SM_PORT + ? `http://localhost:${process.env.APP_SM_PORT}` + : "http://localhost:9999", /* Save localStorage */ // storageState: './storageState.json', /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: "on", - video: "on", + video: "off", screenshot: "on", testIdAttribute: "data-cy", }, + webServer: process.env.APP_CWD + ? { + cwd: process.env.APP_CWD, + command: `npm run slicemachine -- --port ${process.env.APP_SM_PORT}`, + url: `http://localhost:${process.env.APP_SM_PORT}`, + reuseExistingServer: !process.env.CI, + } + : undefined, /* Configure projects for major browsers */ projects: [ - { - name: "Smoke Chromium", - testDir: "./tests/smoke", - use: { - ...devices["Desktop Chrome"], - }, - }, + // { + // name: "Smoke Chromium", + // testDir: "./tests/smoke", + // use: { + // ...devices["Desktop Chrome"], + // }, + // }, { name: "chromium", + testIgnore: "./tests/smoke/**", use: { ...devices["Desktop Chrome"], }, }, - { - name: "webkit", - use: { - ...devices["Desktop Safari"], - }, - }, + // { + // name: "webkit", + // testIgnore: "./tests/smoke/**", + // use: { + // ...devices["Desktop Safari"], + // }, + // }, ], /* Folder for test artifacts such as screenshots, videos, traces, etc. */ diff --git a/playwright/tests/customTypes.spec.ts b/playwright/tests/customTypes.spec.ts new file mode 100644 index 0000000000..ae0ff721c6 --- /dev/null +++ b/playwright/tests/customTypes.spec.ts @@ -0,0 +1,33 @@ +import { expect } from "@playwright/test"; +import { test } from "../fixtures/onboarded"; + +test("I can create a new Custom Type", async ({ + customTypesListPage, + createTypeModalPage, + customTypesDetailsPage, + renameTypeModalPage, + menu, +}) => { + await customTypesListPage.goto(); + await customTypesListPage.openCreateModal(); + + const randomInt = Math.floor(Math.random() * 1e9); + const name = "Custom Type " + randomInt; + await createTypeModalPage.createType(name); + + await expect(customTypesDetailsPage.breadcrumb).toContainText(name); + + await expect( + customTypesDetailsPage.staticZone.getByRole("listitem") + ).toHaveCount(1); + + await menu.customTypesLink.click(); + + await customTypesListPage.openActionModal(name, "Rename"); + + const newName = name + " - Edited"; + await renameTypeModalPage.renameType(name + " - Edited"); + + await customTypesListPage.getRow(newName).click(); + await expect(customTypesDetailsPage.breadcrumb).toContainText(newName); +}); diff --git a/playwright/tests/navigation.spec.ts b/playwright/tests/navigation.spec.ts new file mode 100644 index 0000000000..e547535adf --- /dev/null +++ b/playwright/tests/navigation.spec.ts @@ -0,0 +1,35 @@ +import { expect } from "@playwright/test"; +import { test } from "../fixtures/app"; + +test("Navigate through all menu entries", async ({ + page, + menu, + sliceListPage, + customTypesListPage, + pageTypesListPage, + changesPage, + changelogPage, +}) => { + await page.goto("/"); + + await menu.customTypesLink.click(); + await expect(customTypesListPage.title).toBeVisible(); + expect(await page.title()).toContain("Custom types - Slice Machine"); + + await menu.pageTypesLink.click(); + await expect(pageTypesListPage.title).toBeVisible(); + expect(await page.title()).toContain("Page types - Slice Machine"); + + await menu.slicesLink.click(); + await expect(sliceListPage.title).toBeVisible(); + await page.waitForLoadState(); + expect(await page.title()).toContain("Slices - Slice Machine"); + + await menu.changesLink.click(); + await expect(changesPage.title).toBeVisible(); + expect(await page.title()).toContain("Changes - Slice Machine"); + + await menu.changelogLink.click(); + await expect(changelogPage.title).toBeVisible(); + expect(await page.title()).toContain("Changelog - Slice Machine"); +}); diff --git a/playwright/tests/onboarding.spec.ts b/playwright/tests/onboarding.spec.ts deleted file mode 100644 index 9a9a9e6443..0000000000 --- a/playwright/tests/onboarding.spec.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { test, expect } from "../fixtures/app"; - -test("As a new user, I can skip the onboarding", async ({ - page, - menu, - onboardingPage, -}) => { - await page.goto("/"); - - await onboardingPage.isLoaded(); - await expect(menu.appHeader).not.toBeVisible(); - - await onboardingPage.startButton.click(); - await onboardingPage.skip.click(); - - await expect(onboardingPage.startButton).not.toBeVisible(); - await expect(menu.appHeader).toBeVisible(); - - await page.reload(); - await expect(menu.appHeader).toBeVisible(); -}); - -test("As a new user, I go through the whole onboarding", async ({ - page, - menu, - onboardingPage, -}) => { - await page.goto("/"); - - await onboardingPage.isLoaded(); - await expect(menu.appHeader).not.toBeVisible(); - - await expect(page).toHaveScreenshot({ fullPage: true }); - - await onboardingPage.startButton.click(); - - const videos = [ - "Build Slices", - "Create Page Types", - "Push your pages to Prismic", - ]; - for (const [index, videoTitle] of videos.entries()) { - await onboardingPage.isVideoPlaying(index, videoTitle); - await onboardingPage.continueButton.click(); - } - - await expect(onboardingPage.continueButton).not.toBeVisible(); - await expect(menu.appHeader).toBeVisible(); - - await page.reload(); - await expect(menu.appHeader).toBeVisible(); - // Depending on the number of chars in the SM version, the menu was taking more or less width making the screenshot comparison fail. - // await expect(page).toHaveScreenshot({fullPage: true, mask: [menu.appVersion, menu.changesIcon]}); -}); diff --git a/playwright/tests/onboarding.spec.ts-snapshots/As-a-new-user-I-go-through-the-whole-onboarding-1-chromium-darwin.png b/playwright/tests/onboarding.spec.ts-snapshots/As-a-new-user-I-go-through-the-whole-onboarding-1-chromium-darwin.png deleted file mode 100644 index b787949595..0000000000 Binary files a/playwright/tests/onboarding.spec.ts-snapshots/As-a-new-user-I-go-through-the-whole-onboarding-1-chromium-darwin.png and /dev/null differ diff --git a/playwright/tests/onboarding.spec.ts-snapshots/As-a-new-user-I-go-through-the-whole-onboarding-1-webkit-darwin.png b/playwright/tests/onboarding.spec.ts-snapshots/As-a-new-user-I-go-through-the-whole-onboarding-1-webkit-darwin.png deleted file mode 100644 index e6bbbab97a..0000000000 Binary files a/playwright/tests/onboarding.spec.ts-snapshots/As-a-new-user-I-go-through-the-whole-onboarding-1-webkit-darwin.png and /dev/null differ diff --git a/playwright/tests/slice.spec.ts b/playwright/tests/slice.spec.ts index 161bdc4858..19ade37c30 100644 --- a/playwright/tests/slice.spec.ts +++ b/playwright/tests/slice.spec.ts @@ -42,9 +42,9 @@ test("As an onboarded user, I can create a new Slice", async ({ await expect(sliceDetailsPage.title).toBeVisible(); await expect(sliceDetailsPage.title).toContainText(sliceName); - await expect( - sliceDetailsPage.nonRepeatableZone.getByRole("listitem") - ).toHaveCount(2); + await expect(sliceDetailsPage.staticZone.getByRole("listitem")).toHaveCount( + 0 + ); await expect( sliceDetailsPage.repeatableZone.getByRole("listitem") ).toHaveCount(0); diff --git a/playwright/tests/smoke/slice.spec.ts b/playwright/tests/smoke/slice.spec.ts index 41c74acc6c..b84e16f235 100644 --- a/playwright/tests/smoke/slice.spec.ts +++ b/playwright/tests/smoke/slice.spec.ts @@ -1,12 +1,15 @@ import { expect } from "@playwright/test"; import { test } from "../../fixtures/onboarded"; -test.only("As an onboarded user, I can create a new Slice", async ({ +test("I can create a new Slice", async ({ sliceDetailsPage, sliceListPage, createSliceModalPage, + menu, + page, }) => { - await sliceListPage.goto(); + await page.goto("/"); + await menu.slicesLink.click(); await sliceListPage.openCreateModal(); const randomInt = Math.floor(Math.random() * 1e9); @@ -35,8 +38,8 @@ test.only("As an onboarded user, I can create a new Slice", async ({ await sliceDetailsPage.saveButton.click(); await expect(sliceDetailsPage.saveButton).toBeDisabled(); - await expect(sliceDetailsPage.page.getByText("Slice saved")).toBeVisible(); + await expect(sliceDetailsPage.page.getByText("Model saved")).toBeVisible(); - await sliceListPage.goto(); - await expect(sliceListPage.getSliceCard(sliceName)).toBeVisible(); + await menu.slicesLink.click(); + await expect(sliceListPage.getCard(sliceName)).toBeVisible(); });