@@ -277,7 +277,7 @@ async function editVariable(page) {
277
277
await page . waitForSelector ( '.toast[data-testid=toast] .text-base' ) ;
278
278
const toast = await page . locator ( '.toast[data-testid=toast]' ) ;
279
279
280
- let expectedMessage = 'Variable Template created .' ;
280
+ let expectedMessage = 'Variable Template updated .' ;
281
281
await expect ( await toast . locator ( '.text-base' ) ) . toHaveText ( expectedMessage ) ;
282
282
await toast . locator ( 'button' ) . click ( ) ; // Close the toast
283
283
await page . reload ( ) ;
@@ -304,11 +304,37 @@ async function deleteVariable(page) {
304
304
305
305
}
306
306
307
+ async function findEditedVariable ( page , variable ) {
308
+ // await page.reload()
309
+ await page . waitForLoadState ( 'load' ) ;
310
+ // Wait for 500 milliseconds
311
+ await page . waitForTimeout ( 500 ) ;
312
+ // Search for the variable
313
+ await page . locator ( '#VariableTemplates-search' ) . fill ( variable ) ;
314
+ // Wait for 1000 milliseconds
315
+ await page . waitForTimeout ( 1000 ) ;
316
+ // Click on the Search button
317
+ await page . click ( 'form.flex > button:nth-child(2)' ) ;
318
+ // Locate the correct row
319
+ const row = page . locator ( '[id^=VariableTemplates-row-]' ) ;
320
+ await expect ( row ) . toHaveCount ( 1 ) ;
321
+ // Get the index of the row
322
+ const id = ( await row . getAttribute ( 'id' ) ) ;
323
+ const index = id . split ( '-' ) [ 2 ] ;
324
+ // Check values for the row
325
+ await expect ( page . locator ( `#VariableTemplates-name-${ index } ` ) ) . toHaveText ( variable ) ;
326
+ await expect ( page . locator ( `#VariableTemplates-description-${ index } ` ) ) . toHaveText (
327
+ 'Test Edit Variable'
328
+ ) ;
329
+ }
330
+
331
+
307
332
module . exports = {
308
333
checkVariables,
309
334
deleteVariable,
310
335
createVariable,
311
336
findVariable,
312
337
editVariable,
338
+ findEditedVariable
313
339
} ;
314
340
0 commit comments