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

chore: Intregrate runner packages. #23028

Merged
merged 13 commits into from
Aug 11, 2022
Merged

Conversation

sainthkh
Copy link
Contributor

@sainthkh sainthkh commented Aug 1, 2022

User facing changelog

N/A. It's an internal code cleanup.

Additional details

  • Why was this change necessary? => These are mostly-unused legacy code.
  • What is affected by this change? => N/A
  • Any implementation details to explain? => I migrated runner-shared and runner-ct into runner and removed unused scss files and react components.

Steps to test

packages folder structure has been changed. Run all tests to make sure that nothing has changed.

How has the user experience changed?

N/A. New contributors might not be confused with the legacy codes.

PR Tasks

  • Have tests been added/updated?
  • [na] Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • [na] Has a PR for user-facing changes been opened in cypress-documentation?
  • [na] Have API changes been updated in the type definitions?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 1, 2022

Thanks for taking the time to open a PR!

@cypress
Copy link

cypress bot commented Aug 1, 2022



Test summary

37828 0 473 0Flakiness 10


Run details

Project cypress
Status Passed
Commit 993f918
Started Aug 2, 2022 1:42 AM
Ended Aug 2, 2022 1:57 AM
Duration 15:33 💡
OS Linux Debian - 11.3
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

cypress/e2e/commands/xhr.cy.js Flakiness
1 ... > logs request + response headers
2 ... > logs Method, Status, URL, and XHR
3 ... > logs response
4 ... > logs request + response headers
5 ... > logs Method, Status, URL, and XHR
This comment includes only the first 5 flaky tests. See all 10 flaky tests in the Cypress Dashboard.

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@sainthkh sainthkh marked this pull request as ready for review August 2, 2022 01:53
@sainthkh sainthkh requested review from a team as code owners August 2, 2022 01:53
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.

Left a few comments/questions, happy to approve once they've been replied too - nice job on this, great to see some of this getting cleaned up!

packages/server/lib/controllers/runner.ts Show resolved Hide resolved
@@ -40,8 +40,6 @@
/packages/rewriter/ @cypress-io/end-to-end
/packages/root/ @cypress-io/end-to-end
/packages/runner/ @cypress-io/end-to-end
/packages/runner-ct/ @cypress-io/component-testing
/packages/runner-shared/ @cypress-io/end-to-end
/packages/server/ @cypress-io/end-to-end
/packages/socket/ @cypress-io/end-to-end
/packages/static/ @cypress-io/end-to-end
Copy link
Contributor

@lmiller1990 lmiller1990 Aug 2, 2022

Choose a reason for hiding this comment

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

FYI some context - we ideally should delete ALL of runner/runner-shared, and bundle the entire app with the Vite stack.

The reason we are stuck like this is explained a little here: #20663 (comment)

Basically some of the code in driver and possibly reporter are not really ESM compatible - webpack does something different to Vite to resolve the modules, which is why it works in webpack, but we cannot import to Vite.

Not sure if this is something you are looking to investigate more @sainthkh but if you do please let me know, I'd like to follow along/help out - I'd really like to get away from this "inject webpack bundle" mess at some point, but it's quite hard. Likely making driver 100% ESM (including dependencies) would be a good first step.

Any thoughts on 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.

It seems that we have 4 things to do to delete the runner pacakge.

  • Migrate dom. -> I think driver/src/dom might be a good place or move it to app directly.
  • Reimplement Studio -> Cypress Studio Reimplementation Spike #22870
  • ESM-ify driver -> I agree it's the biggest problem.
  • Let reporter compile its own styles. -> Move runner/webpack.config.ts to reporter.

Copy link
Contributor

Choose a reason for hiding this comment

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

Dom -> are you going do to this here?
Studio -> I am looking into this now
ESMify driver -> agree, hard
Reporter styles -> do this separately I think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I read the dom code and it seems that it's better to be a separate PR.

It currently renders highlight by

  1. Creating the container node with jQuery.
  2. Rendering the Highlight DOM with React.

I can simply migrate dom to app and use unified-runner. But I don't think it's not our goal. It's just hiding and postponing.

To get migrating dom done, I need to do these things:

  • Remove JQuery from dom and dimensions.
  • Move the current JQuery version of dimensions to driver/src/dom because it's used in driver/src/dom/blackout.
  • Migrate Highlight from react to vue with our Tooltip component.
  • Migrate dom functions to app/runner/aut-iframe. Leave studio-related functions.
  • Clean up unified-runner dom and CypressJQuery. They're only used inside aut-iframe. I guess they can be removed safely from unified-runner.

I think it's a big change and outside the scope of this PR.


As for reporter styles, it's safe to do it after ESM-ifying driver. We're trying to remove webpack. I don't think we don't need to create one more webpack.config.ts now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I opened the new PR #23187 to migrate dom.js. It's currently empty because I'm now reading and planning.

.gitignore Outdated Show resolved Hide resolved
Copy link
Member

@emilyrohrbough emilyrohrbough left a comment

Choose a reason for hiding this comment

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

We think alike! I love it. I started cleaning this up last week while waiting on test results because it was bugging me! I'll drop a few comments on things I noticed while cleaning this up.

@@ -24,6 +24,7 @@
"@packages/rewriter": "0.0.0-development",
Copy link
Member

@emilyrohrbough emilyrohrbough Aug 2, 2022

Choose a reason for hiding this comment

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

Need to add in the test script to run the mocha tests that were in runner-shared

and need to move the mocha test setup over as well - the test is in src/studio

Copy link
Member

Choose a reason for hiding this comment

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

also "@packages/network": "0.0.0-development", can be dropped

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently, runner-shared unit tests are ignored.

"test": "yarn lerna exec yarn test --scope cypress --scope \"'@packages/{config,errors,data-context,electron,extension,https-proxy,launcher,net-stubbing,network,proxy,rewriter,socket}'\"",

And it fails in the current develop branch.

And the only the file that exists is studio-recorder.spec.js. It's there for reference purpose and it'll be removed soon with #22870.


I checked the code base and removed network, socket, and rewriter.

@lmiller1990 lmiller1990 self-requested a review August 3, 2022 01:04
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.

Nice cleanup! Going to approve, but also happy to re-review if you move the DOM code to app.

Nice list of TODOs here: #23028 (comment)

@lmiller1990
Copy link
Contributor

Are you still working on this @sainthkh or are we good to re-review and merge if green?

@sainthkh
Copy link
Contributor Author

@lmiller1990 I think it's done. I'll take care of the dom issue at #23187.

@lmiller1990
Copy link
Contributor

run-reporter seems broken. Last blocker @sainthkh 🤔

@sainthkh
Copy link
Contributor Author

@lmiller1990 It's happening because there are 4 test files inside reporter(commands/command.cy.tsx, hooks/hooks.cy.tsx, lib/tag.cy.tsx, test/test.cy.tsx), but there are 7 machines to run them. 3 of them don't have work to do. I opened an issue about this misleading message a few months ago at #22328.

I intentionally didn't fix this problem at #22326 because I thought the problem is more at the ci setting side (comment).

There are a few solutions for this problem:

  1. Change the CI setting from 7 to 2 or 3. -> I think it's better because we need less power and it's unlikely that we might need more than 2 or 3 machines for the tests.
  2. Return nothing when there is no test file. -> We need to fix the ci script. Maybe it's a different issue and open a new PR.

@lmiller1990
Copy link
Contributor

Let's just take it down to parallelism: 2 for now. For such a small number of specs, we probably don't need it at all...

@lmiller1990 lmiller1990 merged commit 2d119ad into cypress-io:develop Aug 11, 2022
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.

3 participants