@@ -86,10 +86,7 @@ test('Disabled actions', async ({ page }) => {
8686})
8787
8888test('Attach disk', async ({ page }) => {
89- await page.goto('/projects/mock-project/instances/db1')
90-
91- // Have to stop instance to edit disks
92- await stopInstance(page)
89+ await page.goto('/projects/mock-project/instances/db-stopped')
9390
9491 // Attach existing disk form
9592 await page.click('role=button[name="Attach existing disk"]')
@@ -100,8 +97,8 @@ test('Attach disk', async ({ page }) => {
10097 await expectVisible(page, ['role=dialog >> text="Disk name is required"'])
10198
10299 await page.getByRole('combobox', { name: 'Disk name' }).click()
103- // disk-1 is already attached, so should not be visible in the list
104- await expectNotVisible(page, ['role=option[name="disk-1 "]'])
100+ // disk-stopped-boot is already attached, so should not be visible in the list
101+ await expectNotVisible(page, ['role=option[name="disk-stopped-boot "]'])
105102 await expectVisible(page, ['role=option[name="disk-3"]', 'role=option[name="disk-4"]'])
106103 await page.click('role=option[name="disk-3"]')
107104
@@ -110,14 +107,11 @@ test('Attach disk', async ({ page }) => {
110107})
111108
112109test('Create disk', async ({ page }) => {
113- await page.goto('/projects/mock-project/instances/db1 ')
110+ await page.goto('/projects/mock-project/instances/db-stopped ')
114111
115112 const row = page.getByRole('cell', { name: 'created-disk' })
116113 await expect(row).toBeHidden()
117114
118- // Have to stop instance to edit disks
119- await stopInstance(page)
120-
121115 // New disk form
122116 const createForm = page.getByRole('dialog', { name: 'Create disk' })
123117 await expect(createForm).toBeHidden()
@@ -138,17 +132,14 @@ test('Create disk', async ({ page }) => {
138132})
139133
140134test('Detach disk', async ({ page }) => {
141- await page.goto('/projects/mock-project/instances/db1 ')
135+ await page.goto('/projects/mock-project/instances/db-stopped ')
142136
143- // Have to stop instance to edit disks
144- await stopInstance(page)
145-
146- const successMsg = page.getByText('Disk disk-2 detached').first()
147- const row = page.getByRole('row', { name: 'disk-2' })
137+ const successMsg = page.getByText('Disk disk-stopped-data detached').first()
138+ const row = page.getByRole('row', { name: 'disk-stopped-data' })
148139 await expect(row).toBeVisible()
149140 await expect(successMsg).toBeHidden()
150141
151- await clickRowAction(page, 'disk-2 ', 'Detach')
142+ await clickRowAction(page, 'disk-stopped-data ', 'Detach')
152143 await page.getByRole('button', { name: 'Confirm' }).click()
153144 await expect(successMsg).toBeVisible()
154145 await expect(row).toBeHidden() // disk row goes away
@@ -176,9 +167,7 @@ test('Snapshot disk', async ({ page }) => {
176167})
177168
178169test('Attach disk error clears when modal closes', async ({ page }) => {
179- await page.goto('/projects/mock-project/instances/db1')
180-
181- await stopInstance(page)
170+ await page.goto('/projects/mock-project/instances/db-stopped')
182171
183172 // Attach disks until we hit the limit
184173 const disksToAttach = [
@@ -244,62 +233,59 @@ test('Attach disk error clears when modal closes', async ({ page }) => {
244233})
245234
246235test('Change boot disk', async ({ page }) => {
247- await page.goto('/projects/mock-project/instances/db1 ')
236+ await page.goto('/projects/mock-project/instances/db-stopped ')
248237
249- // assert disk-1 is boot disk, disk-2 also there
250238 const bootDiskTable = page.getByRole('table', { name: 'Boot disk' })
251239 const otherDisksTable = page.getByRole('table', { name: 'Additional disks' })
252240 const confirm = page.getByRole('button', { name: 'Confirm' })
253241 const noBootDisk = page.getByText('No boot disk set')
254242 const noOtherDisks = page.getByText('No other disks')
255243
256- const disk1 = { Disk: 'disk-1', size: '2 GiB' }
257- const disk2 = { Disk: 'disk-2', size: '4 GiB' }
258-
259- await expectRowVisible(bootDiskTable, disk1)
260- await expectRowVisible(otherDisksTable, disk2)
244+ const bootDisk = { Disk: 'disk-stopped-boot', size: '2 GiB' }
245+ const dataDisk = { Disk: 'disk-stopped-data', size: '4 GiB' }
261246
262- await stopInstance(page)
247+ await expectRowVisible(bootDiskTable, bootDisk)
248+ await expectRowVisible(otherDisksTable, dataDisk)
263249
264- // Set disk-2 as boot disk
265- await clickRowAction(page, 'disk-2 ', 'Set as boot disk')
250+ // Set disk-stopped-data as boot disk
251+ await clickRowAction(page, 'disk-stopped-data ', 'Set as boot disk')
266252 await confirm.click()
267253
268- await expectRowVisible(bootDiskTable, disk2 )
269- await expectRowVisible(otherDisksTable, disk1 )
254+ await expectRowVisible(bootDiskTable, dataDisk )
255+ await expectRowVisible(otherDisksTable, bootDisk )
270256
271257 // Unset boot disk
272258 await expect(noBootDisk).toBeHidden()
273259
274- await clickRowAction(page, 'disk-2 ', 'Unset as boot disk')
260+ await clickRowAction(page, 'disk-stopped-data ', 'Unset as boot disk')
275261 await confirm.click()
276262
277263 await expect(noBootDisk).toBeVisible()
278- await expectRowVisible(otherDisksTable, disk1 )
279- await expectRowVisible(otherDisksTable, disk2 )
264+ await expectRowVisible(otherDisksTable, bootDisk )
265+ await expectRowVisible(otherDisksTable, dataDisk )
280266
281267 await expect(page.getByText('Setting a boot disk is recommended')).toBeVisible()
282268
283269 // detach disk so there's only one
284- await clickRowAction(page, 'disk-2 ', 'Detach')
270+ await clickRowAction(page, 'disk-stopped-data ', 'Detach')
285271 await page.getByRole('button', { name: 'Confirm' }).click()
286272
287- await expect(page.getByText('Instance will boot from disk-1 ')).toBeVisible()
273+ await expect(page.getByText('Instance will boot from disk-stopped-boot ')).toBeVisible()
288274
289- // set disk-1 back as boot disk
290- await clickRowAction(page, 'disk-1 ', 'Set as boot disk')
275+ // set disk-stopped-boot back as boot disk
276+ await clickRowAction(page, 'disk-stopped-boot ', 'Set as boot disk')
291277 await confirm.click()
292278
293279 await expect(noBootDisk).toBeHidden()
294280 await expect(noOtherDisks).toBeVisible()
295281
296- // Remove disk-1 altogether, no disks left
297- await clickRowAction(page, 'disk-1 ', 'Unset as boot disk')
282+ // Remove disk-stopped-boot altogether, no disks left
283+ await clickRowAction(page, 'disk-stopped-boot ', 'Unset as boot disk')
298284 await confirm.click()
299285
300- await expectRowVisible(otherDisksTable, disk1 )
286+ await expectRowVisible(otherDisksTable, bootDisk )
301287
302- await clickRowAction(page, 'disk-1 ', 'Detach')
288+ await clickRowAction(page, 'disk-stopped-boot ', 'Detach')
303289 await page.getByRole('button', { name: 'Confirm' }).click()
304290
305291 await expect(noBootDisk).toBeVisible()
0 commit comments