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

e2e: add tests for AWS #3665

Merged
merged 14 commits into from Aug 23, 2022
18 changes: 16 additions & 2 deletions .env.example
Expand Up @@ -14,12 +14,26 @@ COMPANION_SECRET=development
# NOTE: Only enable this in development. Enabling it in production is a security risk
COMPANION_ALLOW_LOCAL_URLS=true

COMPANION_DROPBOX_KEY=***
COMPANION_DROPBOX_SECRET=***
# to enable S3
COMPANION_AWS_KEY="YOUR AWS KEY"
COMPANION_AWS_SECRET="YOUR AWS SECRET"
# specifying a secret file will override a directly set secret
# COMPANION_AWS_SECRET_FILE="PATH/TO/AWS/SECRET/FILE"
COMPANION_AWS_BUCKET="YOUR AWS S3 BUCKET"
COMPANION_AWS_REGION="AWS REGION"
# to enable S3 Transfer Acceleration (default: false)
# COMPANION_AWS_USE_ACCELERATE_ENDPOINT="false"
# to set X-Amz-Expires query param in presigned urls (in seconds, default: 300)
# COMPANION_AWS_EXPIRES="300"
# to set a canned ACL for uploaded objects: https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl
# COMPANION_AWS_ACL="public-read"

COMPANION_BOX_KEY=***
COMPANION_BOX_SECRET=***

COMPANION_DROPBOX_KEY=***
COMPANION_DROPBOX_SECRET=***

COMPANION_GOOGLE_KEY=***
COMPANION_GOOGLE_SECRET=***

Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/e2e.yml
Expand Up @@ -45,11 +45,24 @@ jobs:
env:
COMPANION_UNSPLASH_KEY: ${{secrets.COMPANION_UNSPLASH_KEY}}
COMPANION_UNSPLASH_SECRET: ${{secrets.COMPANION_UNSPLASH_SECRET}}
VITE_COMPANION_URL: http://localhost:3020
VITE_TRANSLOADIT_KEY: ${{secrets.TRANSLOADIT_KEY}}
VITE_TRANSLOADIT_SECRET: ${{secrets.TRANSLOADIT_SECRET}}
VITE_TRANSLOADIT_TEMPLATE: ${{secrets.TRANSLOADIT_TEMPLATE}}
VITE_TRANSLOADIT_SERVICE_URL: ${{secrets.TRANSLOADIT_SERVICE_URL}}
CYPRESS_RECORD_KEY: ${{secrets.CYPRESS_RECORD_KEY}}
COMPANION_AWS_KEY: ${{secrets.COMPANION_AWS_KEY}}
COMPANION_AWS_SECRET: ${{secrets.COMPANION_AWS_SECRET}}
COMPANION_AWS_BUCKET: ${{secrets.COMPANION_AWS_BUCKET}}
COMPANION_AWS_REGION: ${{secrets.COMPANION_AWS_REGION}}
COMPANION_AWS_DISABLE_ACL: 'true'
- name: Upload videos in case of failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: videos-and-screenshots
path: |
e2e/cypress/videos/
e2e/cypress/screenshots/
- name: Remove 'pending end-to-end tests' label
# Remove the 'pending end-to-end tests' label if tests ran successfully
if: github.event.pull_request && contains(github.event.pull_request.labels.*.name, 'pending end-to-end tests')
Expand Down
16 changes: 16 additions & 0 deletions e2e/clients/dashboard-aws-multipart/app.js
@@ -0,0 +1,16 @@
import { Uppy } from '@uppy/core'
import Dashboard from '@uppy/dashboard'
import AwsS3 from '@uppy/aws-s3-multipart'

import '@uppy/core/dist/style.css'
import '@uppy/dashboard/dist/style.css'

const uppy = new Uppy()
.use(Dashboard, { target: '#app', inline: true })
.use(AwsS3, {
limit: 2,
companionUrl: process.env.VITE_COMPANION_URL,
})

// Keep this here to access uppy in tests
window.uppy = uppy
11 changes: 11 additions & 0 deletions e2e/clients/dashboard-aws-multipart/index.html
@@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>dashboard-aws-multipart</title>
<script defer type="module" src="app.js"></script>
</head>
<body>
<div id="app"></div>
</body>
</html>
16 changes: 16 additions & 0 deletions e2e/clients/dashboard-aws/app.js
@@ -0,0 +1,16 @@
import { Uppy } from '@uppy/core'
import Dashboard from '@uppy/dashboard'
import AwsS3 from '@uppy/aws-s3'

import '@uppy/core/dist/style.css'
import '@uppy/dashboard/dist/style.css'

const uppy = new Uppy()
.use(Dashboard, { target: '#app', inline: true })
.use(AwsS3, {
limit: 2,
companionUrl: process.env.VITE_COMPANION_URL,
})

// Keep this here to access uppy in tests
window.uppy = uppy
11 changes: 11 additions & 0 deletions e2e/clients/dashboard-aws/index.html
@@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>dashboard-aws</title>
<script defer type="module" src="app.js"></script>
</head>
<body>
<div id="app"></div>
</body>
</html>
2 changes: 2 additions & 0 deletions e2e/clients/index.html
Expand Up @@ -8,6 +8,8 @@
<h1>Test apps</h1>
<nav>
<ul>
<li><a href="dashboard-aws/index.html">dashboard-aws</a></li>
<li><a href="dashboard-aws-multipart/index.html">dashboard-aws-multipart</a></li>
<li><a href="dashboard-compressor/index.html">dashboard-compressor</a></li>
<li><a href="react/index.html">react</a></li>
<li><a href="dashboard-transloadit/index.html">dashboard-transloadit</a></li>
Expand Down
3 changes: 3 additions & 0 deletions e2e/cypress.config.mjs
@@ -1,5 +1,7 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { defineConfig } from 'cypress'
// eslint-disable-next-line import/no-extraneous-dependencies
import terminalReport from 'cypress-terminal-report/src/installLogsPrinter.js'
aduh95 marked this conversation as resolved.
Show resolved Hide resolved

export default defineConfig({
defaultCommandTimeout: 16000,
Expand All @@ -11,6 +13,7 @@ export default defineConfig({
// eslint-disable-next-line no-unused-vars
setupNodeEvents (on, config) {
// implement node event listeners here
terminalReport(on)
aduh95 marked this conversation as resolved.
Show resolved Hide resolved
},
},
})
13 changes: 13 additions & 0 deletions e2e/cypress/integration/dashboard-aws-multipart.spec.ts
@@ -0,0 +1,13 @@
describe('Dashboard with @uppy/aws-s3-multipart', () => {
beforeEach(() => {
cy.visit('/dashboard-aws-multipart')
cy.get('.uppy-Dashboard-input:first').as('file-input')
})

it('should upload cat image successfully', () => {
cy.get('@file-input').selectFile(['cypress/fixtures/images/cat.jpg', 'cypress/fixtures/images/traffic.jpg'], { force:true })
cy.get('.uppy-StatusBar-actionBtn--upload').click()

cy.get('.uppy-StatusBar-statusPrimary').should('contain', 'Complete')
})
})
13 changes: 13 additions & 0 deletions e2e/cypress/integration/dashboard-aws.spec.ts
@@ -0,0 +1,13 @@
describe('Dashboard with @uppy/aws-s3', () => {
beforeEach(() => {
cy.visit('/dashboard-aws')
cy.get('.uppy-Dashboard-input:first').as('file-input')
})

it('should upload cat image successfully', () => {
cy.get('@file-input').selectFile(['cypress/fixtures/images/cat.jpg', 'cypress/fixtures/images/traffic.jpg'], { force:true })
cy.get('.uppy-StatusBar-actionBtn--upload').click()

cy.get('.uppy-StatusBar-statusPrimary').should('contain', 'Complete')
})
})
6 changes: 6 additions & 0 deletions e2e/cypress/support/e2e.ts
Expand Up @@ -18,3 +18,9 @@ import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')

// eslint-disable-next-line
// @ts-ignore
import fn from 'cypress-terminal-report/src/installLogsCollector.js'

fn()
aduh95 marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions e2e/package.json
Expand Up @@ -46,6 +46,7 @@
},
"devDependencies": {
"cypress": "^10.0.0",
"cypress-terminal-report": "^4.1.2",
"deep-freeze": "^0.0.1",
"parcel": "^2.0.1",
"prompts": "^2.4.2",
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -46,6 +46,7 @@
"@babel/preset-env": "^7.14.7",
"@babel/register": "^7.10.5",
"@babel/types": "^7.17.0",
"@parcel/transformer-vue": "2.7.0",
"@types/jasmine": "file:./private/@types/jasmine",
"@types/jasminewd2": "file:./private/@types/jasmine",
"@typescript-eslint/eslint-plugin": "^5.0.0",
Expand Down
41 changes: 40 additions & 1 deletion yarn.lock
Expand Up @@ -4919,6 +4919,22 @@ __metadata:
languageName: node
linkType: hard

"@parcel/transformer-vue@npm:2.7.0":
version: 2.7.0
resolution: "@parcel/transformer-vue@npm:2.7.0"
dependencies:
"@parcel/diagnostic": 2.7.0
"@parcel/plugin": 2.7.0
"@parcel/source-map": ^2.0.0
"@parcel/utils": 2.7.0
"@vue/compiler-sfc": ^3.2.27
consolidate: ^0.16.0
nullthrows: ^1.1.1
semver: ^5.7.1
checksum: 564c98af47091b2a74e4419884429e66f82cda8ec589193d96c637eb670766ba8d21d1deef16c672bd2907783b7c4659ef53ae62e938da1245406b3c74edcc94
languageName: node
linkType: hard

"@parcel/types@npm:2.7.0":
version: 2.7.0
resolution: "@parcel/types@npm:2.7.0"
Expand Down Expand Up @@ -7911,6 +7927,7 @@ __metadata:
"@babel/preset-env": ^7.14.7
"@babel/register": ^7.10.5
"@babel/types": ^7.17.0
"@parcel/transformer-vue": 2.7.0
"@types/jasmine": "file:./private/@types/jasmine"
"@types/jasminewd2": "file:./private/@types/jasmine"
"@typescript-eslint/eslint-plugin": ^5.0.0
Expand Down Expand Up @@ -9202,7 +9219,7 @@ __metadata:
languageName: node
linkType: hard

"@vue/compiler-sfc@npm:3.2.37":
"@vue/compiler-sfc@npm:3.2.37, @vue/compiler-sfc@npm:^3.2.27":
version: 3.2.37
resolution: "@vue/compiler-sfc@npm:3.2.37"
dependencies:
Expand Down Expand Up @@ -14296,6 +14313,20 @@ __metadata:
languageName: node
linkType: hard

"cypress-terminal-report@npm:^4.1.2":
version: 4.1.2
resolution: "cypress-terminal-report@npm:4.1.2"
dependencies:
chalk: ^4.0.0
fs-extra: ^10.1.0
semver: ^7.3.5
tv4: ^1.3.0
peerDependencies:
cypress: ">=4.10.0"
checksum: e9ca354db3557969c87cd30d93646292d2166740d5f76995e5463779690845f51f7764e4ed405f86c46d685d8969b1dbf54d18518b4d7e08cddb60928c0825a5
languageName: node
linkType: hard

"cypress@npm:^10.0.0":
version: 10.6.0
resolution: "cypress@npm:10.6.0"
Expand Down Expand Up @@ -15334,6 +15365,7 @@ __metadata:
"@uppy/xhr-upload": "workspace:^"
"@uppy/zoom": "workspace:^"
cypress: ^10.0.0
cypress-terminal-report: ^4.1.2
deep-freeze: ^0.0.1
parcel: ^2.0.1
prompts: ^2.4.2
Expand Down Expand Up @@ -35205,6 +35237,13 @@ hexo-filter-github-emojis@arturi/hexo-filter-github-emojis:
languageName: node
linkType: hard

"tv4@npm:^1.3.0":
version: 1.3.0
resolution: "tv4@npm:1.3.0"
checksum: 075096cf3bc2db5727650e16717a343954625c5fde6b2bb5553c86a9a5ca7b9fd287c0f5ab7ac03094f39e982fe9288dc715c7223a90e1684fd2263460a74bbd
languageName: node
linkType: hard

"tweetnacl@npm:^0.14.3, tweetnacl@npm:~0.14.0":
version: 0.14.5
resolution: "tweetnacl@npm:0.14.5"
Expand Down