-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplugin-form-dimensional_scalar.spec.ts
More file actions
102 lines (97 loc) · 4.08 KB
/
plugin-form-dimensional_scalar.spec.ts
File metadata and controls
102 lines (97 loc) · 4.08 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
100
101
102
import { expect, test } from '@playwright/test'
test('Dimensional scalar', async ({ page }) => {
const navigate = async () => {
await page.goto('http://localhost:3000/')
await page.getByRole('button', { name: 'DemoDataSource' }).click()
await page.getByRole('button', { name: 'plugins' }).click()
await page.getByTestId('tree-button_form').click()
await page.getByRole('button', { name: 'dimensional_scalar' }).click()
await page.getByRole('button', { name: 'waveForm' }).click()
}
await test.step('Open plugin', async () => {
await navigate()
await expect(page.getByText('significantWaveHeight (config)')).toBeVisible()
await expect(page.getByText('Minimum Hs')).toBeVisible()
await expect(page.getByRole('button', { name: 'Submit' })).toBeVisible()
})
await test.step('Edit values', async () => {
await page
.getByTestId('significantWaveHeight')
.getByRole('spinbutton')
.fill('2500')
await page
.getByTestId('minimumWaveHeight')
.getByRole('spinbutton')
.fill('1.9')
await page
.getByTestId('maximumWaveHeight')
.getByRole('spinbutton')
.fill('10.1')
await page.getByTestId('medianWaveHeight').getByRole('spinbutton').fill('5')
await page.getByTestId('number').getByRole('spinbutton').fill('25')
await page.getByRole('textbox').fill('1 mile')
await page.getByRole('button', { name: 'Submit' }).click()
await navigate()
await expect(
page.getByTestId('significantWaveHeight').getByRole('spinbutton')
).toHaveValue('2500')
await expect(
page.getByTestId('minimumWaveHeight').getByRole('spinbutton')
).toHaveValue('1.9')
await expect(
page.getByTestId('maximumWaveHeight').getByRole('spinbutton')
).toHaveValue('10.1')
await expect(
page.getByTestId('medianWaveHeight').getByRole('spinbutton')
).toHaveValue('5')
await expect(
page.getByTestId('number').getByRole('spinbutton')
).toHaveValue('25')
await expect(page.getByRole('textbox')).toHaveValue('1 mile')
})
await test.step('Edit where config overrides', async () => {
await page
.getByRole('button', { name: 'file significantWaveHeight' })
.click()
await expect(page.getByRole('code')).toBeVisible()
await page.getByRole('button', { name: 'edit Edit' }).click()
await page
.getByLabel('label (optional)')
.fill('Should not show as config overrides')
await page.getByRole('button', { name: 'Submit' }).click()
await expect(page.getByRole('alert')).not.toBeVisible()
await page.getByRole('button', { name: 'waveForm' }).click()
await expect(page.getByText('significantWaveHeight (config)')).toBeVisible()
await expect(
page.getByText('Should not show as config overrides')
).not.toBeVisible()
await page.getByRole('button', { name: 'waveForm' }).click()
await page
.getByRole('button', { name: 'file significantWaveHeight' })
.click()
await page.getByRole('button', { name: 'edit Edit' }).click()
await expect(page.getByLabel('label (optional)')).toHaveValue(
'Should not show as config overrides'
)
})
await test.step('Edit without any override', async () => {
await page.getByRole('button', { name: 'file maximumWaveHeight' }).click()
await expect(page.getByRole('code')).toBeVisible()
await page.getByRole('button', { name: 'edit Edit' }).click()
await page.getByLabel('value').fill('88888')
await page.getByLabel('label (optional)').fill('New Maximum')
await page.getByLabel('unit (optional)').fill('€')
await page.getByRole('button', { name: 'Submit' }).click()
await expect(page.getByRole('alert')).not.toBeVisible()
await page.getByRole('button', { name: 'waveForm' }).click()
await expect(
page.getByTestId('maximumWaveHeight').getByRole('spinbutton')
).toHaveValue('88888')
await expect(
page.getByTestId('maximumWaveHeight').getByRole('paragraph').first()
).toContainText('New Maximum')
await expect(
page.getByTestId('maximumWaveHeight').locator('span').locator('span')
).toContainText('€')
})
})