Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added Playwright test for redirecting circ bib requests to Vega [SCC-5292](https://newyorkpubliclibrary.atlassian.net/browse/SCC-5292)
- Added author/contributor mode to browse landing [SCC-4966](https://newyorkpubliclibrary.atlassian.net/browse/SCC-4966)
- Added author/contributor models and table [SCC-4969](https://newyorkpubliclibrary.atlassian.net/browse/SCC-4969)
- Added author/contributor index and search results pages, with role handling [SCC-4967](https://newyorkpubliclibrary.atlassian.net/browse/SCC-4967)
Expand Down
107 changes: 64 additions & 43 deletions playwright/tests/redirects.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,74 @@ const BASE_URL =
process.env.BASE_URL || "http://local.nypl.org:8080/research/research-catalog"
const BASE_HOST = BASE_URL.replace("/research/research-catalog", "")

test("legacy url redirects to base path", async ({ page }) => {
await page.goto(`${BASE_HOST}/research/collections/shared-collection-catalog`)
await expect(page).toHaveURL(BASE_URL)
})
test.describe("middleware redirects", () => {
test("legacy url redirects to base path", async ({ page }) => {
await page.goto(
`${BASE_HOST}/research/collections/shared-collection-catalog`
)
await expect(page).toHaveURL(BASE_URL)
})

test("legacy url plus path redirects to base path", async ({ page }) => {
await page.goto(
`${BASE_HOST}/research/collections/shared-collection-catalog/test`
)
await expect(page).toHaveURL(`${BASE_URL}/test`)
})
test("legacy url plus path redirects to base path", async ({ page }) => {
await page.goto(
`${BASE_HOST}/research/collections/shared-collection-catalog/test`
)
await expect(page).toHaveURL(`${BASE_URL}/test`)
})

test("exact mapped SHEP link redirects to browse", async ({ page }) => {
await page.goto(
`${BASE_URL}/subject_headings/c47dda10-a6a1-49ba-81db-6e46722674af`
)
await expect(page).toHaveURL(
`${BASE_URL}/browse/subjects/Hebrew language -- Study and teaching.`
)
})
test("exact mapped SHEP link redirects to browse", async ({ page }) => {
await page.goto(
`${BASE_URL}/subject_headings/c47dda10-a6a1-49ba-81db-6e46722674af`
)
await expect(page).toHaveURL(
`${BASE_URL}/browse/subjects/Hebrew language -- Study and teaching.`
)
})

test("SHEP link with filter parameter redirects to browse index", async ({
page,
}) => {
await page.goto(`${BASE_URL}/subject_headings?filter=Bronx River`)
await expect(page).toHaveURL(
`${BASE_URL}/browse?q=Bronx River&search_scope=starts_with`
)
})
test("SHEP link with filter parameter redirects to browse index", async ({
page,
}) => {
await page.goto(`${BASE_URL}/subject_headings?filter=Bronx River`)
await expect(page).toHaveURL(
`${BASE_URL}/browse?q=Bronx River&search_scope=starts_with`
)
})

test("SHEP link with label parameter redirects to browse results", async ({
page,
}) => {
await page.goto(
`${BASE_URL}/subject_headings/c47dda10-a6a1-49ba-81db-6e46722674af?label=Hello`
)
await expect(page).toHaveURL(new RegExp(`${BASE_URL}/browse/subjects/Hello`))
})
test("SHEP link with label parameter redirects to browse results", async ({
page,
}) => {
await page.goto(
`${BASE_URL}/subject_headings/c47dda10-a6a1-49ba-81db-6e46722674af?label=Hello`
)
await expect(page).toHaveURL(
new RegExp(`${BASE_URL}/browse/subjects/Hello`)
)
})

test("SHEP base url redirects to browse", async ({ page }) => {
await page.goto(`${BASE_URL}/subject_headings`)
await expect(page).toHaveURL(`${BASE_URL}/browse`)
})
test("SHEP base url redirects to browse", async ({ page }) => {
await page.goto(`${BASE_URL}/subject_headings`)
await expect(page).toHaveURL(`${BASE_URL}/browse`)
})

test("SHEP link with unknown uuid/path redirects to browse", async ({
page,
}) => {
await page.goto(`${BASE_URL}/subject_headings/something-something`)
await expect(page).toHaveURL(`${BASE_URL}/browse`)
})

test.describe("circ bib request redirects", () => {
test("RC sends circ bib requests to Vega", async ({ request }) => {
const response = await request.get(`${BASE_URL}/bib/b17782484`, {
maxRedirects: 0,
})

expect(response.status()).toEqual(307)

test("SHEP link with unknown uuid/path redirects to browse", async ({
page,
}) => {
await page.goto(`${BASE_URL}/subject_headings/something-something`)
await expect(page).toHaveURL(`${BASE_URL}/browse`)
const location = response.headers()["location"]
expect(location).toBe(
"https://borrow.nypl.org/search/card?recordId=17782484"
)
})
})
})
Loading