Skip to content

Commit ecbed9d

Browse files
authored
test: Test examples (ipfs#2528)
* 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
1 parent f6ea050 commit ecbed9d

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"ipfs-css": "^0.13.1",
99
"react": "^16.8.0",
1010
"react-dom": "^16.8.0",
11-
"react-scripts": "3.1.1",
11+
"react-scripts": "^3.2.0",
1212
"tachyons": "^4.11.1"
1313
},
1414
"scripts": {

src/App.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ const IpfsId = (props) => {
3636
if (!props) return null
3737
return (
3838
<section className='bg-snow mw7 center mt5'>
39-
<h1 className='f3 fw4 ma0 pv3 aqua montserrat tc'>Connected to IPFS</h1>
39+
<h1 className='f3 fw4 ma0 pv3 aqua montserrat tc' data-test='title'>Connected to IPFS</h1>
4040
<div className='pa4'>
4141
{['id', 'agentVersion'].map((key) => (
4242
<div className='mb4' key={key}>
4343
<Title>{key}</Title>
44-
<div className='bg-white pa2 br2 truncate monospace'>{props[key]}</div>
44+
<div className='bg-white pa2 br2 truncate monospace' data-test={key}>{props[key]}</div>
4545
</div>
4646
))}
4747
</div>

src/hooks/use-ipfs-factory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default function useIpfsFactory ({ commands }) {
2525
return function cleanup () {
2626
if (ipfs && ipfs.stop) {
2727
console.log('Stopping IPFS')
28-
ipfs.stop()
28+
ipfs.stop().catch(err => console.error(err))
2929
setIpfsReady(false)
3030
}
3131
}

test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'use strict'
2+
3+
const pkg = require('./package.json')
4+
5+
module.exports = {
6+
[pkg.name]: function (browser) {
7+
browser
8+
.url(process.env.IPFS_EXAMPLE_TEST_URL)
9+
.waitForElementVisible('[data-test=title]')
10+
.assert.containsText('[data-test=title]', 'Connected to IPFS')
11+
.assert.elementPresent('[data-test=id')
12+
.assert.elementPresent('[data-test=agentVersion')
13+
.end()
14+
}
15+
}
16+

0 commit comments

Comments
 (0)