@@ -49,17 +49,17 @@ async function checkPatternConstraint(page, constraint, hasDescription, hasPatte
49
49
}
50
50
51
51
// Handling different conditions based on parameters
52
- if ( ! constraint && ! hasDescription && hasPatternType ) {
52
+ if ( ! constraint && ! hasDescription && hasPatternType && ! hasExpInput ) {
53
53
await page . waitForLoadState ( 'load' ) ;
54
54
await page . waitForTimeout ( 1500 ) ;
55
55
// Check if the save button is disabled and reload the page
56
56
const saveButton = page . locator ( 'button#save' ) ;
57
57
await expect ( saveButton ) . toBeDisabled ( ) ;
58
- await page . reload ( )
58
+ await page . reload ( ) ;
59
59
// Set the value
60
60
handler . constraintDelete = true ;
61
61
}
62
- else if ( constraint && ! hasDescription && hasPatternType ) {
62
+ else if ( constraint && ! hasDescription && hasPatternType && ! hasExpInput ) {
63
63
await page . waitForLoadState ( 'load' ) ;
64
64
await page . waitForTimeout ( 1500 ) ;
65
65
// Check if the save button is disabled and reload the page
@@ -79,7 +79,7 @@ async function checkPatternConstraint(page, constraint, hasDescription, hasPatte
79
79
// Set the value
80
80
handler . constraintDelete = true ;
81
81
}
82
- else if ( constraint && hasDescription && hasPatternType ) {
82
+ else if ( constraint && hasDescription && hasPatternType && ! hasExpInput ) {
83
83
await page . waitForLoadState ( 'load' ) ;
84
84
await page . waitForTimeout ( 1500 ) ;
85
85
// Click on save button and wait for toast message
@@ -101,12 +101,18 @@ async function checkPatternConstraint(page, constraint, hasDescription, hasPatte
101
101
else if ( ! constraint && ! hasDescription && hasPatternType && hasExpInput ) {
102
102
await page . waitForLoadState ( 'load' ) ;
103
103
await page . waitForTimeout ( 1500 ) ;
104
- // Check if the save button is disabled and reload the page
105
- const saveButton = page . locator ( 'button#save' ) ;
106
- await expect ( saveButton ) . toBeDisabled ( ) ;
107
- await page . reload ( ) ;
104
+ // Click on save button and wait for toast message
105
+ await page . click ( '#save' ) ;
108
106
// Set the value
107
+ await page . waitForSelector ( '.toast[data-testid=toast] .text-base' ) ;
108
+ const toast = await page . locator ( '.toast[data-testid=toast]' ) ;
109
+ let expectedMessage = "Can't save Constraint \"null\" .Name is Null or Empty" ;
110
+
111
+ await expect ( await toast . locator ( '.text-base' ) ) . toHaveText ( expectedMessage ) ;
112
+ await toast . locator ( 'button' ) . click ( ) ; // Close the toast
109
113
handler . constraintDelete = true ;
114
+ await page . reload ( ) ;
115
+
110
116
}
111
117
}
112
118
@@ -172,7 +178,7 @@ async function editPatternDescription(page, constraint) {
172
178
await page
173
179
. locator ( 'textarea[id=description]' )
174
180
. fill ( 'Test constraint edited' ) ;
175
- // Wait for 500 milliseconds
181
+ // Wait for 500 milliseconds
176
182
await page . waitForTimeout ( 500 ) ;
177
183
await page . locator ( 'input[id=name]' ) . fill ( constraint ) ;
178
184
await page . locator ( 'textarea[id=description]' ) . fill ( 'Test edited pattern constraint' ) ;
0 commit comments