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

fix: Detect CT framework when unconfigured project opened with --component #26306

Merged
merged 6 commits into from
Mar 31, 2023

Conversation

mike-plummer
Copy link
Contributor

Additional details

The onboarding wizard automatically detects your CT framework and bundler when advancing from the testing type selection screen, but if you open the launchpad directly into CT using the --component flag this logic was being bypassed. This PR performs the necessary wizard initialization if a testing type is already selected when open mode is being set up.

Steps to test

  1. Create a new project without any CT config
    npm create vite@latest
    choose React, remaining options can be anything
    npm i in project dir to install dependencies.
  2. Using current production, open the project: npx cypress open --component --project <project dir>
  3. Observe that launchpad opens to the "Project setup" screen and no framework is auto-selected
  4. Close Cypress, checkout this branch
  5. Using this branch, reopen the project: yarn dev --component --project <project dir>
  6. Observe that launchpad auto-populates the framework and bundler fields with React + Vite

How has the user experience changed?

Before
Screenshot 2023-03-30 at 8 54 05 AM

After
Screenshot 2023-03-30 at 9 12 24 AM

PR Tasks

@cypress
Copy link

cypress bot commented Mar 30, 2023

3 flaky tests on run #45163 ↗︎

0 5121 74 0 Flakiness 3

Details:

Merge branch 'develop' into mikep/22777-detect-ct-framework
Project: cypress Commit: 3d6acc61b2
Status: Passed Duration: 14:07 💡
Started: Mar 31, 2023 3:33 PM Ended: Mar 31, 2023 3:47 PM
Flakiness  cypress/e2e/cypress/cypress.cy.js • 3 flaky tests • 5x-driver-electron

View Output Video

Test Artifacts
... > correctly returns currentRetry Output Video
... > correctly returns currentRetry Output Video
... > correctly returns currentRetry Output Video

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@warrensplayer warrensplayer requested review from marktnoonan and a team and removed request for marktnoonan March 30, 2023 15:07
Copy link
Contributor

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, won't block on merging, but if there's a quick refactor to be had, it sure would be nice to do it 💯

packages/data-context/src/data/ProjectLifecycleManager.ts Outdated Show resolved Hide resolved
@lmiller1990 lmiller1990 requested a review from a team March 31, 2023 00:04
@ryanthemanuel ryanthemanuel changed the title fix: Detect CT framework when unconfigured project opened with --component fix: Detect CT framework when unconfigured project opened with `--component Mar 31, 2023
@ryanthemanuel ryanthemanuel changed the title fix: Detect CT framework when unconfigured project opened with `--component fix: Detect CT framework when unconfigured project opened with --component Mar 31, 2023
@marktnoonan
Copy link
Contributor

marktnoonan commented Mar 31, 2023

This doesn't seem to be working for me with the project I tried, I'll test with a fresh react project like in the description, but let me know if my expectations are off in this loom?

Update: I might have hit a strange cache issue where yarn dev does not load up to date code sometimes, because it's working now...

@marktnoonan
Copy link
Contributor

marktnoonan commented Mar 31, 2023

It works great when following the test steps in the issue description, I'm gonna try a fresh vue3-vite-ts project.

Screenshot 2023-03-31 at 1 53 28 PM

Fresh project was fine too...

Screenshot 2023-03-31 at 1 56 36 PM

Interesting that in the loom we do detect things by going out and back in 🤔

@mike-plummer
Copy link
Contributor Author

@marktnoonan Very interesting. That happens every time with that specific project? Anything interesting pop in debug logs? I did notice one situation where the detection wouldn't work if the config file was invalid or otherwise couldn't be resolved correctly, but that typically caused other problems that were more noticeable.

@marktnoonan
Copy link
Contributor

marktnoonan commented Mar 31, 2023

@mike-plummer I'll follow up in Slack, I updated this comment with a link to the same exact project working correctly, I think maybe it's an issue with yarn dev.

@marktnoonan
Copy link
Contributor

I had already approved when I noticed I could actually consistently get this to not work on one project: loom

Commands:

yarn gulp open --dev --component --project ../bug-reproductions/vite-detect/vue3-vite-ts -- this is a fresh vite project just like the "steps to test" say but for Vue. This always works.

yarn gulp open --dev --component --project ../cypress-component-testing-apps/vue3-vite-ts -- this always fails, but can detect when you hit "back" and open CT again. This is using https://github.com/cypress-io/cypress-component-testing-apps/tree/main/vue3-vite-ts with CT config commented out.

Will see if I can capture useful logs.

@marktnoonan
Copy link
Contributor

In the bad state the detection is actually fine, it's the UI not updating. If I refresh the launchpad I see the frameworks. So it's something where the gql reactivity is not working as expected?

Before refresh:
Screenshot 2023-03-31 at 4 03 11 PM

After refresh:
Screenshot 2023-03-31 at 4 04 10 PM

@mike-plummer
Copy link
Contributor Author

The race condition Mark is seeing above has been identified but is a pre-existing issue that could have broader impacts to fix. Have written that up in #26388

@mike-plummer mike-plummer dismissed warrensplayer’s stale review March 31, 2023 20:59

Requested changes made

@mike-plummer mike-plummer merged commit 1c385e0 into develop Mar 31, 2023
@mike-plummer mike-plummer deleted the mikep/22777-detect-ct-framework branch March 31, 2023 21:00
AtofStryker added a commit that referenced this pull request Apr 5, 2023
* chore(deps): bump in json5 in system-tests projects (#26379)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump set-getter from 0.1.0 to 0.1.1 (#26345)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Emily Rohrbough <[email protected]>

* chore(deps): bump vm2 from 3.9.5 to 3.9.14 (#26335)

Bumps [vm2](https://github.com/patriksimek/vm2) from 3.9.5 to 3.9.14.
- [Release notes](https://github.com/patriksimek/vm2/releases)
- [Changelog](https://github.com/patriksimek/vm2/blob/master/CHANGELOG.md)
- [Commits](patriksimek/vm2@3.9.5...3.9.14)

---
updated-dependencies:
- dependency-name: vm2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Emily Rohrbough <[email protected]>

* fix: Detect CT framework when unconfigured project opened with `--component` (#26306)

Co-authored-by: Ryan Manuel <[email protected]>

* chore: created a new github action to handle new comments better (#26234)

* chore: created a new github action to handle new comments better
---------

Co-authored-by: Emily Rohrbough <[email protected]>
Co-authored-by: Matt Schile <[email protected]>

* chore: remove debug logging on by default (#26411)

* fix: remove logging

* added changelog entry

* chore(dependency): tweaking renovate bot settings (#26428)

* Update renovate.json

* Update renovate.json

* chore: update devtools protocol (#26410)

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Emily Rohrbough <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mike Plummer <[email protected]>
Co-authored-by: Ryan Manuel <[email protected]>
Co-authored-by: Ben M <[email protected]>
Co-authored-by: Matt Schile <[email protected]>
Co-authored-by: Lachlan Miller <[email protected]>
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.

Framework detection doesn't occur when opening Cy with cypress open --component
5 participants