Aligns seeded and test login addresses with production branding while keeping admin@bilhalsning.se for local docker admin seed only. - Change test@bilhalsning.se to test@bilhej.se in dev migration and all tests
51 lines
No EOL
1.7 KiB
TypeScript
51 lines
No EOL
1.7 KiB
TypeScript
import { test, expect } from '@playwright/test'
|
|
|
|
test.describe('Vehicle lookup', () => {
|
|
test('enters plate and sees vehicle info with CTA button', async ({
|
|
page,
|
|
}) => {
|
|
await page.goto('/')
|
|
|
|
await page.getByPlaceholder('ABC 123').fill('HDO732')
|
|
await page.getByPlaceholder('ABC 123').press('Enter')
|
|
|
|
await expect(page.getByText(/Peugeot 107 1\.0/)).toBeVisible({
|
|
timeout: 15_000,
|
|
})
|
|
await expect(page.getByText('2011').first()).toBeVisible()
|
|
await expect(page.getByText(/Gul/)).toBeVisible()
|
|
await expect(page.getByText(/Bensin/)).toBeVisible()
|
|
|
|
const cta = page.getByRole('link', { name: 'Fortsätt till brevet' })
|
|
await expect(cta).toBeVisible()
|
|
await expect(cta).toHaveAttribute('href', '/compose?plate=HDO732')
|
|
})
|
|
|
|
test('shows not found for unknown plate', async ({ page }) => {
|
|
await page.goto('/')
|
|
|
|
await page.getByPlaceholder('ABC 123').fill('ZZZ999')
|
|
await page.getByPlaceholder('ABC 123').press('Enter')
|
|
|
|
await expect(
|
|
page.getByText('Inget fordon hittades'),
|
|
).toBeVisible({ timeout: 15_000 })
|
|
})
|
|
|
|
test('CTA navigates to compose when authenticated', async ({ page }) => {
|
|
await page.goto('/logga-in')
|
|
await page.getByLabel('E-postadress').fill('test@bilhej.se')
|
|
await page.getByLabel('Lösenord').fill('test1234')
|
|
await page.getByRole('button', { name: 'Logga in' }).click()
|
|
await page.waitForURL('/')
|
|
|
|
await page.getByPlaceholder('ABC 123').fill('HDO732')
|
|
await page.getByPlaceholder('ABC 123').press('Enter')
|
|
|
|
const cta = page.getByRole('link', { name: 'Fortsätt till brevet' })
|
|
await expect(cta).toBeVisible({ timeout: 15_000 })
|
|
await cta.click()
|
|
|
|
await expect(page).toHaveURL('/compose?plate=HDO732')
|
|
})
|
|
}) |