Skip to content

Commit

Permalink
Restructure homepage tests
Browse files Browse the repository at this point in the history
Signed-off-by: Olga Bulat <[email protected]>
  • Loading branch information
obulat committed Jan 2, 2024
1 parent 05b82bb commit b5dccb8
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions frontend/test/playwright/visual-regression/pages/homepage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
languageDirections,
pathWithDir,
preparePageForTests,
setCookies,
} from "~~/test/playwright/utils/navigation"

test.describe.configure({ mode: "parallel" })
Expand All @@ -24,25 +25,24 @@ const cleanImageCarousel = async (page: Page) => {
}

for (const dir of languageDirections) {
test.describe(`${dir} homepage snapshots`, () => {
const path = pathWithDir("/", dir)
test.beforeEach(async ({ page }) => {
await preparePageForTests(page, "xl", {
features: { additional_search_types: "off" },
const path = pathWithDir("/", dir)

breakpoints.describeEvery(({ breakpoint, expectSnapshot }) => {
test.describe(`${dir} homepage`, () => {
test.beforeEach(async ({ page }) => {
await preparePageForTests(page, breakpoint, {
features: { additional_search_types: "off" },
})
await page.goto(path)
await cleanImageCarousel(page)
await page.mouse.move(0, 0)
})
await page.goto(path)
await cleanImageCarousel(page)
await page.mouse.move(0, 0)
})

breakpoints.describeEvery(({ expectSnapshot }) =>
test(`${dir} full page`, async ({ page }) => {
await expectSnapshot(`index-${dir}`, page)
})
)

test.describe("search input", () => {
breakpoints.describeEvery(({ expectSnapshot }) => {
test.describe("search input", () => {
test("unfocused", async ({ page }) => {
await expectSnapshot(
`unfocused-search-${dir}`,
Expand All @@ -68,10 +68,8 @@ for (const dir of languageDirections) {
test("content switcher with external sources open", async ({
page,
}) => {
await preparePageForTests(page, "xl", {
features: {
additional_search_types: "on",
},
await setCookies(page.context(), {
features: { additional_search_types: "on" },
})

await page.goto(path)
Expand Down

0 comments on commit b5dccb8

Please sign in to comment.