Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
34 changes: 21 additions & 13 deletions apps/data-management/e2e/specs/general.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { expect, test } from '@playwright/test'

import { authenticateSession } from '../support/auth'
import { fixtures, users } from '../support/fixtures'

test.describe('general navigation', () => {
test('root redirects to browse and the logo returns to browse from about', async ({
page,
}) => {
await page.goto('/')
await expect(page).toHaveURL(/\/browse$/)
await expect(page.getByText('Browse data collection sites')).toBeVisible()
await expect(
page.getByRole('heading', { name: 'Monitoring sites', level: 1 })
).toBeVisible()

await page.goto('/about')
await expect(page.getByText(/About (HydroServer|us)/).first()).toBeVisible()
Expand All @@ -18,19 +23,22 @@ test.describe('general navigation', () => {
test('browse page site type filter filters the site list and can be cleared', async ({
page,
}) => {
await page.goto('/browse')
await expect(page.getByText('Browse data collection sites')).toBeVisible()

const siteTypeFilter = page
.getByRole('combobox', { name: /site type/i })
.first()
await expect(siteTypeFilter).toBeVisible()
await authenticateSession(page, users.owner.email, users.owner.password)
await page.goto('/browse?siteTypes=Private')
await expect(
page.getByRole('heading', { name: 'Monitoring sites', level: 1 })
).toBeVisible()

await siteTypeFilter.click()
await siteTypeFilter.fill('Lake')
await siteTypeFilter.press('Enter')
await expect(
page.getByText(fixtures.things.private.name, { exact: true })
).toBeVisible()
await expect(
page.getByText(fixtures.things.public.name, { exact: true })
).toHaveCount(0)

await page.getByRole('button', { name: /clear/i }).first().click()
await expect(siteTypeFilter).toBeEmpty()
await page.getByRole('button', { name: 'Reset', exact: true }).click()
await expect(
page.getByText(fixtures.things.public.name, { exact: true })
).toBeVisible()
})
})
55 changes: 24 additions & 31 deletions apps/data-management/e2e/specs/sites.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, test } from '@playwright/test'
import { expect, test, type Page } from '@playwright/test'

import { authenticateSession } from '../support/auth'
import { fixtures, users } from '../support/fixtures'
Expand All @@ -8,6 +8,9 @@ import {
selectWorkspace,
} from '../support/ui'

const datastreamEntriesByName = (page: Page, name: string) =>
page.locator('[data-datastream-id]').filter({ hasText: name })

test.describe('sites and workspaces', () => {
const apiBaseUrl = process.env.E2E_API_BASE_URL || 'http://127.0.0.1:18000'
const sitePhotoPng = Buffer.from(
Expand Down Expand Up @@ -254,21 +257,18 @@ test.describe('sites and workspaces', () => {
.fill('Temporary datastream created by the Playwright CRUD suite.')
await page.getByRole('button', { name: 'Create datastream' }).click()

const datastreamRow = page
.locator('[data-datastream-id]')
.filter({ hasText: datastreamName })
.first()
const datastreamRow = datastreamEntriesByName(page, datastreamName).first()
await expect(datastreamRow).toBeVisible()

await datastreamRow.locator('[data-testid^="datastream-actions-"]').click()
await page.getByText('Edit datastream metadata').click()
await page.getByLabel('Datastream name *').fill(renamedDatastreamName)
await page.getByRole('button', { name: 'Update datastream' }).click()

const renamedDatastreamRow = page
.locator('[data-datastream-id]')
.filter({ hasText: renamedDatastreamName })
.first()
const renamedDatastreamRow = datastreamEntriesByName(
page,
renamedDatastreamName
).first()
await expect(renamedDatastreamRow).toBeVisible()

await renamedDatastreamRow
Expand All @@ -278,9 +278,7 @@ test.describe('sites and workspaces', () => {
await page.locator('input').last().fill('Delete')
await page.getByRole('button', { name: 'Confirm' }).click()
await expect(
page.locator('[data-datastream-id]').filter({
hasText: renamedDatastreamName,
})
datastreamEntriesByName(page, renamedDatastreamName)
).toHaveCount(0)

await page.getByTestId('delete-site-button').click()
Expand Down Expand Up @@ -363,9 +361,7 @@ test.describe('sites and workspaces', () => {
.toBe(true)
await anonymousPage.goto(`/sites/${fixtures.things.public.id}`)
await expect(
anonymousPage.locator('[data-datastream-id]').filter({
hasText: fixtures.datastreams.public.name,
})
datastreamEntriesByName(anonymousPage, fixtures.datastreams.public.name)
).toHaveCount(0)
await datastreamPrivacyToggle.click()
await expect
Expand Down Expand Up @@ -398,11 +394,10 @@ test.describe('sites and workspaces', () => {
})
.toBe(false)
await anonymousPage.goto(`/sites/${fixtures.things.public.id}`)
const anonymousPublicDatastreamRow = anonymousPage
.locator('[data-datastream-id]')
.filter({
hasText: fixtures.datastreams.public.name,
})
const anonymousPublicDatastreamRow = datastreamEntriesByName(
anonymousPage,
fixtures.datastreams.public.name
)
await expect(anonymousPublicDatastreamRow).toHaveCount(1)
await dataVisibilityToggle.click()
await expect
Expand All @@ -417,9 +412,7 @@ test.describe('sites and workspaces', () => {

await anonymousPage.goto(`/sites/${fixtures.things.public.id}`)
await expect(
anonymousPage.locator('[data-datastream-id]').filter({
hasText: fixtures.datastreams.public.name,
})
datastreamEntriesByName(anonymousPage, fixtures.datastreams.public.name)
).toHaveCount(1)

await anonymousContext.close()
Expand All @@ -431,10 +424,10 @@ test.describe('sites and workspaces', () => {
await authenticateSession(page, users.owner.email, users.owner.password)
await page.goto(`/sites/${fixtures.things.public.id}`)

const datastreamRow = page
.locator('[data-datastream-id]')
.filter({ hasText: fixtures.datastreams.public.name })
.first()
const datastreamRow = datastreamEntriesByName(
page,
fixtures.datastreams.public.name
).first()
await expect(datastreamRow).toBeVisible()

await datastreamRow
Expand Down Expand Up @@ -485,10 +478,10 @@ test.describe('sites and workspaces', () => {
await expect(page.getByText(fixtures.datastreams.public.name, { exact: true })).toBeVisible()

await page.goto(`/sites/${fixtures.things.public.id}`)
const datastreamRow = page
.locator('[data-datastream-id]')
.filter({ hasText: fixtures.datastreams.public.name })
.first()
const datastreamRow = datastreamEntriesByName(
page,
fixtures.datastreams.public.name
).first()
await datastreamRow
.locator('[data-testid^="datastream-actions-"]')
.click()
Expand Down
Loading
Loading