Skip to content

Commit

Permalink
e2e: add tests for AWS
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed May 16, 2022
1 parent f325fb2 commit e8c39a0
Show file tree
Hide file tree
Showing 9 changed files with 102 additions and 2 deletions.
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
4 changes: 4 additions & 0 deletions .github/workflows/e2e.yml
Expand Up @@ -49,6 +49,10 @@ jobs:
VITE_TRANSLOADIT_SECRET: ${{secrets.TRANSLOADIT_SECRET}}
VITE_TRANSLOADIT_TEMPLATE: ${{secrets.TRANSLOADIT_TEMPLATE}}
VITE_TRANSLOADIT_SERVICE_URL: ${{secrets.TRANSLOADIT_SERVICE_URL}}
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}}
- 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
13 changes: 13 additions & 0 deletions e2e/cypress/integration/dashboard-aws-multipart.spec.ts
@@ -0,0 +1,13 @@
describe('dashboard-aws', () => {
beforeEach(() => {
cy.visit('/dashboard-aws')
cy.get('.uppy-Dashboard-input').as('file-input')
})

it('should upload cat image successfully', () => {
cy.get('@file-input').attachFile('images/cat.jpg')
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-aws', () => {
beforeEach(() => {
cy.visit('/dashboard-aws')
cy.get('.uppy-Dashboard-input').as('file-input')
})

it('should upload cat image successfully', () => {
cy.get('@file-input').attachFile('images/cat.jpg')
cy.get('.uppy-StatusBar-actionBtn--upload').click()

cy.get('.uppy-StatusBar-statusPrimary').should('contain', 'Complete')
})
})

0 comments on commit e8c39a0

Please sign in to comment.