Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playwright circulars archive basic tests #2423

Merged
Merged
Changes from 7 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
53 changes: 52 additions & 1 deletion __playwright__/circulars/archive.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test } from '@playwright/test'
import { expect, test } from '@playwright/test'

test.describe('Circulars archive page', () => {
test('responds to changes in the number of results per page', async ({
Expand All @@ -17,4 +17,55 @@ test.describe('Circulars archive page', () => {
)
}
})

test('search is functional via mouse click', async ({ page }) => {
await page.goto('/circulars')
await page.locator('#query').fill('GRB')
await page.getByRole('button', { name: 'Search' }).click()
})

test('search is functional via keyboard input', async ({ page }) => {
await page.goto('/circulars')
await page.locator('#query').fill('GRB')
await page.getByTestId('textInput').press('Enter')
})

test('search finds query string in body of circular', async ({ page }) => {
await page.goto('/circulars?query=ATLAS23srq')
await expect(
page.locator('a[href="/circulars/34730?query=ATLAS23srq"]')
).toBeVisible()
})

test('search finds all results related to a specific object', async ({
page,
}) => {
await page.goto('/circulars?query=230812B')
await page.waitForLoadState()
await expect(page.locator('ol', { has: page.locator('li') })).toBeVisible()
expect(await page.locator('ol > li').count()).toBe(64)
})

test('search finds no results for query with typo', async ({ page }) => {
// this highlights this search behaviour does not capture cases where there is a minor typo
await page.goto('/circulars?query=230812C')
await page.waitForLoadState()
await expect(
page.locator('ol', { has: page.locator('li') })
).not.toBeVisible()
})

test('search finds results that contain exact string but not similar strings', async ({
page,
}) => {
// this highlights the search returns limited results because it is looking for exact matches to the string
// this should return many more results and include strings like 230812B
await page.goto('/circulars?query=230812')
await page.waitForFunction(
(n) =>
document.getElementsByTagName('ol')[0].getElementsByTagName('li')
.length === n,
1
)
})
lpsinger marked this conversation as resolved.
Show resolved Hide resolved
})
Loading