-
Notifications
You must be signed in to change notification settings - Fork 12
/
floating-ip-update.e2e.ts
59 lines (53 loc) · 2.05 KB
/
floating-ip-update.e2e.ts
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
/*
* 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)
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`)
})
// 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`)
})