|
5 | 5 | * |
6 | 6 | * Copyright Oxide Computer Company |
7 | 7 | */ |
8 | | -import { expectVisible, test } from './utils' |
| 8 | +import { clickRowAction, expect, expectRowVisible, expectVisible, test } from './utils' |
| 9 | + |
| 10 | +test('List disks and snapshot', async ({ page }) => { |
| 11 | + await page.goto('/projects/mock-project/disks') |
| 12 | + |
| 13 | + const table = page.getByRole('table') |
| 14 | + await expect(table.getByRole('row')).toHaveCount(12) // 11 + header |
| 15 | + |
| 16 | + // check one attached and one not attached |
| 17 | + await expectRowVisible(table, { |
| 18 | + 'Attached To': 'db1', |
| 19 | + Disk: 'disk-1', |
| 20 | + Size: '2 GiB', |
| 21 | + status: 'attached', |
| 22 | + }) |
| 23 | + await expectRowVisible(table, { |
| 24 | + 'Attached To': '', |
| 25 | + Disk: 'disk-3', |
| 26 | + Size: '6 GiB', |
| 27 | + status: 'detached', |
| 28 | + }) |
| 29 | + |
| 30 | + await clickRowAction(page, 'disk-1 db1', 'Snapshot') |
| 31 | + await expect(page.getByText("Creating snapshot of disk 'disk-1'").nth(0)).toBeVisible() |
| 32 | + await expect(page.getByText('Snapshot successfully created').nth(0)).toBeVisible() |
| 33 | +}) |
| 34 | + |
| 35 | +test('Disk snapshot error', async ({ page }) => { |
| 36 | + await page.goto('/projects/mock-project/disks') |
| 37 | + |
| 38 | + // special disk that triggers snapshot error |
| 39 | + await clickRowAction(page, 'disk-snapshot-error', 'Snapshot') |
| 40 | + await expect( |
| 41 | + page.getByText("Creating snapshot of disk 'disk-snapshot-error'").nth(0) |
| 42 | + ).toBeVisible() |
| 43 | + await expect(page.getByText('Failed to create snapshot').nth(0)).toBeVisible() |
| 44 | + await expect(page.getByText('Cannot snapshot disk').nth(0)).toBeVisible() |
| 45 | +}) |
9 | 46 |
|
10 | 47 | test.describe('Disk create', () => { |
11 | 48 | test.beforeEach(async ({ page }) => { |
|
0 commit comments