Skip to content

Commit

Permalink
Add test for whitespace trimming
Browse files Browse the repository at this point in the history
  • Loading branch information
charliepark committed Oct 23, 2024
1 parent 0deccf3 commit 05e9fc8
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions test/e2e/floating-ip-create.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ test('can create a floating IP', async ({ page }) => {

const floatingIpName = 'my-floating-ip'
await page.fill('input[name=name]', floatingIpName)
await page
.getByRole('textbox', { name: 'Description' })
.fill('A description for this Floating IP')
const description = page.getByRole('textbox', { name: 'Description' })
await description.fill('A description for this Floating IP')

const poolListbox = page.getByRole('button', { name: 'IP pool' })

Expand All @@ -51,6 +50,20 @@ test('can create a floating IP', async ({ page }) => {
description: 'A description for this Floating IP',
'IP pool': 'ip-pool-1',
})

// Make sure that descriptions with only whitespace get trimmed
await page.locator('text="New Floating IP"').click()
await page.fill('input[name=name]', 'no-description')
await description.fill(' ')
await description.blur()
await expect(description).toContainText('')
await page.getByRole('button', { name: 'Create floating IP' }).click()

await expectRowVisible(page.getByRole('table'), {
name: 'no-description',
description: '—',
'IP pool': 'ip-pool-1',
})
})

test('can detach and attach a floating IP', async ({ page }) => {
Expand Down

0 comments on commit 05e9fc8

Please sign in to comment.