Skip to content

Commit

Permalink
test(e2e): more reliable api test suite
Browse files Browse the repository at this point in the history
This changes the way we enter API address/config from programmatic
to full simulation of user input and adds tiny slow down between each
key stroke.

This should solve the problem of newly added UI feedback not engaging,
and make CI both more reliable and green again.

While at it, made it CI-agnostic, in preparation for move to
GithubActions
  • Loading branch information
lidel committed Dec 14, 2020
1 parent e59f689 commit 7089d93
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions test/e2e/jest-puppeteer.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const debug = process.env.DEBUG === 'true'
const travis = process.env.TRAVIS === 'true'
const ci = process.env.TRAVIS === 'true' || process.env.CI === 'true'
module.exports = {
launch: {
dumpio: debug, // print all IO to the console
headless: (!debug || travis), // show browser window when in debug mode
slowMo: debug ? 50 : undefined // slow down scripted tests when debugging in non-headless mode
headless: (!debug || ci), // show browser window when in debug mode
slowMo: debug ? 50 : 5 // slow down scripted tests when debugging in non-headless mode
}
}
4 changes: 2 additions & 2 deletions test/e2e/remote-api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ const switchIpfsApiEndpointViaSettings = async (endpoint) => {
await page.goto(webuiUrl + '#/settings')
const selector = 'input[id="api-address"]'
await page.waitForSelector(selector)
await page.evaluate(s => { document.querySelector(s).value = '' }, selector)
await page.click(selector, { clickCount: 3 }) // select all
await page.type(selector, endpoint)
await page.keyboard.type('\n')
await page.type(selector, '\n')
await waitForIpfsApiEndpoint(endpoint)
await page.reload()
}
Expand Down

0 comments on commit 7089d93

Please sign in to comment.