@@ -125,7 +125,7 @@ moduleTypes.forEach(({
125125 } )
126126
127127 context ( 'flaky test retries' , ( ) => {
128- it ( 'retries flaky tests' , async ( ) => {
128+ it ( 'retries flaky tests with object Cypress retries ' , async ( ) => {
129129 receiver . setSettings ( {
130130 itr_enabled : false ,
131131 code_coverage : false ,
@@ -232,6 +232,64 @@ moduleTypes.forEach(({
232232 ] )
233233 } )
234234
235+ over12It ( 'retries flaky tests' , async ( ) => {
236+ receiver . setSettings ( {
237+ itr_enabled : false ,
238+ code_coverage : false ,
239+ tests_skipping : false ,
240+ flaky_test_retries_enabled : true ,
241+ early_flake_detection : {
242+ enabled : false ,
243+ } ,
244+ } )
245+
246+ const envVars = getCiVisEvpProxyConfig ( receiver . port )
247+
248+ const specToRun = 'cypress/e2e/numeric-retries.cy.js'
249+
250+ childProcess = exec (
251+ version === 'latest' ? testCommand : `${ testCommand } --spec ${ specToRun } ` ,
252+ {
253+ cwd,
254+ env : {
255+ ...envVars ,
256+ CYPRESS_BASE_URL : webAppBaseUrl ,
257+ CYPRESS_RETRIES_AS_NUMBER : '0' ,
258+ SPEC_PATTERN : specToRun ,
259+ } ,
260+ }
261+ )
262+
263+ const receiverPromise = receiver
264+ . gatherPayloadsUntilChildExit (
265+ childProcess ,
266+ ( { url } ) => url . endsWith ( '/api/v2/citestcycle' ) ,
267+ payloads => {
268+ const events = payloads . flatMap ( ( { payload } ) => payload . events )
269+ const testSuites = events . filter ( event => event . type === 'test_suite_end' ) . map ( event => event . content )
270+ assert . strictEqual ( testSuites . length , 1 )
271+ assert . strictEqual ( testSuites [ 0 ] . meta [ TEST_STATUS ] , 'pass' )
272+
273+ const tests = events . filter ( event => event . type === 'test' ) . map ( event => event . content )
274+ assert . strictEqual ( tests . length , 3 )
275+
276+ const resource = 'cypress/e2e/numeric-retries.cy.js.numeric Cypress retries eventually passes'
277+ assert . deepStrictEqual ( tests . map ( test => test . resource ) , [ resource , resource , resource ] )
278+ assert . strictEqual ( tests [ 0 ] . meta [ TEST_STATUS ] , 'fail' )
279+ assert . strictEqual ( tests [ 1 ] . meta [ TEST_STATUS ] , 'fail' )
280+ assert . strictEqual ( tests [ 2 ] . meta [ TEST_STATUS ] , 'pass' )
281+ assert . strictEqual ( tests [ 1 ] . meta [ TEST_IS_RETRY ] , 'true' )
282+ assert . strictEqual ( tests [ 2 ] . meta [ TEST_IS_RETRY ] , 'true' )
283+ assert . strictEqual ( tests [ 1 ] . meta [ TEST_RETRY_REASON ] , TEST_RETRY_REASON_TYPES . atr )
284+ assert . strictEqual ( tests [ 2 ] . meta [ TEST_RETRY_REASON ] , TEST_RETRY_REASON_TYPES . atr )
285+ } , { hardTimeout : 30000 } )
286+
287+ await Promise . all ( [
288+ once ( childProcess , 'exit' ) ,
289+ receiverPromise ,
290+ ] )
291+ } )
292+
235293 it ( 'is disabled if DD_CIVISIBILITY_FLAKY_RETRY_ENABLED is false' , async ( ) => {
236294 receiver . setSettings ( {
237295 itr_enabled : false ,
0 commit comments