Skip to content

Commit

Permalink
Add single result pages for the test with additional search views
Browse files Browse the repository at this point in the history
  • Loading branch information
obulat committed Oct 7, 2023
1 parent e5c7d26 commit 33ac3a1
Showing 1 changed file with 29 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
openFirstResult,
pathWithDir,
preparePageForTests,
setCookies,
} from "~~/test/playwright/utils/navigation"

import { supportedMediaTypes } from "~/constants/media"
Expand All @@ -21,30 +22,36 @@ const cleanRelatedImages = async (page: Page) => {
await page.waitForTimeout(200)
}

for (const mediaType of supportedMediaTypes) {
for (const dir of languageDirections) {
breakpoints.describeEvery(({ breakpoint, expectSnapshot }) => {
// https://github.com/WordPress/openverse/issues/3112
test.skip(`${mediaType} ${dir} single-result page snapshots from search results`, async ({
page,
}) => {
await preparePageForTests(page, breakpoint)

await goToSearchTerm(page, "birds", { dir })
// This will include the "Back to results" link.
await openFirstResult(page, mediaType)
await cleanRelatedImages(page)

await expectSnapshot(
`${mediaType}-${dir}-from-search-results`,
for (const isOn of [true, false]) {
for (const mediaType of supportedMediaTypes) {
for (const dir of languageDirections) {
breakpoints.describeEvery(({ breakpoint, expectSnapshot }) => {
// https://github.com/WordPress/openverse/issues/3112
test(`${mediaType} ${dir} single-result page snapshots from search results, additional search views ${isOn}`, async ({
page,
{
fullPage: true,
},
{ maxDiffPixelRatio: 0.01 }
)
}) => {
await setCookies(page.context(), {
features: { additional_search_views: isOn ? "on" : "off" },
})
await preparePageForTests(page, breakpoint)

await goToSearchTerm(page, "birds", { dir })

// This will include the "Back to results" link.
await openFirstResult(page, mediaType)
await cleanRelatedImages(page)

await expectSnapshot(
`${mediaType}-${dir}-from-search-results${
isOn ? "-with-additional-search-views" : ""
}`,
page,
{ fullPage: true },
{ maxDiffPixelRatio: 0.01 }
)
})
})
})
}
}
}

Expand Down

0 comments on commit 33ac3a1

Please sign in to comment.