Skip to content

fix: remove 'new' badge from Create from Component, fix parsing #31457

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

Merged
merged 8 commits into from
Jul 16, 2025

Conversation

astone123
Copy link
Contributor

@astone123 astone123 commented Apr 7, 2025

Additional details

This PR removes the "New" badge for the Create from Component feature - we released it over two years ago. It also fixes an issue where we would fail to parse component files for certain projects that had babel configurations in their project root. You can see this issue with cypress-services dashboard tests - if you try to use Create from Component with any of these files, it will error on all of them because of Babel plugin issues from the project's Babel config. We don't want to use the project's configuration file.

Steps to test

On develop

  1. Open cypress-services/frontend/packages/dashboard in CT
  2. Click "New Spec" in the top-right
  3. Click Create from Component
  4. Expand some files in the project - notice that all of them say "Unable to parse"
  5. Switch to this branch
  6. Verify that the "new" badge is no longer displayed on this option
  7. Verify that the React components are correctly identified for the files in cypress-services dashboard

PR Tasks

@astone123 astone123 self-assigned this Apr 7, 2025
@@ -33,6 +33,7 @@ export class CodegenActions {
let result = parseReactComponent(src, {
resolver: findAllWithLink(exportResolver, reactDocgenResolvers),
babelOptions: {
configFile: false,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This option disables the use of a config file for Babel. this is what we want since we're calling it directly, we don't want to pick up any config file that might be in the project

https://babeljs.io/docs/options#configfile

Copy link
Contributor

Choose a reason for hiding this comment

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

is it possible to add a test for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@AtofStryker I added a test in CodegenActions.spec.ts just to make sure that we pass this option to Babel. I went down the road of trying to do a system test for this instead, but couldn't get it to work

Copy link
Contributor

Choose a reason for hiding this comment

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

its probably hard to do a system test since its code generation for a component? Have you tried a cy-in-cy test? That would give us the most coverage here

Copy link
Contributor

Choose a reason for hiding this comment

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

@astone123 any luck with the cy-in-cy test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no I haven't looked at it yet, will try it out this week

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@AtofStryker I finally added a test for this - let me know what you think

Copy link

cypress bot commented Apr 7, 2025

cypress    Run #63741

Run Properties:  status check passed Passed #63741  •  git commit da1f552809: actually fix lint
Project cypress
Branch Review create-from-component-fix
Run status status check passed Passed #63741
Run duration 16m 55s
Commit git commit da1f552809: actually fix lint
Committer astone123
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 2
Tests that did not run due to a developer annotating a test with .skip  Pending 133
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 5552
View all changes introduced in this branch ↗︎

@@ -33,6 +33,7 @@ export class CodegenActions {
let result = parseReactComponent(src, {
resolver: findAllWithLink(exportResolver, reactDocgenResolvers),
babelOptions: {
configFile: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

is it possible to add a test for this?

@astone123 astone123 requested a review from AtofStryker April 18, 2025 18:01
@astone123 astone123 force-pushed the create-from-component-fix branch from acdcf8e to d362468 Compare July 14, 2025 13:15
@astone123 astone123 changed the base branch from develop to release/15.0.0 July 14, 2025 13:15
@@ -4,7 +4,6 @@
:header="t('createSpec.component.importFromComponent.header')"
:description="t('createSpec.component.importFromComponent.description')"
:icon="DocumentCodeIcon"
:badge-text="t('versions.new')"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this isn't new anymore

@AtofStryker AtofStryker merged commit 47bda54 into release/15.0.0 Jul 16, 2025
82 of 86 checks passed
@AtofStryker AtofStryker deleted the create-from-component-fix branch July 16, 2025 20:53
cypress-app-bot pushed a commit that referenced this pull request Jul 16, 2025
cypress-app-bot pushed a commit that referenced this pull request Jul 16, 2025
cypress-app-bot pushed a commit that referenced this pull request Jul 16, 2025
cypress-app-bot pushed a commit that referenced this pull request Jul 16, 2025
cypress-app-bot pushed a commit that referenced this pull request Jul 16, 2025
cypress-app-bot pushed a commit that referenced this pull request Jul 16, 2025
jennifer-shehane pushed a commit that referenced this pull request Jul 17, 2025
* chore: updating v8 snapshot cache

* index on release/15.0.0: 47bda54 fix: remove 'new' badge from Create from Component, fix parsing (#31457)

* index on release/15.0.0: 3b88383 internal: (studio) support creating new test in root suite (#32024)

---------

Co-authored-by: cypress-bot[bot] <+cypress-bot[bot]@users.noreply.github.com>
jennifer-shehane pushed a commit that referenced this pull request Jul 17, 2025
* chore: updating v8 snapshot cache

* index on release/15.0.0: 47bda54 fix: remove 'new' badge from Create from Component, fix parsing (#31457)

* index on release/15.0.0: 3b88383 internal: (studio) support creating new test in root suite (#32024)

---------

Co-authored-by: cypress-bot[bot] <+cypress-bot[bot]@users.noreply.github.com>
jennifer-shehane pushed a commit that referenced this pull request Jul 17, 2025
* chore: updating v8 snapshot cache

* index on release/15.0.0: 47bda54 fix: remove 'new' badge from Create from Component, fix parsing (#31457)

* index on release/15.0.0: 3b88383 internal: (studio) support creating new test in root suite (#32024)

---------

Co-authored-by: cypress-bot[bot] <+cypress-bot[bot]@users.noreply.github.com>
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