Skip to content

fix: add timeout and navigation wait for account creation test#135

Open
circleci-app[bot] wants to merge 2 commits intomainfrom
circleci/fix-flaky-test-1762383238027
Open

fix: add timeout and navigation wait for account creation test#135
circleci-app[bot] wants to merge 2 commits intomainfrom
circleci/fix-flaky-test-1762383238027

Conversation

@circleci-app
Copy link

@circleci-app circleci-app bot commented Nov 5, 2025

Chunk™ has come up with the following:

  • Root cause: The test "User can create account redirected to home" was failing due to a race condition where cy.url().should('include', '/home') executed before navigation completed after account creation. The createAccount command submitted the signup form but didn't wait for the backend signup process or redirect to finish, causing intermittent failures depending on server response times.

  • Proposed fix: Added explicit 10-second timeout to the URL assertion in create.cy.js:95 and added a navigation completion wait in the createAccount command in commands.js:62 that waits for the URL to change from /signup, ensuring the signup process completes before subsequent assertions.

  • Verification: Unable to run verification tests, so confidence in this fix is limited. Go to Chunk settings to set up a .circleci/cci-agent-setup.yml file to ensure tests can be executed in subsequent runs. Read more in our docs Chunk™ also triggered a CI pipeline to check for other regressions.

Previous CI run where test flaked

More Details

View more about this proposed fix in the CircleCI web app →

Chunk™ Feedback

Want to give feedback to make these PRs better? Click here →

## Chunk™ has come up with the following:
- **Root cause:** The test "User can create account redirected to home" was failing due to a race condition where `cy.url().should('include', '/home')` executed before navigation completed after account creation. The `createAccount` command submitted the signup form but didn't wait for the backend signup process or redirect to finish, causing intermittent failures depending on server response times.

- **Proposed fix:** Added explicit 10-second timeout to the URL assertion in `create.cy.js:95` and added a navigation completion wait in the `createAccount` command in `commands.js:62` that waits for the URL to change from `/signup`, ensuring the signup process completes before subsequent assertions.


- **Verification:** Unable to run verification tests, so confidence in this fix is limited. Go to [Chunk settings](https://app.circleci.com/settings/organization/gh/AwesomeCICD/agents) to set up a `.circleci/cci-agent-setup.yml` file to ensure tests can be executed in subsequent runs. Read more in our [docs](https://discuss.circleci.com/t/product-launch-chunk-tasks-fixing-flaky-tests/53975/3#p-107197-unable-to-run-verification-tests-10)
**Root cause:** The `createAccount` Cypress command always waited for the URL to change away from `/signup`, which caused tests that expected to stay on the signup page (e.g., validation failure tests) to fail.

**Fix approach:** Modified the `createAccount` command to accept an optional `options` parameter with a `waitForNavigation` flag. When set to `false`, the command skips the URL change assertion, allowing tests for invalid form submissions to properly verify that the page stays on `/signup`.

**Changes made:**
- Updated `createAccount` command in `cypress/support/commands.js` to accept an optional `options` parameter
- Added conditional logic to only wait for navigation when `waitForNavigation !== false`
- Updated two test suites in `cypress/e2e/create.cy.js` to pass `{ waitForNavigation: false }` for invalid signup scenarios:
  - "Signup is unsuccessful with 16 character username"
  - "Signup is unsuccessful with non-alphanumeric username"
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.

0 participants