1- export const before = ( taskResult , options , backend ) => {
2- Cypress . config ( 'taskTimeout' , 7 * 60 * 1000 ) ;
1+ export function before ( taskResult , options , backend ) {
2+ console . log ( `[spec_utils.before] START backend=${ backend } ` ) ;
3+ Cypress . config ( 'taskTimeout' , 5 * 60 * 1000 ) ; // 5 minutes
34 cy . task ( 'setupBackend' , { backend, options } ) . then ( data => {
5+ console . log ( '[spec_utils.before] setupBackend completed, data=' , data ) ;
46 taskResult . data = data ;
57 Cypress . config ( 'defaultCommandTimeout' , data . mockResponses ? 5 * 1000 : 1 * 60 * 1000 ) ;
8+ console . log ( `[spec_utils.before] COMPLETE mockResponses=${ data . mockResponses } timeout=${ data . mockResponses ? 5000 : 60000 } ms` ) ;
69 } ) ;
7- } ;
10+ }
811
9- export const after = ( taskResult , backend ) => {
12+ export function after ( taskResult , backend ) {
13+ console . log ( `[spec_utils.after] START backend=${ backend } ` ) ;
1014 cy . task ( 'teardownBackend' , {
1115 backend,
1216 ...taskResult . data ,
17+ } ) . then ( ( ) => {
18+ console . log ( '[spec_utils.after] COMPLETE' ) ;
1319 } ) ;
14- } ;
20+ }
1521
16- export const beforeEach = ( taskResult , backend ) => {
22+ export function beforeEach ( taskResult , backend ) {
1723 const spec = Cypress . mocha . getRunner ( ) . suite . ctx . currentTest . parent . title ;
1824 const testName = Cypress . mocha . getRunner ( ) . suite . ctx . currentTest . title ;
25+
26+ console . log ( `[spec_utils.beforeEach] START backend=${ backend } spec="${ spec } " test="${ testName } "` ) ;
27+ console . log ( `[spec_utils.beforeEach] mockResponses=${ taskResult . data . mockResponses } ` ) ;
28+ console . log ( `[spec_utils.beforeEach] user=` , JSON . stringify ( taskResult . data . user || { } ) ) ;
29+
1930 cy . task ( 'setupBackendTest' , {
2031 backend,
2132 ...taskResult . data ,
2233 spec,
2334 testName,
35+ } ) . then ( ( ) => {
36+ console . log ( '[spec_utils.beforeEach] setupBackendTest completed' ) ;
2437 } ) ;
2538
2639 if ( taskResult . data . mockResponses ) {
2740 const fixture = `${ spec } __${ testName } .json` ;
28- console . log ( 'loading fixture:' , fixture ) ;
29- cy . stubFetch ( { fixture } ) ;
41+ console . log ( `[spec_utils.beforeEach] Loading fixture: ${ fixture } ` ) ;
42+ cy . stubFetch ( { fixture } ) . then ( ( ) => {
43+ console . log ( '[spec_utils.beforeEach] stubFetch completed' ) ;
44+ } ) ;
45+ } else {
46+ console . log ( '[spec_utils.beforeEach] WARNING: mockResponses is false/undefined - no fixture loaded' ) ;
3047 }
3148
32- return cy . clock ( 0 , [ 'Date' ] ) ;
33- } ;
49+ // cy.clock(0, ['Date']) was hanging git-gateway tests after page load
50+ // Hypothesis: freezing time to 0 breaks app initialization during cy.visit()
51+ // Temporary fix: skip cy.clock for git-gateway, use default clock for others
52+ if ( backend !== 'git-gateway' ) {
53+ console . log ( '[spec_utils.beforeEach] Setting clock to epoch 0' ) ;
54+ return cy . clock ( 0 , [ 'Date' ] ) ;
55+ }
3456
35- export const afterEach = ( taskResult , backend ) => {
57+ console . log ( '[spec_utils.beforeEach] COMPLETE - skipped clock for git-gateway' ) ;
58+ }
59+
60+ export function afterEach ( taskResult , backend ) {
3661 const spec = Cypress . mocha . getRunner ( ) . suite . ctx . currentTest . parent . title ;
3762 const testName = Cypress . mocha . getRunner ( ) . suite . ctx . currentTest . title ;
3863
@@ -51,15 +76,16 @@ export const afterEach = (taskResult, backend) => {
5176 } ,
5277 } ,
5378 } = Cypress . mocha . getRunner ( ) ;
79+
5480 if ( state === 'failed' && retries === currentRetry ) {
5581 Cypress . runner . stop ( ) ;
5682 }
5783 }
58- } ;
84+ }
5985
60- export const seedRepo = ( taskResult , backend ) => {
86+ export function seedRepo ( taskResult , backend ) {
6187 cy . task ( 'seedRepo' , {
6288 backend,
6389 ...taskResult . data ,
6490 } ) ;
65- } ;
91+ }
0 commit comments