-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathinventory.e2e.ts
More file actions
99 lines (85 loc) · 2.99 KB
/
inventory.e2e.ts
File metadata and controls
99 lines (85 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* Copyright Oxide Computer Company
*/
import { physicalDisks, sleds } from '@oxide/api-mocks'
import { expect, expectRowVisible, expectVisible, test } from './utils'
test('Sled inventory page', async ({ page }) => {
await page.goto('/system/inventory/sleds')
await expectVisible(page, ['role=heading[name*="Inventory"]'])
const sledsTab = page.getByRole('tab', { name: 'Sleds' })
await expect(sledsTab).toBeVisible()
await expect(sledsTab).toHaveClass(/is-selected/)
const sledsTable = page.getByRole('table')
// expectRowVisible currently only looks at the last header row in case of
// grouping, hence the slightly weird column names
await expectRowVisible(sledsTable, {
id: sleds[0].id,
'serial number': sleds[0].baseboard.serial,
Kind: 'In service',
'Provision policy': 'Provisionable',
state: 'active',
})
await expectRowVisible(sledsTable, {
id: sleds[1].id,
'serial number': sleds[1].baseboard.serial,
Kind: 'In service',
'Provision policy': 'Not provisionable',
state: 'active',
})
await expectRowVisible(sledsTable, {
id: sleds[2].id,
'serial number': sleds[2].baseboard.serial,
Kind: 'Expunged',
'Provision policy': '—',
state: 'active',
})
await expectRowVisible(sledsTable, {
id: sleds[3].id,
'serial number': sleds[3].baseboard.serial,
Kind: 'Expunged',
'Provision policy': '—',
state: 'decommissioned',
})
// Visit the sled detail page of the first sled
await sledsTable.getByRole('link').first().click()
await expectVisible(page, ['role=heading[name*="Sled"]'])
await expect(page.getByText('serialBRM02222869')).toBeVisible()
const instancesTab = page.getByRole('tab', { name: 'Instances' })
await expect(instancesTab).toBeVisible()
await expect(instancesTab).toHaveClass(/is-selected/)
const instancesTable = page.getByRole('table')
await expectRowVisible(instancesTable, {
name: 'maze-war / mock-projectdb1',
})
})
test('Disk inventory page', async ({ page }) => {
await page.goto('/system/inventory/disks')
await expectVisible(page, ['role=heading[name*="Inventory"]'])
const disksTab = page.getByRole('tab', { name: 'Disks' })
await expect(disksTab).toBeVisible()
await expect(disksTab).toHaveClass(/is-selected/)
const table = page.getByRole('table')
await expectRowVisible(table, { id: physicalDisks[0].id, 'Form factor': 'U.2' })
await expectRowVisible(table, {
id: physicalDisks[3].id,
'Form factor': 'M.2',
policy: 'in service',
state: 'active',
})
await expectRowVisible(table, {
id: physicalDisks[4].id,
'Form factor': 'M.2',
policy: 'expunged',
state: 'active',
})
await expectRowVisible(table, {
id: physicalDisks[5].id,
'Form factor': 'M.2',
policy: 'expunged',
state: 'decommissioned',
})
})