Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Make search page layout test less flaky
Browse files Browse the repository at this point in the history
  • Loading branch information
obulat committed Feb 8, 2023
1 parent 9f84b8d commit 8ff43f8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions test/playwright/visual-regression/pages/pages.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, test } from "@playwright/test"
import { expect, Page, test } from "@playwright/test"

import breakpoints from "~~/test/playwright/utils/breakpoints"
import { removeHiddenOverflow } from "~~/test/playwright/utils/page"
Expand Down Expand Up @@ -47,6 +47,13 @@ for (const contentPage of contentPages) {
}
}

const cleanImageResults = async (page: Page) => {
await page.addStyleTag({
content: ".results-grid img { filter: brightness(0%); }",
})
await page.waitForTimeout(500)
}

test.describe("Layout color is set correctly", () => {
breakpoints.describeLg(() => {
test.use({
Expand All @@ -61,8 +68,13 @@ test.describe("Layout color is set correctly", () => {
await page.getByRole("combobox", { name: "Language" }).selectOption("ar")

await page.getByPlaceholder("البحث عن محتوى").fill("cat")
await page.getByRole("button", { name: "يبحث" }).click()
await page.waitForNavigation()

await Promise.all([
page.waitForNavigation(),
page.getByRole("button", { name: "يبحث" }).click(),
])

await cleanImageResults(page)

expect(await page.screenshot()).toMatchSnapshot("search-page-rtl-lg.png")
})
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8ff43f8

Please sign in to comment.