@@ -98,23 +98,33 @@ Then I expect '$object' to match schema '$schema'
9898You can also use validations in custom steps
9999
100100<Tabs >
101- <TabItem value = " js" label = " JavaScript" default >
101+ <TabItem value = " js" label = " JavaScript" >
102102 ``` javascript
103- const { Then } = require (' @cucumber/cucumber ' );
103+ const { Then } = require (' @qavajs/core ' );
104104 const { getValidation } = require (' @qavajs/validation' );
105105
106+ Then (' I expect the answer {validation} {string}' , async function (validate , expected ) {
107+ const answer = ' 42' ;
108+ validate (answer, expected);
109+ });
110+
106111 Then (' I expect the answer {} {string}' , async function (validationType , expected ) {
107112 const answer = ' 42' ;
108113 const validate = getValidation (validationType);
109114 validate (answer, expected);
110115 });
111116 ```
112117 </TabItem >
113- <TabItem value = " ts" label = " TypeScript" >
118+ <TabItem value = " ts" label = " TypeScript" default >
114119 ``` typescript
115- import { Then } from ' @cucumber/cucumber ' ;
120+ import { Then } from ' @qavajs/core ' ;
116121 import { getValidation } from ' @qavajs/validation' ;
117122
123+ Then (' I expect the answer {validation} {string}' , async function (validate : Validation , expected : string ) {
124+ const answer = ' 42' ;
125+ validate (answer , expected );
126+ });
127+
118128 Then (' I expect the answer {} {string}' , async function (validationType : string , expected : string ) {
119129 const answer = ' 42' ;
120130 const validate = getValidation (validationType );
@@ -128,23 +138,33 @@ You can also use validations in custom steps
128138Validation with auto-retries
129139
130140<Tabs >
131- <TabItem value = " js" label = " JavaScript" default >
141+ <TabItem value = " js" label = " JavaScript" >
132142 ``` javascript
133- const { Then } = require (' @cucumber/cucumber ' );
143+ const { Then } = require (' @qavajs/core ' );
134144 const { getPollValidation } = require (' @qavajs/validation' );
135145
146+ Then (' I expect the answer {validation} {string}' , async function (validate , expected ) {
147+ const answer = getAnswer ();
148+ await validate .poll (answer, expected, { timeout: 2000 , interval: 500 });
149+ });
150+
136151 Then (' I expect the answer {} {string}' , async function (validationType , expected ) {
137152 const answer = getAnswer ();
138153 const validate = getPollValidation (validationType);
139154 await validate (getAnswer, expected, { timeout: 2000 , interval: 500 });
140155 });
141156 ```
142157 </TabItem >
143- <TabItem value = " ts" label = " TypeScript" >
158+ <TabItem value = " ts" label = " TypeScript" default >
144159 ``` typescript
145- import { Then } from ' @cucumber/cucumber ' ;
160+ import { Then } from ' @qavajs/core ' ;
146161 import { getPollValidation } from ' @qavajs/validation' ;
147162
163+ Then (' I expect the answer {validation} {string}' , async function (validate : Validation , expected : string ) {
164+ const answer = getAnswer ();
165+ await validate .poll (answer , expected );
166+ });
167+
148168 Then (' I expect the answer {} {string}' , async function (validationType : string , expected : string ) {
149169 const answer = getAnswer ();
150170 const validate = getPollValidation (validationType );
0 commit comments