Skip to content

fix(ui-tests): resolve two flaky onboarding Cypress test failures#7718

Draft
Copilot wants to merge 1 commit into
masterfrom
copilot/fix-ui-tests-onboarding
Draft

fix(ui-tests): resolve two flaky onboarding Cypress test failures#7718
Copilot wants to merge 1 commit into
masterfrom
copilot/fix-ui-tests-onboarding

Conversation

Copilot AI commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Tests 3 and 5 of the onboarding suite were failing intermittently due to two independent race conditions — one involving the write-batcher leaking data across tests, the other a timing gap in the populator progress-bar check.

Test 3 — datatable-datapoints-sessions-0 contains non-zero value

Root cause: Countly's write-batcher (10 s flush interval) accumulates server_stats_data_points increments during test 2 (Entertainment demo). A single cy.dropMongoDatabase() in beforeEach drops the DB, but the in-flight batch flushes milliseconds later into the freshly-recreated database. By the time test 3 reaches the data-points page, all-apps.sessions is non-zero. Compounding the issue, el-table-column fixed="left" causes Element UI to render an extra shadow panel, producing two <span> elements with the same data-test-id; Cypress asserts on their combined text.

Fix: Drop the database twice in beforeEach, separated by a ~12 s wait, so any write-batcher flush that occurs after the first drop lands in already-dropped storage and the second drop clears it:

beforeEach(function() {
    cy.dropMongoDatabase();
    cy.wait(12000);         // let write-batcher flush into the dropped DB
    cy.dropMongoDatabase(); // wipe leaked data
    navigationHelpers.goToLoginPage();
});

Test 5 — geo countries total-sessions h2 doesn't contain "1000"

Root cause: checkPopulatorProgressBar() calls cy.elementExists() — a synchronous DOM lookup with zero retry timeout. If the progress bar hasn't appeared yet (app-creation API call still in flight when the check fires), isExists === false and the entire 120 s wait is silently skipped. The test then proceeds while the server is still processing populator sessions, so the aggregated geo total is < 1000.

Fix: Remove the conditional existence check and always wait for the bar to appear first, then wait for it to disappear:

const checkPopulatorProgressBar = () => {
    cy.get(`[data-test-id="${initialSetupPageElements.DATA_POP_PROGRESS_BAR}"]`, { timeout: 30000 })
        .should('exist');
    cy.get(`[data-test-id="${initialSetupPageElements.DATA_POP_PROGRESS_BAR}"]`, { timeout: 120000 })
        .should('not.exist');
};

Copilot AI changed the title [WIP] Fix failing GitHub Actions job ui-tests (onboarding) fix(ui-tests): resolve two flaky onboarding Cypress test failures Jun 12, 2026
Copilot AI requested a review from can-angun June 12, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants