Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

flotwig
Copy link
Contributor

@flotwig flotwig commented Oct 20, 2021

User facing changelog

Additional details

  • System tests are now scaffolded to /tmp, not ./packages/server/.projects.
    • Now system tests must explicitly have their dependencies in package.json.
    • The exception is a few common node modules (lodash,, ...)
    • yarn install runs automatically locally and in CI for these projects.
  • Only the selected project is scaffolded, not all test projects.
  • e2e.exec now accepts the project name as project, not the project path.
  • See changes to system-tests/README.md for details.

How has the user experience changed?

PR Tasks

  • Have tests been added/updated?
  • [na] Has the original issue or this PR been tagged with a release in ZenHub?
  • [na] Has a PR for user-facing changes been opened in cypress-documentation?
  • [na] Have API changes been updated in the type definitions?
  • [na] Have new configuration options been added to the cypress.schema.json?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 20, 2021

Thanks for taking the time to open a PR!

@flotwig flotwig force-pushed the system-tests-refinement branch from 47c6d89 to 8603a13 Compare October 20, 2021 19:40
@cypress
Copy link

cypress bot commented Oct 20, 2021



Test summary

18708 1 202 0Flakiness 3


Run details

Project cypress
Status Failed
Commit 1de92bf
Started Nov 24, 2021 7:13 PM
Ended Nov 24, 2021 7:24 PM
Duration 11:17 💡
OS Linux Debian - 10.10
Browser Multiple

View run in Cypress Dashboard ➡️


Failures

cypress/integration/settings_spec.js Failed
1 Settings > file preference panel > loads preferred editor, available editors and shows spinner

Flakiness

commands/net_stubbing_spec.ts Flakiness
1 network stubbing > waiting and aliasing > can timeout waiting on a single request using "alias.request"
2 network stubbing > waiting and aliasing > can timeout waiting on a single request using "alias.request"
cypress/proxy-logging-spec.ts Flakiness
1 Proxy Logging > request logging > xhr log has response body/status code

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

- only scaffold selected project
- accept project name, not path
- symlink some common node packages
@flotwig flotwig force-pushed the system-tests-refinement branch from 8603a13 to 962c306 Compare October 20, 2021 21:08
@flotwig flotwig requested review from jennifer-shehane, chrisbreiding and tgriesser and removed request for a team and jennifer-shehane November 22, 2021 15:21
chrisbreiding
chrisbreiding previously approved these changes Nov 23, 2021
Copy link
Contributor

@chrisbreiding chrisbreiding left a comment

Choose a reason for hiding this comment

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

This is great - nice work!

name: Restore all node_modules to proper workspace folders
command: node scripts/circle-cache.js --action unpack

restore_cached_system_tests_deps:
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a describe to this job describe how this cache differentiates from the existing node_modules cache, which includes system-tests/node_modules?

Might be helpful to specify these are specifically the project's node_modules within system-tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Do you know if the description is actually used anywhere? It's part of the circle.yml spec but IDK where it ends up, I think it may be the equivalent of a code comment: https://circleci.com/docs/2.0/configuration-reference/#commands-requires-version-21

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"main": "index.js",
"scripts": {
"cache:key": "bash -c 'cat ./projects/**/{package.json,yarn.lock}'",
"projects:yarn:install": "node ./scripts/projects-yarn-install.js",
Copy link
Member

Choose a reason for hiding this comment

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

When running locally, this will need to be ran manually to setup the projects. Any reasons this shouldn't be ran as a post-install script?

We could leverage scripts/run-if-not-ci.sh to ensure this doesn't install / cache modules for non-system-test jobs in circleci.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Part of the idea here is that we can defer the install cost locally until you run the tests for the first time. You may never have a need to run error_ui_spec, so there's no need to install the node_modules for it until you run the test. Then, they'll be cached forevermore.

Putting it in postinstall would make install slower to get rid of the one-time cost when running the test for the first time locally, which is undesirable.

circle.yml Outdated
name: Restore system tests node_modules cache
keys:
- v{{ .Environment.CACHE_VERSION }}-{{ arch }}-system-tests-node-modules-cache-{{ checksum "system_tests_cache_key" }}
- v{{ .Environment.CACHE_VERSION }}-{{ arch }}-system-tests-node-modules-cache-
Copy link
Member

Choose a reason for hiding this comment

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

Why are two keys needed?

Suggested change
- v{{ .Environment.CACHE_VERSION }}-{{ arch }}-system-tests-node-modules-cache-
- v{{ .Environment.CACHE_VERSION }}-{{ arch }}-system-tests-projects-node-modules-cache-

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://circleci.com/docs/2.0/caching/#restoring-cache

CircleCI restores caches in the order of keys listed in the restore_cache step. Each cache key is namespaced to the project, and retrieval is prefix-matched. The cache will be restored from the first matching key. If there are multiple matches, the most recently generated cache will be used.

So it will either restore the exact correct cache, or the latest created cache.

circle.yml Outdated
steps:
- run:
name: Generate Circle Cache key for system tests
command: yarn workspace @tooling/system-tests cache:key > system_tests_cache_key
Copy link
Member

Choose a reason for hiding this comment

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

Can we use/update the existing scripts/circle-cache.js script to generate this cache key? The package.json script is straight-forward but it would align how we are generating these keys in circleci.

Copy link
Contributor Author

@flotwig flotwig Nov 23, 2021

Choose a reason for hiding this comment

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

Discussed this with @tgriesser originally, but decided to split this out because the system-tests/projects cache key is way simpler to generate than the circle-cache.js key. It's a one-liner, versus the somewhat complicated logic in circle-cache to generate a key. This way we can keep circle-cache.js's specific purpose as clear as possible.

I didn't re-use any of the existing cache stuff, because I didn't want to make it extra confusing/add even more logic to that process.

Comment on lines 2078 to 2079
- build
- system-tests-node-modules-install
Copy link
Member

Choose a reason for hiding this comment

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

Since system-tests-node-modules-install requires build, lets slim this requires list to system-tests-node-modules-install to make the circle ci graph a bit cleaner:

Copy link
Member

Choose a reason for hiding this comment

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

Screen Shot 2021-11-23 at 2 55 41 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oo i didn't even realize it did this, nice catch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

chrisbreiding
chrisbreiding previously approved these changes Nov 24, 2021
yarn was wrapping the stdout with timestamps and stuff, making the hash non-deterministic and breaking caching. now i see why `node_modules_install` just calls the script directly too.
@flotwig flotwig merged commit 71d92e0 into develop Nov 24, 2021
@flotwig flotwig deleted the system-tests-refinement branch November 24, 2021 20:10
@cypress-bot cypress-bot bot mentioned this pull request Nov 24, 2021
10 tasks
tgriesser added a commit that referenced this pull request Nov 28, 2021
* develop:
  test: node_modules installs for system-tests, other improvements (#18574)
  chore(deps): update dependency semantic-release to v17.2.3 [security] (#19022)
  chore: remove flaky ci jobs for main builds (#19071)
  chore(contributing): clarify PULL_REQUEST_TEMPLATE (#19068)
  fix: the shadow root container element is ignored when clicking an element in it. (#18908)
  'Fix' flaky redirect test (#19042)
  release 9.1.0 [skip ci]
  fix: Allow 'this' to be used in overridden commands (#18899)
  fix(react): link to rerender example (#19020)
  chore(deps): update dependency aws-sdk to v2.814.0 [security] (#18948)
  fix: test config overrides leak for .only execution (#18961)
  feat: Set CYPRESS=true as env var in child processes where Cypress runs user code in Node (#18981)
  fix: Restore broken gif (#18987)
  chore: release @cypress/vite-dev-server-v2.2.1
lmiller1990 pushed a commit that referenced this pull request Nov 29, 2021
tgriesser added a commit that referenced this pull request Nov 29, 2021
* 10.0-release:
  feat(graphql): ability to update/query for appData (#19082)
  fix system test
  fix failing tests due to merge
  resolve conflicts
  test: node_modules installs for system-tests, other improvements (#18574)
  update yarn.lock
  chore(deps): update dependency semantic-release to v17.2.3 [security] (#19022)
  chore: remove flaky ci jobs for main builds (#19071)
  chore(contributing): clarify PULL_REQUEST_TEMPLATE (#19068)
  fix: the shadow root container element is ignored when clicking an element in it. (#18908)
  'Fix' flaky redirect test (#19042)
  release 9.1.0 [skip ci]
  fix: Allow 'this' to be used in overridden commands (#18899)
  fix(react): link to rerender example (#19020)
  chore(deps): update dependency aws-sdk to v2.814.0 [security] (#18948)
  fix: test config overrides leak for .only execution (#18961)
  feat: Set CYPRESS=true as env var in child processes where Cypress runs user code in Node (#18981)
  fix: Restore broken gif (#18987)
  chore: release @cypress/vite-dev-server-v2.2.1
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.

Support system testing environment
3 participants