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

Fix end to end test failures on CI #2341

Merged
merged 5 commits into from
Jun 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions packages/@uppy/dashboard/src/components/AddFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ class AddFiles extends Component {

renderMyDeviceAcquirer = () => {
return (
<div class="uppy-DashboardTab" role="presentation">
<div
class="uppy-DashboardTab"
role="presentation"
data-uppy-acquirer-id="MyDevice"
>
<button
type="button"
class="uppy-DashboardTab-btn"
Expand Down Expand Up @@ -111,7 +115,11 @@ class AddFiles extends Component {

renderAcquirer = (acquirer) => {
return (
<div class="uppy-DashboardTab" role="presentation">
<div
class="uppy-DashboardTab"
role="presentation"
data-uppy-acquirer-id={acquirer.id}
>
<button
type="button"
class="uppy-DashboardTab-btn"
Expand Down
7 changes: 4 additions & 3 deletions test/endtoend/chaos-monkey/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ require('whatwg-fetch')
const Uppy = require('@uppy/core')
const Dashboard = require('@uppy/dashboard')
const Tus = require('@uppy/tus')
const canvasToBlob = require('@uppy/utils/lib/canvasToBlob')

const isOnTravis = !!(process.env.TRAVIS && process.env.CI)
const endpoint = isOnTravis ? 'http://companion.test:1081' : 'http://localhost:1081'
Expand All @@ -20,20 +21,20 @@ window.setup = function (options) {
limit: options.limit
})
uppy.on('file-added', (file) => {
randomColorImage(function (blob) {
randomColorImage().then(function (blob) {
uppy.setFileState(file.id, { preview: URL.createObjectURL(blob) })
})
})

return uppy
}

function randomColorImage (callback) {
function randomColorImage () {
const canvas = document.createElement('canvas')
canvas.width = 140
canvas.height = 140
const context = canvas.getContext('2d')
context.fillStyle = '#xxxxxx'.replace(/x/g, () => '0123456789ABCDEF'[Math.floor(Math.random() * 16)])
context.fillRect(0, 0, 140, 140)
canvas.toBlob(callback)
return canvasToBlob(canvas)
}
2 changes: 1 addition & 1 deletion test/endtoend/create-react-app/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('React: Dashboard', () => {
await toggle()

// open GDrive panel
const gdriveButton = await $('.uppy-DashboardTab:nth-child(1) button')
const gdriveButton = await $('.uppy-DashboardTab[data-uppy-acquirer-id="GoogleDrive"] button')
await gdriveButton.click()
await browser.pause(500)

Expand Down
5 changes: 5 additions & 0 deletions test/endtoend/wdio.local.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ const base = require('./wdio.base.conf')
const args = require('minimist')(process.argv.slice(2))

// Use "npm run test:endtoend:local -- -b chrome" to test in chrome
// "npm run test:endtoend:local -- -b ie" to test in internet explorer
// "npm run test:endtoend:local -- -b firefox -b chrome" to test in FF and chrome
const capabilities = []
if (args.b) {
if (!Array.isArray(args.b)) args.b = [args.b]
args.b.forEach((browserName) => {
// no clue how to write a single argument with internal spaces on windows, so support an alias with no spaces
if (browserName === 'ie') {
browserName = 'internet explorer'
}
capabilities.push({ browserName })
})
}
Expand Down