Skip to content

Commit

Permalink
test: Test examples (ipfs#2528)
Browse files Browse the repository at this point in the history
* test: adds automated tests to browser examples

* chore: upgrade chrome

* chore: throw on unhandled rejection

* fix: fail if FAILED is in output

* chore: exit with same exit code as nightwatch

* chore: fix element id

* test: add assertion

* chore: add video streaming test

* chore: change dist url

* chore: build IPFS for basic browser demos

* test: add some node tests

* test: adds some more tests. ethereum one is a little wobbly

* chore: accept bundle as build script

* test: add final few tests

* test: control assertion timeouts with global

* test: wait for other peer to join workspace before sending file

* chore: tidy up deps
  • Loading branch information
achingbrain authored Oct 11, 2019
1 parent f6ea050 commit ecbed9d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"ipfs-css": "^0.13.1",
"react": "^16.8.0",
"react-dom": "^16.8.0",
"react-scripts": "3.1.1",
"react-scripts": "^3.2.0",
"tachyons": "^4.11.1"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ const IpfsId = (props) => {
if (!props) return null
return (
<section className='bg-snow mw7 center mt5'>
<h1 className='f3 fw4 ma0 pv3 aqua montserrat tc'>Connected to IPFS</h1>
<h1 className='f3 fw4 ma0 pv3 aqua montserrat tc' data-test='title'>Connected to IPFS</h1>
<div className='pa4'>
{['id', 'agentVersion'].map((key) => (
<div className='mb4' key={key}>
<Title>{key}</Title>
<div className='bg-white pa2 br2 truncate monospace'>{props[key]}</div>
<div className='bg-white pa2 br2 truncate monospace' data-test={key}>{props[key]}</div>
</div>
))}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/use-ipfs-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function useIpfsFactory ({ commands }) {
return function cleanup () {
if (ipfs && ipfs.stop) {
console.log('Stopping IPFS')
ipfs.stop()
ipfs.stop().catch(err => console.error(err))
setIpfsReady(false)
}
}
Expand Down
16 changes: 16 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict'

const pkg = require('./package.json')

module.exports = {
[pkg.name]: function (browser) {
browser
.url(process.env.IPFS_EXAMPLE_TEST_URL)
.waitForElementVisible('[data-test=title]')
.assert.containsText('[data-test=title]', 'Connected to IPFS')
.assert.elementPresent('[data-test=id')
.assert.elementPresent('[data-test=agentVersion')
.end()
}
}

0 comments on commit ecbed9d

Please sign in to comment.