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 e2e-test on master #873

Merged
merged 10 commits into from
Nov 5, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ exports.handler = async function({

const roles = roleIds.map(id => ({
id,
bytes: '0x' + keccak256(id),
bytes: keccak256(id),
name: '', // Name and params can't be extracted from solidity file, must be filled in manually
params: [],
}))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const ANSWERS = POSITIVE_ANSWERS.concat(NEGATIVE_ANSWERS)
const getMajor = version => version.split('.')[0]

const getRoles = roles =>
roles.map(role => Object.assign(role, { bytes: '0x' + keccak256(role.id) }))
roles.map(role => Object.assign(role, { bytes: keccak256(role.id) }))

async function getEnvironments(cwd) {
const arappManifestPath = path.resolve(cwd, ARAPP_FILE)
Expand Down
63 changes: 0 additions & 63 deletions packages/e2e-tests/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions packages/e2e-tests/src/cli/dao-id-assign.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ test('assigns an Aragon Id to a DAO address', async t => {

const assignIdResult = await execa('aragon', ['dao', 'id', 'assign', daoAddress, 'newdao2', '--debug'])

const resultSnapshot = normalizeOutput(assignIdResult.stdout)
.replace(daoAddress, '') // Remove daoAddress from snapshot


t.snapshot(resultSnapshot)
t.true(assignIdResult.stdout.includes('successfully assigned to'))
})


16 changes: 0 additions & 16 deletions packages/e2e-tests/src/cli/dao-id-assign.test.js.md

This file was deleted.

Binary file removed packages/e2e-tests/src/cli/dao-id-assign.test.js.snap
Binary file not shown.
20 changes: 8 additions & 12 deletions packages/e2e-tests/src/cli/dao-new.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ const daoIdAndAddressAddressRegex = /Created DAO\: (.*) at (.*)$/
test('creates a new DAO', async t => {
t.plan(2)

const result = await execa('aragon', ['dao', 'new', '--debug'])
const result = await execa('aragon', ['dao', 'new'])
const daoAddress = result.stdout.match(daoAddressRegex)[1]

const resultSnapshot = normalizeOutput(result.stdout)
.replace(daoAddress, '')


const resultSnapshot = normalizeOutput(result.stdout).replace(daoAddress, '')

t.assert(/0x[a-fA-F0-9]{40}/.test(daoAddress), 'Invalid DAO address')
t.snapshot(resultSnapshot)
Expand All @@ -22,13 +20,11 @@ test('creates a new DAO', async t => {
test('assigns an Aragon Id with the "--aragon-id" param', async t => {
t.plan(3)

const result = await execa('aragon', ['dao', 'new', '--debug', '--aragon-id', 'newdao1' ])
const [,daoId, daoAddress] = result.stdout.match(daoIdAndAddressAddressRegex)

const resultSnapshot = normalizeOutput(result.stdout)
.replace(daoAddress, '')


const result = await execa('aragon', ['dao', 'new', '--aragon-id', 'newdao1'])
const [, daoId, daoAddress] = result.stdout.match(daoIdAndAddressAddressRegex)

const resultSnapshot = normalizeOutput(result.stdout).replace(daoAddress, '')

t.assert(daoId === `newdao1.aragonid.eth`, 'Invalid Aragon Id')
t.assert(/0x[a-fA-F0-9]{40}/.test(daoAddress), 'Invalid DAO address')
t.snapshot(resultSnapshot)
Expand Down
6 changes: 2 additions & 4 deletions packages/e2e-tests/src/cli/dao-new.test.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ Generated by [AVA](https://ava.li).

> Snapshot 1

`> Could not find 'arapp.json'. Using the default configuration to connect to development.␊
Fetching template bare-template.aragonpm.eth@latest [started]␊
`Fetching template bare-template.aragonpm.eth@latest [started]␊
Fetching template bare-template.aragonpm.eth@latest [completed]␊
Create new DAO from template [started]␊
Create new DAO from template [completed]␊
Expand All @@ -27,8 +26,7 @@ Generated by [AVA](https://ava.li).

> Snapshot 1

`> Could not find 'arapp.json'. Using the default configuration to connect to development.␊
Fetching template bare-template.aragonpm.eth@latest [started]␊
`Fetching template bare-template.aragonpm.eth@latest [started]␊
Fetching template bare-template.aragonpm.eth@latest [completed]␊
Create new DAO from template [started]␊
Create new DAO from template [completed]␊
Expand Down
Binary file modified packages/e2e-tests/src/cli/dao-new.test.js.snap
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/e2e-tests/src/cli/devchain.pretest.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ test('should spawn ganache', async t => {
})

// assert
t.snapshot(normalizeOutput(stdout))
t.true(stdout.includes('Devchain running at'))
// TODO check with web3 if it's all good??
})
45 changes: 0 additions & 45 deletions packages/e2e-tests/src/cli/devchain.pretest.js.md

This file was deleted.

Binary file removed packages/e2e-tests/src/cli/devchain.pretest.js.snap
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/e2e-tests/src/cli/help.test.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Generated by [AVA](https://ava.li).
[default: "http://localhost:8080/ipfs"]␊
Options:␊
--version Show version number [boolean]␊
--silent Silence output to terminal [boolean] [default: false]␊
--debug Show more output to terminal [boolean] [default: false]␊
--gas-price Gas price in Gwei [default: "2"]␊
Expand All @@ -58,7 +59,6 @@ Generated by [AVA](https://ava.li).
--apm␊
--env, --environment The environment in your arapp.json that you want to use␊
-h, --help Show help [boolean]␊
-v, --version Show version number [boolean]␊
For more information, check out https://hack.aragon.org`,
timedOut: false,
Expand Down
Binary file modified packages/e2e-tests/src/cli/help.test.js.snap
Binary file not shown.
4 changes: 2 additions & 2 deletions packages/e2e-tests/src/cli/ipfs.pretest.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ test('should spawn ipfs', async t => {
const body = await res.text()

// assert
t.snapshot(normalizeOutput(stdout))
t.snapshot(JSON.parse(body).Version)
t.true(stdout.includes('IPFS daemon is now running'))
t.is(JSON.parse(body).Version, '0.4.22')
// TODO check that ipfs pins our aragen-cache
})
16 changes: 0 additions & 16 deletions packages/e2e-tests/src/cli/ipfs.pretest.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,3 @@ Generated by [AVA](https://ava.li).
✔ Success!␊
i Try it out with: npx ipfs version`

## should spawn ipfs

> Snapshot 1

`> Could not find 'arapp.json'. Using the default configuration to connect to development.␊
Start IPFS [started]␊
→ Starting IPFS at port: 5001␊
Start IPFS [completed]␊
Add local files [started]␊
Add local files [completed]␊
i IPFS daemon is now running. Stopping this process will stop IPFS`

> Snapshot 2

'0.4.22'
Binary file modified packages/e2e-tests/src/cli/ipfs.pretest.js.snap
Binary file not shown.
29 changes: 3 additions & 26 deletions packages/e2e-tests/src/cli/run.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const testSandbox = './.tmp'
const projectName = 'foobar'

test('should run an aragon app successfully', async t => {
t.plan(3)
t.plan(2)

// Node.js 11 fix (https://github.com/aragon/aragon-cli/issues/731)
fs.writeFileSync(path.join(testSandbox, projectName, 'truffle.js'), `
Expand Down Expand Up @@ -42,34 +42,11 @@ test('should run an aragon app successfully', async t => {

// TODO: fetch the counter app instead
const fetchResult = await fetch(`http://localhost:3000/#/${daoAddress}`)
const fetchBody = await fetchResult.text()

// cleanup
await exit()

// delete some output sections that are not deterministic
const appBuildOutput = stdout.substring(
stdout.indexOf('Building frontend [started]'),
stdout.indexOf('Building frontend [completed]')
)
const publishOutput = stdout.substring(
stdout.indexOf('Publish app to aragonPM [started]'),
stdout.indexOf('Publish app to aragonPM [completed]')
)

const wrapperInstallOutput = stdout.substring(
stdout.indexOf('Fetching client from aragen [started]'),
stdout.indexOf('Starting Aragon client [started]')
)

const outputToSnapshot = stdout
.replace(publishOutput, '[deleted-publish-output]')
.replace(appBuildOutput, '[deleted-app-build-output]')
.replace(wrapperInstallOutput, '[deleted-wrapper-install-output]')
.replace(new RegExp(daoAddress, 'g'), '[deleted-dao-address]')

// assert
t.snapshot(normalizeOutput(outputToSnapshot))
t.snapshot(fetchResult.status)
t.snapshot(fetchBody)
t.true(stdout.includes('You are now ready to open your app in Aragon'))
t.is(fetchResult.status, 200)
})
Loading