WP-11: contract and failing tests for package upgrades
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
19
frontend/e2e/upgrade.spec.ts
Normal file
19
frontend/e2e/upgrade.spec.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { test, expect } from '@playwright/test'
|
||||
|
||||
test('admin updates a selected package and sees the live log', async ({ page }) => {
|
||||
await page.goto('/login')
|
||||
await page.getByLabel('Email').fill('admin@example.com')
|
||||
await page.getByLabel('Password').fill('admin-password-123')
|
||||
await page.getByRole('button', { name: 'Sign in' }).click()
|
||||
await page.getByRole('link', { name: 'Updates' }).click()
|
||||
await page.getByRole('button', { name: 'Refresh inventory' }).click()
|
||||
await expect(page.getByTestId('os-name')).toContainText('Debian', { timeout: 15_000 })
|
||||
|
||||
const row = page.getByRole('row', { name: /openssl/ })
|
||||
await row.getByRole('checkbox').check()
|
||||
await page.getByRole('button', { name: 'Update selected (1)' }).click()
|
||||
await page.getByRole('button', { name: 'Confirm update' }).click()
|
||||
await expect(page.getByTestId('upgrade-log')).toContainText('openssl', { timeout: 15_000 })
|
||||
await expect(page.getByTestId('upgrade-log')).toContainText('Setting up', { timeout: 15_000 })
|
||||
await expect(page.getByText('Update finished')).toBeVisible({ timeout: 15_000 })
|
||||
})
|
||||
@ -35,3 +35,15 @@ describe('PackageTable', () => {
|
||||
expect(rows(w)[0]).toContain('microk8s')
|
||||
})
|
||||
})
|
||||
|
||||
describe('PackageTable selection', () => {
|
||||
it('lets the user select upgradable packages and emits the names', async () => {
|
||||
const w = mount(PackageTable, { props: { packages: pkgs, selectable: true } })
|
||||
const boxes = w.findAll('input[name=select]')
|
||||
expect(boxes).toHaveLength(2) // only upgradable rows get a checkbox
|
||||
await boxes[0].setValue(true)
|
||||
expect(w.emitted('update:selected')!.at(-1)![0]).toEqual(['openssl'])
|
||||
await boxes[1].setValue(true)
|
||||
expect(w.emitted('update:selected')!.at(-1)![0]).toEqual(['openssl', 'curl'])
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user