-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathDisk.spec.ts
More file actions
242 lines (199 loc) · 7.14 KB
/
Disk.spec.ts
File metadata and controls
242 lines (199 loc) · 7.14 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
import * as fsPromises from 'fs/promises';
import * as path from 'path';
import { expect } from '@playwright/test';
import { v4 as uuidv4 } from 'uuid';
import { test } from '../fixtures/cleanup';
import { exportedDiskBP } from '../fixtures/data/exportBlueprintContents';
import { isHosted } from '../helpers/helpers';
import { ensureAuthenticated } from '../helpers/login';
import {
fillInImageOutput,
ibFrame,
navigateToLandingPage,
} from '../helpers/navHelpers';
import {
createBlueprint,
deleteBlueprint,
exportBlueprint,
fillInDetails,
fillInImageOutputGuest,
importBlueprint,
registerLater,
verifyExportedBlueprint,
} from '../helpers/wizardHelpers';
test('Create a blueprint with Disk customization', async ({
page,
cleanup,
}) => {
const blueprintName = 'test-' + uuidv4();
// Delete the blueprint after the run fixture
cleanup.add(() => deleteBlueprint(page, blueprintName));
await ensureAuthenticated(page);
// Login, navigate to IB and get the frame
await navigateToLandingPage(page);
const frame = ibFrame(page);
await test.step('Navigate to optional steps in Wizard', async () => {
await fillInImageOutput(frame);
await registerLater(frame);
});
await test.step('Check basic structure of advanced partitioning', async () => {
await frame
.getByRole('button', { name: 'File system configuration' })
.click();
await frame
.getByRole('radio', { name: 'Advanced disk partitioning' })
.click();
await expect(
frame.getByRole('checkbox', {
name: /Select partitioning mode/i,
}),
).toBeHidden();
await expect(
frame.getByRole('button', {
name: /add plain partition/i,
}),
).toBeVisible();
await expect(
frame.getByRole('button', {
name: /add lvm volume group/i,
}),
).toBeVisible();
});
await test.step('Fill in some partitions and add a volume group', async () => {
await frame.getByRole('button', { name: 'Add plain partition' }).click();
await frame
.getByRole('gridcell', { name: '/home' })
.getByPlaceholder('Define mount point')
.fill('/var/usb');
await frame.getByPlaceholder('Define minimum size').nth(1).fill('10');
await frame.getByRole('button', { name: 'GiB' }).nth(1).click();
await frame.getByRole('option', { name: 'KiB' }).click();
await frame.getByRole('button', { name: 'Add LVM volume group' }).click();
await expect(
frame.getByRole('row').nth(1).getByRole('button').nth(2),
).toBeEnabled();
await frame
.getByRole('textbox', { name: 'Volume group name input' })
.fill('vg-name');
await frame
.getByRole('textbox', { name: 'minimum partition size' })
.nth(1)
.fill('10');
await frame.getByRole('button', { name: 'GiB' }).nth(1).click();
await frame.getByRole('option', { name: 'KiB' }).click();
await frame
.getByRole('textbox', { name: 'Partition name input' })
.fill('lv1');
await frame.getByRole('button', { name: 'Add logical volume' }).click();
await frame
.getByRole('gridcell', { name: /\/home/ })
.getByPlaceholder('Define mount point')
.fill('/tmp/usb');
await frame
.getByRole('row', {
name: '/tmp/usb xfs 1 GiB',
})
.getByRole('textbox', { name: 'Partition name input' })
.fill('lv2');
await frame
.getByRole('row', {
name: 'lv2 /tmp/usb xfs 1 GiB',
})
.getByPlaceholder('Define minimum size')
.fill('10');
await frame.getByRole('button', { name: 'GiB' }).nth(1).click();
await frame.getByRole('option', { name: 'KiB' }).click();
});
await test.step('Fill the BP details', async () => {
await frame.getByRole('button', { name: 'Review and finish' }).click();
await fillInDetails(frame, blueprintName);
});
await test.step('Create BP', async () => {
await createBlueprint(frame, blueprintName);
});
await test.step('Edit BP', async () => {
await frame.getByRole('button', { name: 'Edit blueprint' }).click();
await frame.getByLabel('Revisit File system configuration step').click();
const removeRootButton = frame
.getByRole('row')
.nth(1)
.getByRole('button')
.nth(2);
await expect(removeRootButton).toBeEnabled();
const secondRow = frame.getByRole('row').nth(2);
const removeTmpButton = secondRow.getByRole('button').nth(2);
await expect(removeTmpButton).toBeEnabled();
await expect(
secondRow
.getByRole('gridcell', { name: '/var/usb' })
.getByPlaceholder('Define mount point'),
).toBeVisible();
await secondRow
.getByRole('gridcell', { name: '10', exact: true })
.getByPlaceholder('Define minimum size')
.fill('5');
await secondRow
.getByRole('gridcell', { name: '/var/usb' })
.getByPlaceholder('Define mount point')
.fill('/srv/data');
await secondRow.getByRole('button', { name: 'KiB' }).click();
await frame.getByRole('option', { name: 'MiB' }).click();
await frame
.getByRole('textbox', { name: 'Volume group name input' })
.fill('vg-edited-name');
await frame
.getByRole('textbox', { name: 'Partition name input' })
.nth(1)
.fill('lv2-edited');
await frame.getByRole('button', { name: 'xfs' }).nth(1).click();
await frame.getByRole('option', { name: 'ext4' }).click();
await frame.getByRole('button', { name: 'Review and finish' }).click();
await frame
.getByRole('button', { name: 'Save changes to blueprint' })
.click();
});
let exportedBP = '';
await test.step('Export BP', async () => {
exportedBP = await exportBlueprint(page);
cleanup.add(async () => {
await fsPromises.rm(path.dirname(exportedBP), { recursive: true });
});
});
await test.step('Review exported BP', async (step) => {
step.skip(
isHosted(),
'Only verify the contents of the exported blueprint in cockpit',
);
verifyExportedBlueprint(exportedBP, exportedDiskBP(blueprintName));
});
await test.step('Import BP', async () => {
await importBlueprint(frame, exportedBP);
});
await test.step('Review imported BP', async () => {
await fillInImageOutputGuest(frame);
await frame
.getByRole('button', { name: 'File system configuration' })
.click();
const removeRootButton = frame
.getByRole('row')
.nth(1)
.getByRole('button')
.nth(2);
await expect(removeRootButton).toBeEnabled();
const secondRow = frame.getByRole('row').nth(2);
const removeTmpButton = secondRow.getByRole('button').nth(2);
await expect(removeTmpButton).toBeEnabled();
await expect(
secondRow
.getByRole('gridcell', { name: '/srv/data' })
.getByPlaceholder('Define mount point'),
).toBeVisible();
const size = secondRow.getByPlaceholder('Define minimum size');
await expect(size).toHaveValue('5');
const typeButton = secondRow.getByRole('button', { name: 'ext4' });
await expect(typeButton).toBeVisible();
const unitButton = secondRow.getByRole('button', { name: 'MiB' });
await expect(unitButton).toBeVisible();
await frame.getByRole('button', { name: 'Cancel' }).click();
});
});