-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathfloating-ip-update.e2e.ts
More file actions
74 lines (66 loc) · 2.76 KB
/
Copy pathfloating-ip-update.e2e.ts
File metadata and controls
74 lines (66 loc) · 2.76 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
/*
* 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 {
clickRowAction,
expect,
expectRowVisible,
expectToast,
expectVisible,
test,
} from './utils'
const floatingIpsPage = '/projects/mock-project/floating-ips'
const originalName = 'cola-float'
const updatedName = 'updated-cola-float'
const updatedDescription = 'An updated description for this Floating IP'
const expectedFormElements = [
'role=heading[name*="Edit floating IP"]',
'role=textbox[name="Name"]',
'role=textbox[name="Description"]',
'role=button[name="Update floating IP"]',
]
test('can update a floating IP', async ({ page }) => {
await page.goto(floatingIpsPage)
await clickRowAction(page, 'cola-float', 'Edit')
await expectVisible(page, expectedFormElements)
// Properties table should show resolved instance and pool names
const dialog = page.getByRole('dialog')
await expect(dialog.getByText('ip-pool-1')).toBeVisible()
// IP pool cells inside side modals should not open nested side modals
await expect(dialog.getByRole('button', { name: 'ip-pool-1' })).toBeHidden()
// cola-float is attached to db1
await expect(dialog.getByRole('link', { name: 'db1' })).toBeVisible()
await page.fill('input[name=name]', updatedName)
await page.getByRole('textbox', { name: 'Description' }).fill(updatedDescription)
await page.getByRole('button', { name: 'Update floating IP' }).click()
await expect(page).toHaveURL(floatingIpsPage)
await expectRowVisible(page.getByRole('table'), {
name: updatedName,
description: updatedDescription,
})
await expectToast(page, `Floating IP ${updatedName} updated`)
})
test('clicking the name opens the edit side modal', async ({ page }) => {
await page.goto(floatingIpsPage)
await page.getByRole('link', { name: originalName }).click()
await expect(page).toHaveURL(`${floatingIpsPage}/${originalName}/edit`)
await expectVisible(page, expectedFormElements)
})
// Make sure that it still works even if the name doesn't change
test('can update *just* the floating IP description', async ({ page }) => {
// Go to the edit page for the original floating IP
await page.goto(`${floatingIpsPage}/${originalName}/edit`)
await expectVisible(page, expectedFormElements)
await page.getByRole('textbox', { name: 'Description' }).fill(updatedDescription)
await page.getByRole('button', { name: 'Update floating IP' }).click()
await expect(page).toHaveURL(floatingIpsPage)
await expectRowVisible(page.getByRole('table'), {
name: originalName,
description: updatedDescription,
})
await expectToast(page, `Floating IP ${originalName} updated`)
})