Skip to content

Commit

Permalink
Merge pull request #1671 from cosmos/fedekunze/1578-e2e-submit-proposals
Browse files Browse the repository at this point in the history
fedekunze/1578 e2e submit proposals & staking parameters
  • Loading branch information
faboweb authored Dec 3, 2018
2 parents 8e97c81 + 290a064 commit 9817665
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 27 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- [\#1573](https://github.com/cosmos/voyager/issues/1573) added remote error collection for several catched errors in Voyager @faboweb
- [\#1632](https://github.com/cosmos/voyager/pull/1632) added FAQ about broken symlink to networks folder @faboweb
- [\#1198](https://github.com/cosmos/voyager/pull/1198) added e2e tests for wallet and staking transactions @faboweb
- [\#1578](https://github.com/cosmos/voyager/issues/1578) added e2e tests for submit governance proposals @fedekunze
- [\#1672](https://github.com/cosmos/voyager/issues/1672) added e2e tests for staking parameters tab @fedekunze

### Changed

Expand Down
14 changes: 7 additions & 7 deletions app/src/renderer/components/staking/TabParameters.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div v-if="config.devMode">
<div>
<h3>
<h3 class="staking-pool">
Staking Pool
<i
v-tooltip.top="poolTooltips.description"
Expand All @@ -21,7 +21,7 @@
>info_outline</i
>
</dt>
<dd>
<dd id="loose_tokens">
{{ pool.pool.loose_tokens ? pool.pool.loose_tokens : `n/a` }}
</dd>
</dl>
Expand All @@ -36,7 +36,7 @@
>info_outline</i
>
</dt>
<dd>
<dd id="bonded_tokens">
{{ pool.pool.bonded_tokens ? pool.pool.bonded_tokens : `n/a` }}
</dd>
</dl>
Expand All @@ -45,7 +45,7 @@
</div>
</div>
<div>
<h3>
<h3 class="staking-parameters">
Staking Parameters
<i
v-tooltip.top="paramsTooltips.description"
Expand All @@ -65,7 +65,7 @@
>info_outline</i
>
</dt>
<dd>
<dd id="unbonding_time">
{{
parameters.parameters.unbonding_time
? unbondingTimeInDays + ` days`
Expand All @@ -75,7 +75,7 @@
</dl>
<dl class="info_dl">
<dt>Current Staking Coin Denomination</dt>
<dd>
<dd id="bond_denom">
{{
parameters.parameters.bond_denom
? parameters.parameters.bond_denom
Expand All @@ -87,7 +87,7 @@
<div class="column">
<dl class="info_dl">
<dt>Maximum Number of Validators</dt>
<dd>
<dd id="max_validators">
{{
parameters.parameters.max_validators
? parameters.parameters.max_validators
Expand Down
60 changes: 47 additions & 13 deletions test/e2e/delegation.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
let test = require(`tape-promise/tape`)
let { getApp, restart } = require(`./launch.js`)
let { navigate, login, sleep, waitForText } = require(`./common.js`)
let {
navigate,
login,
sleep,
waitForText,
closeNotifications
} = require(`./common.js`)
/*
* NOTE: don't use a global `let client = app.client` as the client object changes when restarting the app
*/
Expand Down Expand Up @@ -94,6 +100,7 @@ test(`delegation`, async function(t) {
() => app.client.$(`.header-balance .unbonded-atoms h2`),
`${unbondedAtoms - 10}.0000…`
)
await closeNotifications(app)

// Shouldn't be necessary but see
// https://github.com/jprichardson/tape-promise/issues/17#issuecomment-425276035.
Expand Down Expand Up @@ -128,6 +135,7 @@ test(`delegation`, async function(t) {

// Go back to Staking page.
.click(`//a//*[. = 'Staking']`)
await closeNotifications(app)

// Shouldn't be necessary but see
// https://github.com/jprichardson/tape-promise/issues/17#issuecomment-425276035.
Expand All @@ -153,18 +161,44 @@ test(`delegation`, async function(t) {
t.end()
})

// TODO uncomment when redelegation tab is added again
// t.test(`Parameters`, async function(t) {
// // Select the Parameters tab.
// await app.client.click(`//a[. = 'Parameters']`)
//
// await t.notOk(
// await app.client.waitForExist(`.tm-notification`, 2 * 1000),
// `should not get an notification error while fetching params and pool`
// )
//
// t.end()
// })
t.test(`Parameters`, async function(t) {
await navigate(app, `Staking`)
await app.client.click(`//a[. = 'Parameters']`)
await t.ok(
await app.client.waitForVisible(
`//h3[contains(text(), "Staking Pool")]`,
1000
),
`Shows staking pool`
)
await t.ok(
await app.client.waitForVisible(
`//h3[contains(text(), "Staking Parameters")]`,
1000
),
`Shows staking parameters`
)
await t.ok(
!(await app.client.isExisting(`//dd[contains(text(), "n/a")]`)),
`all parameters and pool fields are defined`
)
await t.ok(
!(await app.client.isExisting(`.tm-notification`, 4 * 1000)),
`should not get an notification error while fetching params and pool`
)
// test that the parameters and pool values are displayed
await t.equal(
await app.client.$(`#loose_tokens`).getText(),
`25.0000000000`,
`display pool values`
)
await t.equal(
await app.client.$(`#max_validators`).getText(),
`100`,
`display params values`
)
t.end()
})

t.end()
})
60 changes: 60 additions & 0 deletions test/e2e/governance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
"use strict"

let test = require(`tape-promise/tape`)
let { getApp, restart } = require(`./launch.js`)
let { navigate, login } = require(`./common.js`)
/*
* NOTE: don't use a global `let client = app.client` as the client object changes when restarting the app
*/

test(`Governance`, async function(t) {
let { app } = await getApp(t)
await restart(app)
let $ = (...args) => app.client.$(...args)

await login(app, `testkey`)
await navigate(app, `Governance`)

t.test(`display no proposals message`, async function(t) {
t.equal(
(await app.client.$$(`.li-proposal`)).length,
0,
`it doesn't show any proposal`
)
await $(`div*=No Governance Proposals`).waitForExist()
t.pass(`correct message when there are no proposals`)
t.end()
})

t.test(`submit proposal`, async function(t) {
await app.client.$(`#propose-btn`).click()
await t.ok(
await app.client.$(`#modal-propose`).isVisible(),
`opens modal proposal`
)
await app.client.setValue(`#title`, `E2E test proposal title`)
await app.client.setValue(`#description`, `E2E test proposal title`)
await app.client.setValue(`#amount`, `10`)
await t.ok(
await app.client
.click(`//button/*[. = 'Submit proposal']`)
.waitForVisible(
`//*[. = 'You have successfully submitted a new text proposal']`,
5 * 1000
),
`successful proposal submission`
)
t.equal(
(await app.client.$$(`.li-proposal`)).length,
1,
`displays the proposal table with one element`
)
await t.ok(
await app.client.$(`a*=E2E test proposal title`).isVisible(),
`shows the newly created proposal`
)
t.end()
})

t.end()
})
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`TabParameters has the expected html structure 1`] = `
"<div>
<div>
<h3>
<h3 class=\\"staking-pool\\">
Staking Pool <i class=\\"material-icons info-button\\">info_outline</i>
</h3>
<div class=\\"parameters__details parameters__section\\">
Expand All @@ -13,7 +13,7 @@ exports[`TabParameters has the expected html structure 1`] = `
<dt>
Loose steak <i class=\\"material-icons info-button\\">info_outline</i>
</dt>
<dd>
<dd id=\\"loose_tokens\\">
100.0000000000
</dd>
</dl>
Expand All @@ -23,7 +23,7 @@ exports[`TabParameters has the expected html structure 1`] = `
<dt>
Delegated steak <i class=\\"material-icons info-button\\">info_outline</i>
</dt>
<dd>
<dd id=\\"bonded_tokens\\">
50.0000000000
</dd>
</dl>
Expand All @@ -32,7 +32,7 @@ exports[`TabParameters has the expected html structure 1`] = `
</div>
</div>
<div>
<h3>
<h3 class=\\"staking-parameters\\">
Staking Parameters <i class=\\"material-icons info-button\\">info_outline</i>
</h3>
<div class=\\"parameters__details parameters__section\\">
Expand All @@ -42,15 +42,15 @@ exports[`TabParameters has the expected html structure 1`] = `
<dt>
Unbonding Time <i class=\\"material-icons info-button\\">info_outline</i>
</dt>
<dd>
<dd id=\\"unbonding_time\\">
3 days
</dd>
</dl>
<dl class=\\"info_dl\\">
<dt>
Current Staking Coin Denomination
</dt>
<dd>
<dd id=\\"bond_denom\\">
steak
</dd>
</dl>
Expand All @@ -60,7 +60,7 @@ exports[`TabParameters has the expected html structure 1`] = `
<dt>
Maximum Number of Validators
</dt>
<dd>
<dd id=\\"max_validators\\">
100
</dd>
</dl>
Expand Down

0 comments on commit 9817665

Please sign in to comment.