Skip to content

Commit

Permalink
Remove searchBy from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
obulat committed Oct 6, 2023
1 parent 70db840 commit eddeee5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
5 changes: 2 additions & 3 deletions frontend/test/playwright/e2e/filters-sidebar-keyboard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ for (const dir of languageDirections) {
await setBreakpointCookie(page, "lg")
/**
* To simplify finding the last focusable element in the filters sidebar,
* we use the image search page. After the removal of the "searchBy" filter,
* the last element on the all media search page is the "license explanation"
* button, not a checkbox.
* we use the image search page. The last element on the all media search
* page is the "license explanation" button, not a checkbox.
*/
await page.goto(pathWithDir("/search/image?q=birds", dir))
})
Expand Down
16 changes: 5 additions & 11 deletions frontend/test/playwright/e2e/filters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ breakpoints.describeMobileAndDesktop(() => {
}

test("initial filters are applied based on the url", async ({ page }) => {
await page.goto(
"/search/?q=cat&license_type=commercial&license=cc0&searchBy=creator"
)
await page.goto("/search/?q=cat&license_type=commercial&license=cc0")
await filters.open(page)
// Creator filter was removed from the UI
const expectedFilters = ["Zero", "Use commercially"]
Expand All @@ -78,9 +76,7 @@ breakpoints.describeMobileAndDesktop(() => {
test("common filters are retained when media type changes from all media to single type", async ({
page,
}) => {
await page.goto(
"/search/?q=cat&license_type=commercial&license=cc0&searchBy=creator"
)
await page.goto("/search/?q=cat&license_type=commercial&license=cc0")
await filters.open(page)
// Creator filter was removed from the UI
const expectedFilters = ["Zero", "Use commercially"]
Expand All @@ -91,7 +87,7 @@ breakpoints.describeMobileAndDesktop(() => {
await changeSearchType(page, IMAGE)

await expect(page).toHaveURL(
"/search/image?q=cat&license_type=commercial&license=cc0&searchBy=creator"
"/search/image?q=cat&license_type=commercial&license=cc0"
)
await filters.open(page)
for (const checkbox of expectedFilters) {
Expand All @@ -102,9 +98,7 @@ breakpoints.describeMobileAndDesktop(() => {
test("common filters are retained when media type changes from single type to all media", async ({
page,
}) => {
await page.goto(
"/search/image?q=cat&license_type=commercial&license=cc0&searchBy=creator"
)
await page.goto("/search/image?q=cat&license_type=commercial&license=cc0")
await filters.open(page)

// Creator filter was removed from the UI
Expand All @@ -118,7 +112,7 @@ breakpoints.describeMobileAndDesktop(() => {
await expect(page.locator('input[type="checkbox"]:checked')).toHaveCount(2)

await expect(page).toHaveURL(
"/search/?q=cat&license_type=commercial&license=cc0&searchBy=creator"
"/search/?q=cat&license_type=commercial&license=cc0"
)
})

Expand Down
6 changes: 3 additions & 3 deletions frontend/test/playwright/e2e/search-query-server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test.describe("search query on SSR", () => {

test("q query parameter is set as the search term", async ({ page }) => {
await goToSearchTerm(page, "cat", {
query: "license=cc0&license_type=commercial&searchBy=creator",
query: "license=cc0&license_type=commercial",
})

const searchInput = page.locator('input[type="search"]')
Expand Down Expand Up @@ -66,7 +66,7 @@ test.describe("search query on SSR", () => {
page,
}) => {
await goToSearchTerm(page, "cat", {
query: "license=cc0&license_type=commercial&searchBy=creator",
query: "license=cc0&license_type=commercial",
})

await filters.open(page)
Expand All @@ -83,7 +83,7 @@ test.describe("search query on SSR", () => {
}) => {
await goToSearchTerm(page, "cat", {
searchType: IMAGE,
query: "searchBy=creator&extension=jpg,png,gif,svg",
query: "extension=jpg,png,gif,svg",
})
await filters.open(page)
const checkboxes = ["JPEG", "PNG", "GIF", "SVG"]
Expand Down

0 comments on commit eddeee5

Please sign in to comment.