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

MEGA: Make E2E Great Again #3444

Merged
merged 55 commits into from
Feb 8, 2022
Merged

MEGA: Make E2E Great Again #3444

merged 55 commits into from
Feb 8, 2022

Conversation

Murderlon
Copy link
Member

@Murderlon Murderlon commented Jan 21, 2022

After postponing this for a long time, here it is, a new e2e test suite focused on developer experience and ease of use.

  • Add cypress
  • Add eslint-plugin-cypress to write better tests
  • Setup client apps to test against with Parcel
  • Add script to generate test boilerplate
  • Update bin/companion.sh
  • Unify all env files
  • Update contributing docs
  • Update readme badges
  • Move unit test files from 'old' e2e test folder to the actual unit tests
  • Setup GitHub Actions for new test suite
  • Write tests
    • Thumbnails
    • Remote provider testing with Url and Unsplash
    • Basic Tus upload
    • React
    • Vue (Parcel only supports Vue 3 if you use SFC's but @uppy/vue is broken for Vue 3)
    • Tus exponential backoff
    • Basic Transloadit upload
    • Transloadit encoding
    • Something similar to "Chaos Monkey", but with a more intention revealing name. Basically a stress test with a lot of files.
  • Remove old test suite

Considered alternatives

  • Playwright instead of Cypress. Arguably a more modern take. It supports more browsers, has a node style API instead of the Cypress JQuery style API, and runs slightly faster. However, the docs are significantly less good. The main goal of this undertaking is to make e2e as easy and fast as possible. That means if you don't understand something, which is likely as e2e is complex, you want to find comfort in easy docs and best practices. Cypress offers this. It has guides, describes tradeoffs of testing strategies, and has real world examples. It is also more battle tested than Playwright and the error messages are great.
  • Vite instead of Parcel. I ran into trouble into getting Vite to play nice with the setup and ultimately tried Parcel, which worked out of the box. Other than that no strong opinion.

* main: (45 commits)
  Polished the latest update blog (#3390)
  docs: fix typo in audio.md (#3389)
  website: 2.0-2.3 post draft (#3370)
  Release: uppy@2.3.2 (#3383)
  meta: fix release script
  @uppy/core: document file.name (#3381)
  add `.npmignore` files to ignore .gitignore when packing (#3380)
  meta: add VSCode workspace settings to `.gitignore`
  Upgrade ws in companion (#3377)
  meta: use ESBuild to bundle in E2E test suite (#3375)
  meta: update linter config to parse ESM files (#3371)
  meta: move dev workspace to `private/` (#3368)
  meta: use Vite for examples/dev (#3361)
  website: remove dependency on `crypto` in @uppy/transloadit example (#3367)
  tools: enable linter on website examples (#3366)
  meta: enable linter on mjs scripts (#3364)
  Fix module field in @uppy/angular package.json (#3365)
  Release: uppy@2.3.1 (#3357)
  meta: improve release script wording and formatting
  meta: update npm deps (#3352)
  ...
* main:
  dev: move configuration to a `.env` file (#3430)
  Update ci.yml (#3428)
  @uppy/transloadit: simplify `#onTusError` (#3419)
  Force include babel numeric separator (#3422)
  Release: uppy@2.4.0 (#3420)
  @uppy/transloadit: ignore rate limiting errors when polling (#3418)
  @uppy/tus: pause all requests in response to server rate limiting (#3394)
  @uppy/transloadit: better defaults for rate limiting (#3414)
  Update BACKLOG.md
  Fix Companion deploys (#3388)
  update aws-presigned-url example to use esm (#3413)
  @uppy/image-editor: namespace input range css (#3406)
  Release: uppy@2.3.3 (#3410)
  improve private ip check (#3403)
  Add missing option to the screen capture types (#3400)
  @uppy/drag-drop: fix `undefined is not a function` TypeError (#3397)
  website: update december 2021 blog post (#3396)
* main:
  @uppy/transloadit: fix handling of Tus errors and rate limiting (#3429)
  Add Unsplash to website dashboard example (#3431)
* main:
  dev: fix Vite custom plugin (#3437)
  website: add legacy bundle to CDN example (#3433)
  meta: remove unused lerna and npm files (#3436)
  meta: replace browserify with esbuild (#3363)
  Release: uppy@2.4.1 (#3432)
@Murderlon

This comment has been minimized.

.eslintrc.js Outdated Show resolved Hide resolved
bin/companion.sh Outdated Show resolved Hide resolved
e2e/generate-test.mjs Outdated Show resolved Hide resolved
Copy link
Contributor

@aduh95 aduh95 left a comment

Choose a reason for hiding this comment

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

We should probably have a .env at the root that serves as an example / fallback for new contributors.

Copy link
Contributor

@mifi mifi left a comment

Choose a reason for hiding this comment

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

Looking very smooth sir! I left a few questions

if [ -f .env ]; then
# https://gist.github.com/mihow/9c7f559807069a03e302605691f85572?permalink_comment_id=3625310#gistcomment-3625310
set -a
source <(sed -e '/^#/d;/^\s*$/d' -e "s/'/'\\\''/g" -e "s/=\(.*\)/='\1'/g" .env)
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you considered /~https://github.com/motdotla/dotenv ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, tried it here: 11ede08 but couldn't get it to work in CI.

Copy link
Contributor

Choose a reason for hiding this comment

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

What didn't work? didn't it load the .env file?
If .env was inside private/dev/.env, then I suspect that this line was the problem:

    "start:companion": "yarn node private/dev/companion.js",

11ede08#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R146

I think dotenv searches inside CWD and not inside the directory of the .js file, so for it to work it would have to be changed to:

    "start:companion": "cd private/dev && yarn node companion.js",

e2e/generate-test.mjs Outdated Show resolved Hide resolved
@@ -0,0 +1,83 @@
/* eslint-disable no-console, import/no-extraneous-dependencies */
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this script needs to be run for every new test to generate all the code/html needed for that test and that this generated code has to be checked into git. It would generate a lot of code that needs to be maintained in the future in case of changes. Could it be instead implemented as a function or module that is run for every test (kind of like a before hook) that will provide each test with the needed files on-the-fly?

Copy link
Member Author

Choose a reason for hiding this comment

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

We no longer need to generate files in order for tests to work like we used to. Now we simply import things and it will resolve to the yarn workspace. This is ran if you want the boilerplate of a new test, something that is ran once, not for every test.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh so this script needs to be run by the developer and commited to git for every new test the developer wants to write? Then I’m still wondering if there’s an alternative way, because it will lead to a lot ofduplication and boiler plate, if every new test needs this.

or are you saying this script is to be run only once in the lifetime of uppy codebase? If so, i’m not sure what’s the value of keeping such a script

Copy link
Member Author

Choose a reason for hiding this comment

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

I would suggest checking out the branch and running it to see what it does. To me it's valuable. But given that this wasn't immediately clear, I should perhaps update the docs better.

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand it will generate files under client/ and a sample test file. I think what I'm not totally understanding yet, is how we are supposed to write new tests. If I or a contributor now want to add a test for a untested feature, like say upload a file from dropbox, should I then run generate-test.mjs to generate a new set of files for my test? And another feature, do I run it again? Or should I add an it statement into say /~https://github.com/transloadit/uppy/blob/956cd92eca9470661d948992278841f6d0f56cd9/e2e/cypress/integration/dashboard-transloadit.spec.ts and start adding my logic there? maybe we need to document this

if [ -f .env ]; then
# https://gist.github.com/mihow/9c7f559807069a03e302605691f85572?permalink_comment_id=3625310#gistcomment-3625310
set -a
source <(sed -e '/^#/d;/^\s*$/d' -e "s/'/'\\\''/g" -e "s/=\(.*\)/='\1'/g" .env)
Copy link
Contributor

Choose a reason for hiding this comment

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

What didn't work? didn't it load the .env file?
If .env was inside private/dev/.env, then I suspect that this line was the problem:

    "start:companion": "yarn node private/dev/companion.js",

11ede08#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R146

I think dotenv searches inside CWD and not inside the directory of the .js file, so for it to work it would have to be changed to:

    "start:companion": "cd private/dev && yarn node companion.js",

package.json Show resolved Hide resolved
@@ -0,0 +1,83 @@
/* eslint-disable no-console, import/no-extraneous-dependencies */
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand it will generate files under client/ and a sample test file. I think what I'm not totally understanding yet, is how we are supposed to write new tests. If I or a contributor now want to add a test for a untested feature, like say upload a file from dropbox, should I then run generate-test.mjs to generate a new set of files for my test? And another feature, do I run it again? Or should I add an it statement into say /~https://github.com/transloadit/uppy/blob/956cd92eca9470661d948992278841f6d0f56cd9/e2e/cypress/integration/dashboard-transloadit.spec.ts and start adding my logic there? maybe we need to document this

@aduh95 aduh95 merged commit 6da874e into main Feb 8, 2022
@aduh95 aduh95 deleted the cypress branch February 8, 2022 16:37
@mifi mifi mentioned this pull request Feb 9, 2022
4 tasks
@github-actions github-actions bot mentioned this pull request Feb 14, 2022
@aduh95 aduh95 mentioned this pull request Feb 14, 2022
github-actions bot pushed a commit that referenced this pull request Feb 14, 2022
| Package                   | Version | Package                   | Version |
| ------------------------- | ------- | ------------------------- | ------- |
| @uppy/companion           |   3.2.0 | @uppy/provider-views      |   2.0.7 |
| @uppy/companion-client    |   2.0.5 | @uppy/thumbnail-generator |   2.1.0 |
| @uppy/core                |   2.1.5 | @uppy/robodog             |   2.3.0 |
| @uppy/dashboard           |   2.1.4 | uppy                      |   2.5.0 |
| @uppy/locales             |   2.0.6 |                           |         |

- @uppy/companion: add support for COMPANION_UNSPLASH_SECRET (Mikael Finstad / #3463)
- @uppy/unsplash: fix nested meta (Artur Paikin / #3485)
- meta: fix(docs): typo in property `thumbnailType` (Dan Schalow / #3472)
- @uppy/robodog: add audio, box, unsplash, screen-capture to Robodog (Artur Paikin / #3483)
- meta: consolidate ENV files and fix contributing guidelines (Antoine du Hamel / #3475)
- @uppy/companion-client,@uppy/companion,@uppy/provider-views,@uppy/robodog: Finishing touches on Companion dynamic Oauth (Renée Kooi / #2802)
- meta: Improve companion docs (Mikael Finstad / #3479)
- meta: Make E2E Great Again (Merlijn Vos / #3444)
- meta: Add PostCSS handling to Vite (Artur Paikin / #3467)
- meta: Update CONTRIBUTING.md (Mikael Finstad / #3411)
- @uppy/companion: fix broken thumbnails for box and dropbox (Mikael Finstad / #3460)
- website: fix `Uppy is not defined` error (Antoine du Hamel / #3461)
- @uppy/companion: Implement periodic ping functionality (Mikael Finstad / #3246)
- @uppy/companion: fix callback urls (Mikael Finstad / #3458)
- @uppy/core,@uppy/dashboard,@uppy/thumbnail-generator: Add dashboard and UIPlugin types (Merlijn Vos / #3426)
- @uppy/locales: Add "save" to fr_FR.js (Charly Billaud / #3395)
- @uppy/companion: Fix TypeError when invalid initialization vector (Julian Gruber / #3416)
- meta: Upgrade size-limit to 7.0.5 (Artur Paikin / #3445)
- @uppy/provider-views: Unsplash: UI improvements (Artur Paikin / #3438)
- @uppy/thumbnail-generator: exifr: remove legacy IE support (Artur Paikin / #3382)
- @uppy/companion: Default to HEAD requests when the Companion looks to get meta information about a URL (Zack Bloom / #3417)
- @uppy/dashboard: check if info array is empty (Artur Paikin / #3442)
- meta: dev: fix Vite custom plugin (Antoine du Hamel / #3437)
- website: add legacy bundle to CDN example (Antoine du Hamel / #3433)
- meta: remove unused lerna and npm files (Antoine du Hamel / #3436)
- meta: replace browserify with esbuild (Antoine du Hamel / #3363)
HeavenFox pushed a commit to docsend/uppy that referenced this pull request Jun 27, 2023
| Package                   | Version | Package                   | Version |
| ------------------------- | ------- | ------------------------- | ------- |
| @uppy/companion           |   3.2.0 | @uppy/provider-views      |   2.0.7 |
| @uppy/companion-client    |   2.0.5 | @uppy/thumbnail-generator |   2.1.0 |
| @uppy/core                |   2.1.5 | @uppy/robodog             |   2.3.0 |
| @uppy/dashboard           |   2.1.4 | uppy                      |   2.5.0 |
| @uppy/locales             |   2.0.6 |                           |         |

- @uppy/companion: add support for COMPANION_UNSPLASH_SECRET (Mikael Finstad / transloadit#3463)
- @uppy/unsplash: fix nested meta (Artur Paikin / transloadit#3485)
- meta: fix(docs): typo in property `thumbnailType` (Dan Schalow / transloadit#3472)
- @uppy/robodog: add audio, box, unsplash, screen-capture to Robodog (Artur Paikin / transloadit#3483)
- meta: consolidate ENV files and fix contributing guidelines (Antoine du Hamel / transloadit#3475)
- @uppy/companion-client,@uppy/companion,@uppy/provider-views,@uppy/robodog: Finishing touches on Companion dynamic Oauth (Renée Kooi / transloadit#2802)
- meta: Improve companion docs (Mikael Finstad / transloadit#3479)
- meta: Make E2E Great Again (Merlijn Vos / transloadit#3444)
- meta: Add PostCSS handling to Vite (Artur Paikin / transloadit#3467)
- meta: Update CONTRIBUTING.md (Mikael Finstad / transloadit#3411)
- @uppy/companion: fix broken thumbnails for box and dropbox (Mikael Finstad / transloadit#3460)
- website: fix `Uppy is not defined` error (Antoine du Hamel / transloadit#3461)
- @uppy/companion: Implement periodic ping functionality (Mikael Finstad / transloadit#3246)
- @uppy/companion: fix callback urls (Mikael Finstad / transloadit#3458)
- @uppy/core,@uppy/dashboard,@uppy/thumbnail-generator: Add dashboard and UIPlugin types (Merlijn Vos / transloadit#3426)
- @uppy/locales: Add "save" to fr_FR.js (Charly Billaud / transloadit#3395)
- @uppy/companion: Fix TypeError when invalid initialization vector (Julian Gruber / transloadit#3416)
- meta: Upgrade size-limit to 7.0.5 (Artur Paikin / transloadit#3445)
- @uppy/provider-views: Unsplash: UI improvements (Artur Paikin / transloadit#3438)
- @uppy/thumbnail-generator: exifr: remove legacy IE support (Artur Paikin / transloadit#3382)
- @uppy/companion: Default to HEAD requests when the Companion looks to get meta information about a URL (Zack Bloom / transloadit#3417)
- @uppy/dashboard: check if info array is empty (Artur Paikin / transloadit#3442)
- meta: dev: fix Vite custom plugin (Antoine du Hamel / transloadit#3437)
- website: add legacy bundle to CDN example (Antoine du Hamel / transloadit#3433)
- meta: remove unused lerna and npm files (Antoine du Hamel / transloadit#3436)
- meta: replace browserify with esbuild (Antoine du Hamel / transloadit#3363)
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