Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a1555f1
fix(cypress): adjust task timeout and enhance logging for teardown pr…
martinjagodic Mar 5, 2026
3e8f9bc
Merge branch 'main' into cypress-teardown
yanthomasdev Mar 5, 2026
5f5cbb1
Apply suggestion from @yanthomasdev
martinjagodic Mar 6, 2026
75beb08
fix(cypress): enhance logging and improve API request timeouts in git…
martinjagodic Mar 6, 2026
0b1476a
fix(cypress): enhance logging for media upload and test setup processes
martinjagodic Mar 6, 2026
ff008ee
fix(cypress): adjust timeout settings and refine clock handling in tests
martinjagodic Mar 6, 2026
421a590
fix(cypress): remove unnecessary logging from uploadMediaFile and bef…
martinjagodic Mar 6, 2026
723b1ef
fix(cypress): remove unnecessary logging, fix format in media library…
martinjagodic Mar 6, 2026
b3052f3
fix(cypress): refactor API request handling and enhance logging in te…
martinjagodic Mar 6, 2026
d976e62
fix(cypress): streamline API calls by combining fetch functions
martinjagodic Mar 6, 2026
3dc3577
fix(cypress): increase retry delay in waitForDeploys function and imp…
martinjagodic Mar 6, 2026
a748cc1
fix(cypress): optimize element selection by using aliases
martinjagodic Mar 6, 2026
cb3ab69
fix(cypress): enhance logging for better traceability during tests an…
martinjagodic Mar 6, 2026
c804cbb
fix(cypress): enhance logging in test lifecycle hooks and improve err…
martinjagodic Mar 9, 2026
17b2a48
fix(cypress): improve logging during media file upload and enhance er…
martinjagodic Mar 9, 2026
a005532
fix(cypress): streamline logging in media library and login functions…
martinjagodic Mar 9, 2026
d679f64
fix(cypress): reduce logging in beforeEach and remove unnecessary log…
martinjagodic Mar 9, 2026
08cde46
fix(gitGateway): make fetchWithTimeout handle full URLs, remove wrapp…
martinjagodic Mar 9, 2026
b220729
fix(cypress): enhance logging in media library tests and utility func…
martinjagodic Mar 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
env:
CI_BUILD_ID: ${{ github.run_id }}-${{ github.run_attempt }}
IS_FORK: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true || github.repository_owner != 'decaporg' }}
# Only used for fork PRs (can't access CYPRESS_RECORD_KEY)
MACHINE_INDEX: ${{ matrix.machine }}
MACHINE_COUNT: 4
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
Expand Down
4 changes: 1 addition & 3 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ import { defineConfig } from 'cypress';
export default defineConfig({
projectId: '1c35bs',
retries: {
runMode: 2, // Reduced from 4 - Cypress Cloud helps identify flaky tests
runMode: 2,
openMode: 0,
},
e2e: {
video: false,
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
return require('./cypress/plugins/index.js')(on, config);
Expand Down
10 changes: 9 additions & 1 deletion cypress/e2e/common/media_library.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,22 @@ function assertGridEntryImage(entry) {

export default function({ entries, getUser }) {
beforeEach(() => {
login(getUser && getUser());
console.log('[media_library.beforeEach] START');
const user = getUser && getUser();
console.log('[media_library.beforeEach] user=', user ? JSON.stringify(user) : 'none');
login(user);
console.log('[media_library.beforeEach] login() returned');
});

it('can upload image from global media library', () => {
console.log('[TEST] can upload image from global media library - START');
goToMediaLibrary();
console.log('[TEST] goToMediaLibrary() completed');
uploadMediaFile();
console.log('[TEST] uploadMediaFile() completed');
matchImageSnapshot();
closeMediaLibrary();
console.log('[TEST] can upload image from global media library - END');
});

it('can delete image from global media library', () => {
Expand Down
54 changes: 40 additions & 14 deletions cypress/e2e/common/spec_utils.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,63 @@
export const before = (taskResult, options, backend) => {
Cypress.config('taskTimeout', 7 * 60 * 1000);
export function before(taskResult, options, backend) {
console.log(`[spec_utils.before] START backend=${backend}`);
Cypress.config('taskTimeout', 5 * 60 * 1000); // 5 minutes
cy.task('setupBackend', { backend, options }).then(data => {
console.log('[spec_utils.before] setupBackend completed, data=', data);
taskResult.data = data;
Cypress.config('defaultCommandTimeout', data.mockResponses ? 5 * 1000 : 1 * 60 * 1000);
console.log(`[spec_utils.before] COMPLETE mockResponses=${data.mockResponses} timeout=${data.mockResponses ? 5000 : 60000}ms`);
});
};
}

export const after = (taskResult, backend) => {
export function after(taskResult, backend) {
console.log(`[spec_utils.after] START backend=${backend}`);
cy.task('teardownBackend', {
backend,
...taskResult.data,
}).then(() => {
console.log('[spec_utils.after] COMPLETE');
});
};
}

export const beforeEach = (taskResult, backend) => {
export function beforeEach(taskResult, backend) {
const spec = Cypress.mocha.getRunner().suite.ctx.currentTest.parent.title;
const testName = Cypress.mocha.getRunner().suite.ctx.currentTest.title;

console.log(`[spec_utils.beforeEach] START backend=${backend} spec="${spec}" test="${testName}"`);
console.log(`[spec_utils.beforeEach] mockResponses=${taskResult.data.mockResponses}`);
console.log(`[spec_utils.beforeEach] user=`, JSON.stringify(taskResult.data.user || {}));

cy.task('setupBackendTest', {
backend,
...taskResult.data,
spec,
testName,
}).then(() => {
console.log('[spec_utils.beforeEach] setupBackendTest completed');
});

if (taskResult.data.mockResponses) {
const fixture = `${spec}__${testName}.json`;
console.log('loading fixture:', fixture);
cy.stubFetch({ fixture });
console.log(`[spec_utils.beforeEach] Loading fixture: ${fixture}`);
cy.stubFetch({ fixture }).then(() => {
console.log('[spec_utils.beforeEach] stubFetch completed');
});
} else {
console.log('[spec_utils.beforeEach] WARNING: mockResponses is false/undefined - no fixture loaded');
}

return cy.clock(0, ['Date']);
};
// cy.clock(0, ['Date']) was hanging git-gateway tests after page load
// Hypothesis: freezing time to 0 breaks app initialization during cy.visit()
// Temporary fix: skip cy.clock for git-gateway, use default clock for others
if (backend !== 'git-gateway') {
console.log('[spec_utils.beforeEach] Setting clock to epoch 0');
return cy.clock(0, ['Date']);
}

export const afterEach = (taskResult, backend) => {
console.log('[spec_utils.beforeEach] COMPLETE - skipped clock for git-gateway');
}

export function afterEach(taskResult, backend) {
const spec = Cypress.mocha.getRunner().suite.ctx.currentTest.parent.title;
const testName = Cypress.mocha.getRunner().suite.ctx.currentTest.title;

Expand All @@ -51,15 +76,16 @@ export const afterEach = (taskResult, backend) => {
},
},
} = Cypress.mocha.getRunner();

if (state === 'failed' && retries === currentRetry) {
Cypress.runner.stop();
}
}
};
}

export const seedRepo = (taskResult, backend) => {
export function seedRepo(taskResult, backend) {
cy.task('seedRepo', {
backend,
...taskResult.data,
});
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,33 @@ const backend = 'git-gateway';
const provider = 'gitlab';

describe('Git Gateway (GitLab) Backend Media Library - Large Media', () => {
let taskResult = { data: {} };
const taskResult = { data: {} };

before(() => {
console.log('[SPEC before] START');
specUtils.before(taskResult, { publish_mode: 'editorial_workflow', provider }, backend);
console.log('[SPEC before] COMPLETE, taskResult.data=', taskResult.data);
});

after(() => {
console.log('[SPEC after] START');
specUtils.after(taskResult, backend);
console.log('[SPEC after] COMPLETE');
});

beforeEach(() => {
console.log('[SPEC beforeEach] START, taskResult.data=', taskResult.data);
specUtils.beforeEach(taskResult, backend);
console.log('[SPEC beforeEach] COMPLETE');
});

afterEach(() => {
console.log('[SPEC afterEach] START');
specUtils.afterEach(taskResult, backend);
console.log('[SPEC afterEach] COMPLETE');
});

console.log('[SPEC] About to call fixture()');
fixture({ entries: [entry1], getUser: () => taskResult.data.user });
console.log('[SPEC] fixture() returned');
});
Loading