1- import { Then } from '@cucumber/cucumber' ;
2- import { getValue , getElement , getConditionWait } from './transformers' ;
3- import { getValidation } from '@qavajs/validation' ;
1+ import { Then } from '@cucumber/cucumber' ;
2+ import { getValue , getElement , getConditionWait } from './transformers' ;
3+ import { getValidation } from '@qavajs/validation' ;
44
55/**
66 * Verify element condition
3131 const element = await getElement ( alias ) ;
3232 const validation = getValidation ( validationType ) ;
3333 const elementText : string = await element . innerText ( ) ;
34+ this . log ( `AR: ${ elementText } ` ) ;
35+ this . log ( `ER: ${ expectedValue } ` ) ;
3436 validation ( elementText , expectedValue ) ;
3537 }
3638) ;
5254 const element = await getElement ( alias ) ;
5355 const validation = getValidation ( validationType ) ;
5456 const actualValue = await element . evaluate ( ( node : any , propertyName : string ) => node [ propertyName ] , propertyName ) ;
57+ this . log ( `AR: ${ actualValue } ` ) ;
58+ this . log ( `ER: ${ expectedValue } ` ) ;
5559 validation ( actualValue , expectedValue ) ;
5660 }
5761) ;
7276 const element = await getElement ( alias ) ;
7377 const validation = getValidation ( validationType ) ;
7478 const actualValue = await element . getAttribute ( attributeName ) ;
79+ this . log ( `AR: ${ actualValue } ` ) ;
80+ this . log ( `ER: ${ expectedValue } ` ) ;
7581 validation ( actualValue , expectedValue ) ;
7682 }
7783) ;
8995 const validation = getValidation ( validationType ) ;
9096 const expectedUrl = await getValue ( expected ) ;
9197 const actualUrl = page . url ( ) ;
98+ this . log ( `AR: ${ actualUrl } ` ) ;
99+ this . log ( `ER: ${ expectedUrl } ` ) ;
92100 validation ( actualUrl , expectedUrl ) ;
93101 }
94102) ;
@@ -108,7 +116,10 @@ Then(
108116 const expectedValue = await getValue ( value ) ;
109117 const collection = await getElement ( alias ) ;
110118 const validation = getValidation ( validationType ) ;
111- validation ( await collection . count ( ) , expectedValue ) ;
119+ const actualCount = await collection . count ( ) ;
120+ this . log ( `AR: ${ actualCount } ` ) ;
121+ this . log ( `ER: ${ expectedValue } ` ) ;
122+ validation ( actualCount , expectedValue ) ;
112123 }
113124) ;
114125
@@ -124,6 +135,8 @@ Then(
124135 const validation = getValidation ( validationType ) ;
125136 const expectedTitle = await getValue ( expected ) ;
126137 const actualTitle = await page . title ( ) ;
138+ this . log ( `AR: ${ actualTitle } ` ) ;
139+ this . log ( `ER: ${ expectedTitle } ` ) ;
127140 validation ( actualTitle , expectedTitle ) ;
128141 }
129142) ;
@@ -211,6 +224,8 @@ Then(
211224 ( node : Element , propertyName : string ) => getComputedStyle ( node ) . getPropertyValue ( propertyName ) ,
212225 propertyName
213226 ) ;
227+ this . log ( `AR: ${ actualValue } ` ) ;
228+ this . log ( `ER: ${ expectedValue } ` ) ;
214229 validation ( actualValue , expectedValue ) ;
215230 }
216231) ;
@@ -222,10 +237,13 @@ Then(
222237 * @example I expect text of alert does not contain 'coffee'
223238 */
224239Then ( 'I expect text of alert {playwrightValidation} {string}' , async function ( validationType : string , expectedValue : string ) {
225- const alertText = await new Promise < string > ( resolve => page . once ( 'dialog' , async ( dialog ) => {
226- resolve ( dialog . message ( ) ) ;
227- } ) ) ;
228- const validation = getValidation ( validationType ) ;
229- validation ( alertText , expectedValue ) ;
240+ const alertText = await new Promise < string > ( resolve => page . once ( 'dialog' , async ( dialog ) => {
241+ resolve ( dialog . message ( ) ) ;
242+ } ) ) ;
243+ const expected = await getValue ( expectedValue ) ;
244+ const validation = getValidation ( validationType ) ;
245+ this . log ( `AR: ${ alertText } ` ) ;
246+ this . log ( `ER: ${ expected } ` ) ;
247+ validation ( alertText , expectedValue ) ;
230248 }
231249) ;
0 commit comments