Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component test do not wait for initial compilation using Electron #1031

Closed
ekrapfl opened this issue Sep 14, 2023 · 4 comments
Closed

Component test do not wait for initial compilation using Electron #1031

ekrapfl opened this issue Sep 14, 2023 · 4 comments

Comments

@ekrapfl
Copy link

ekrapfl commented Sep 14, 2023

I am hookup up a GitHub Action to run my Cypress component tests for Angular. I started out using the default browser (electron), and I found that my tests would run fine, but the first test kept telling me that it had timed out.

The build output would look something like this:
image

Followed by all of the Angular compilation output:
image

...
image

And then all subsequent tests would pass.

I racked my brain for quite a while on this, and then finally, I tried simply switching to chrome. To my surprise, it worked. Every time, it seems to work with chrome, but fail with electron. The difference appears to be that with chrome, it waits until Angular compilation is done before attempting to see if the first test timed out.

Chrome output:
image

...
image

This seems like a bug to me. With component tests for Angular, chrome waits for the Angular compilation to finish before starting the test timeout timer. Electron does not.

Full step being used:

- name: Cypress.io
  uses: cypress-io/github-action@v6
  with:
    record: true
    component: true
    config-file: cypress.config.ts
    # These tests fail when run on electron.
    # They time out for at least the first test due to Angular compilation.
    # Chrome seems to understand to not start timing the test until after Angular compilation has completed.
    browser: chrome
    ci-build-id: ${{ needs.prepare.outputs.uuid }}
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
    CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
    NODE_OPTIONS: --max_old_space_size=9500
    TZ: 'America/Chicago'
@MikeMcC399
Copy link
Collaborator

@ekrapfl

The problem you describe will not be influenced by github-action, since the only relevant steps it takes is to convert the parameters you gave it into inline parameters to call Cypress.

You did not say which version of Cypress you are using. If it is not Cypress 13.2.0 you may like to try with this, currently latest, version. The Changelog shows that a new version of Electron was bundled.

I would guess that the reason for Chrome resulting in a better outcome than Electron, would be that Electron is bundled into Cypress whereas Chrome is not, so starting Chrome would cause some delay in comparison.

@ekrapfl
Copy link
Author

ekrapfl commented Sep 19, 2023

We were on 12.x, but we just upgraded to 13.2. I will give it a shot with the new version and let you know.

@ekrapfl
Copy link
Author

ekrapfl commented Sep 19, 2023

Great call. You are absolutely right. After the upgrade, the tests run in Electron with no issue 🤯

Thanks for pointing that out! I would not have thought to go back and try again just because of the Cypress upgrade.

@ekrapfl ekrapfl closed this as completed Sep 19, 2023
@MikeMcC399
Copy link
Collaborator

@ekrapfl

Good to hear that you issue is resolved! The Electron update has resolved some other issues as well where it wasn't immediately obvious that would be the case.

Thanks for the update and closing the case!

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

No branches or pull requests

2 participants