Skip to content

Commit

Permalink
Update tests and tapes
Browse files Browse the repository at this point in the history
Signed-off-by: Olga Bulat <[email protected]>
  • Loading branch information
obulat committed Mar 3, 2024
1 parent a9ebaf7 commit 99abdf5
Show file tree
Hide file tree
Showing 20 changed files with 5,628 additions and 3,114 deletions.
24 changes: 12 additions & 12 deletions frontend/test/playwright/e2e/collections.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { preparePageForTests } from "~~/test/playwright/utils/navigation"
import {
getCopyButton,
getH1,
getLoadMoreButton,
// getLoadMoreButton,
} from "~~/test/playwright/utils/components"

test.describe.configure({ mode: "parallel" })
Expand All @@ -16,42 +16,42 @@ test.describe("collections", () => {
additional_search_views: "on",
},
})
await page.goto("/image/f9384235-b72e-4f1e-9b05-e1b116262a29?q=cat")
await page.goto("/image/f9384235-b72e-4f1e-9b05-e1b116262a29")
// Wait for the page to hydrate
await expect(getCopyButton(page)).toBeEnabled()
})

test("can open tags collection page from image page", async ({ page }) => {
// Using the href because there are multiple links with the same text.
await page.click('[href*="/tag/cat"]')
await page.click('[href*="image/collection?tag="]')

await page.waitForURL(/image\/tag\/cat/)
await page.waitForURL(/image\/collection/)

await expect(getH1(page, /cat/i)).toBeVisible()
await expect(getLoadMoreButton(page)).toBeEnabled()
expect(await page.locator("figure").count()).toEqual(20)
// await expect(getLoadMoreButton(page)).toBeEnabled()
// expect(await page.locator("figure").count()).toEqual(20)
})

test("can open source collection page from image page", async ({ page }) => {
const sourcePattern = /flickr/i

await page.getByRole("link", { name: sourcePattern }).first().click()

await page.waitForURL(/image\/source\/flickr\//)
await page.waitForURL(/image\/collection/)

await expect(getLoadMoreButton(page)).toBeEnabled()
await expect(getH1(page, sourcePattern)).toBeVisible()
expect(await page.locator("figure").count()).toEqual(20)
// await expect(getLoadMoreButton(page)).toBeEnabled()
// expect(await page.locator("figure").count()).toEqual(20)
})

test("can open creator collection page from image page", async ({ page }) => {
const creatorPattern = /strogoscope/i
await page.getByRole("link", { name: creatorPattern }).first().click()

await page.waitForURL(/image\/source\/flickr\/creator\/strogoscope\//)
await page.waitForURL(/image\/collection/)

await expect(getH1(page, creatorPattern)).toBeVisible()
await expect(getLoadMoreButton(page)).toBeEnabled()
expect(await page.locator("figure").count()).toEqual(20)
// await expect(getLoadMoreButton(page)).toBeEnabled()
// expect(await page.locator("figure").count()).toEqual(20)
})
})
2 changes: 1 addition & 1 deletion frontend/test/playwright/e2e/sources.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test("sources table has links to source pages", async ({ page }) => {
.getByRole("cell", { name: "Flickr", exact: true })
.getByRole("link")
.click()
await page.waitForURL("/image/source/flickr")
await page.waitForURL("/image/collection?source=flickr")

await expect(getH1(page, "Flickr")).toBeVisible()
})
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
id: 'f9384235-b72e-4f1e-9b05-e1b116262a29',
title: 'Cat',
foreign_landing_url: 'https://www.flickr.com/photos/7788419@N05/15218475961',
creator: 'strogoscope',
creator: 'strogoscope/ photographer ? creator',
creator_url: 'https://www.flickr.com/photos/7788419@N05',
url: 'https://live.staticflickr.com/3903/15218475961_963a4c116e_b.jpg',
filesize: null,
Expand All @@ -90,7 +90,7 @@
category: null,
tags: [
{
name: 'cat',
name: 'cat & kitten http://www.flickr.com/photos/tags/catkitten/?page=2',
},
],
attribution: '"Cat" by strogoscope is licensed under CC-BY 2.0. To view a copy of this license, visit https://creativecommons.org/licenses/by/2.0/.',
Expand All @@ -101,4 +101,4 @@
related_url: 'http://localhost:49153/v1/images/f9384235-b72e-4f1e-9b05-e1b116262a29/related/',
},
},
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
title: 'Cat',
foreign_landing_url: 'https://www.flickr.com/photos/7788419@N05/15218475961',
url: 'https://live.staticflickr.com/3903/15218475961_963a4c116e_b.jpg',
creator: 'strogoscope',
creator: 'strogoscope/ photographer ? creator',
creator_url: 'https://www.flickr.com/photos/7788419@N05',
license: 'by',
license_version: '2.0',
Expand All @@ -110,4 +110,4 @@
related_url: 'http://localhost:49153/v1/images/f9384235-b72e-4f1e-9b05-e1b116262a29/related/',
},
},
}
}
Loading

0 comments on commit 99abdf5

Please sign in to comment.