@@ -29,14 +29,14 @@ async function checkDataStructure(page, hasTitle, hasDescription, hasPrimaryKey,
29
29
}
30
30
if ( hasPrimaryKey ) {
31
31
// Click on make a part of primary key
32
- await page . click ( 'text=Mark a part of primary key ' ) ;
32
+ await page . click ( 'xpath=//*[@id="0"]/div[2]/div[1]/div[2]/label/div ' ) ;
33
33
}
34
-
35
34
if ( hasOptionalValue ) {
36
35
// Click on optional value
37
- await page . click ( 'text=Value can be optional ' ) ;
36
+ await page . click ( 'xpath=//*[@id="0"]/div[2]/div[2]/div[2]/label/div ' ) ;
38
37
}
39
38
39
+
40
40
if ( hasName ) {
41
41
// Fill in the name input
42
42
await page . locator ( 'input[id=name]' ) . fill ( hasName ) ;
@@ -110,9 +110,8 @@ async function checkDataStructure(page, hasTitle, hasDescription, hasPrimaryKey,
110
110
else if ( hasTitle && hasDescription && hasPrimaryKey && hasOptionalValue && hasName && hasTitleDescription && hasDataType && ! hasUnit ) {
111
111
await page . waitForLoadState ( 'load' ) ;
112
112
await page . waitForTimeout ( 1500 ) ;
113
- // Check if the save button is disabled and reload the page
114
- const saveButton = page . locator ( 'button#save' ) ;
115
- await expect ( saveButton ) . toBeDisabled ( ) ;
113
+ // Click on save button
114
+ await page . click ( '#save' ) ;
116
115
117
116
}
118
117
else if ( hasTitle && hasDescription && hasPrimaryKey && hasOptionalValue && hasName && hasTitleDescription && ! hasDataType && hasUnit ) {
@@ -121,6 +120,7 @@ async function checkDataStructure(page, hasTitle, hasDescription, hasPrimaryKey,
121
120
// Check if the save button is disabled and reload the page
122
121
const saveButton = page . locator ( 'button#save' ) ;
123
122
await expect ( saveButton ) . toBeDisabled ( ) ;
123
+
124
124
125
125
}
126
126
}
@@ -151,7 +151,7 @@ async function createDataStructure(page, titleName) {
151
151
await page . waitForTimeout ( 500 ) ;
152
152
153
153
// Click on make a part of primary key
154
- await page . click ( 'text=Mark a part of primary key ' ) ;
154
+ await page . click ( 'xpath=//*[@id="0"]/div[2]/div[1]/div[2]/label/div ' ) ;
155
155
156
156
// Fill in the name input
157
157
await page . locator ( 'input[id=name]' ) . fill ( titleName ) ;
@@ -266,10 +266,10 @@ async function checkConstraint(page) {
266
266
try {
267
267
// Check if the "TestConstraint" exists
268
268
await page . waitForSelector ( '.list-item .item:text("Test Constraint")' , { visible : true , timeout : 500 } ) ;
269
-
269
+
270
270
271
271
} catch ( error ) {
272
-
272
+
273
273
// Perform actions if the element is not found
274
274
// Click on the SVG element
275
275
await page . waitForSelector ( 'div.hidden:nth-child(4)' , { visible : true } ) ;
@@ -314,6 +314,7 @@ async function navDataStructure(page) {
314
314
await page . click ( 'text="Manage Data Structures"' ) ;
315
315
}
316
316
317
+
317
318
async function editDataStructure ( page ) {
318
319
319
320
// Wait for 500 milliseconds
@@ -322,25 +323,32 @@ async function editDataStructure(page) {
322
323
await page . waitForLoadState ( 'load' ) ;
323
324
await page . waitForTimeout ( 500 ) ;
324
325
326
+
325
327
// Fill in the title description textarea
326
328
await page . locator ( 'textarea[id=description]' ) . fill ( 'Edited test data structure' ) ;
327
329
328
330
// Wait for 500 milliseconds
329
331
await page . waitForTimeout ( 500 ) ;
330
332
331
- // Click on make a part of primary key
332
- await page . click ( 'text=Value can be optional' ) ;
333
+ // Click on optional value
334
+ await page . click ( 'xpath=//*[@id="0"]/div[2]/div[2]/div[2]/label/div' ) ;
335
+
336
+ // Click the on template data dropdown
337
+ await page . click ( '#variableTemplate' ) ;
338
+ await page . waitForTimeout ( 500 ) ;
339
+ const template = await page . waitForSelector ( '.list-item .item:text("percentage")' , { visible : true , enabled : true } ) ;
340
+ await template . click ( )
333
341
334
342
// Click the on data type dropdown
335
- await page . click ( 'div.value-container.svelte-u3g5ju > input.svelte-u3g5ju ' ) ;
343
+ await page . click ( '#dataType ' ) ;
336
344
await page . waitForTimeout ( 500 ) ;
337
345
const dataType = await page . waitForSelector ( '.list-item .item:text("number")' , { visible : true , enabled : true } ) ;
338
346
await dataType . click ( )
339
347
340
348
// Click the on unit dropdown
341
- await page . click ( 'div.value-container.svelte-u3g5ju > input #unit' ) ;
349
+ await page . click ( '#unit' ) ;
342
350
await page . waitForTimeout ( 500 ) ;
343
- const unit = await page . waitForSelector ( '.list-item .item:text("cm ")' , { visible : true , enabled : true } ) ;
351
+ const unit = await page . waitForSelector ( '.list-item .item:text("% ")' , { visible : true , enabled : true } ) ;
344
352
await unit . click ( )
345
353
await page . waitForTimeout ( 500 ) ;
346
354
@@ -374,6 +382,7 @@ async function findEditedDataStructure(page, dataStructure) {
374
382
) ;
375
383
}
376
384
385
+
377
386
module . exports = {
378
387
379
388
createDataStructure,
0 commit comments