1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00

Fix integration tests

This commit is contained in:
Alexander Tseung 2018-04-04 18:21:30 -07:00
parent 7776af7cd0
commit 037d6e6624
3 changed files with 28 additions and 7 deletions

View File

@ -36,15 +36,28 @@ log.setLevel('debug')
// //
const qs = require('qs') const qs = require('qs')
let queryString = qs.parse(window.location.href.split('#')[1]) const routerPath = window.location.href.split('#')[1]
let selectedView = queryString.view || 'first time' let queryString = {}
let selectedView
if (routerPath) {
queryString = qs.parse(routerPath.split('?')[1])
}
selectedView = queryString.view || 'first time'
const firstState = states[selectedView] const firstState = states[selectedView]
updateQueryParams(selectedView) updateQueryParams(selectedView)
function updateQueryParams(newView) { function updateQueryParams (newView) {
queryString.view = newView queryString.view = newView
const params = qs.stringify(queryString) const params = qs.stringify(queryString)
window.location.href = window.location.href.split('#')[0] + `#${params}` const locationPaths = window.location.href.split('#')
const routerPath = locationPaths[1] || ''
const newPath = locationPaths[0] + '#' + routerPath.split('?')[0] + `?${params}`
if (window.location.href !== newPath) {
window.location.href = newPath
}
} }
// //

View File

@ -6,7 +6,7 @@ import classnames from 'classnames'
import shuffle from 'lodash.shuffle' import shuffle from 'lodash.shuffle'
import { compose } from 'recompose' import { compose } from 'recompose'
import Identicon from '../../../../ui/app/components/identicon' import Identicon from '../../../../ui/app/components/identicon'
import { confirmSeedWords } from '../../../../ui/app/actions' import { confirmSeedWords, showModal } from '../../../../ui/app/actions'
import Breadcrumbs from './breadcrumbs' import Breadcrumbs from './breadcrumbs'
import LoadingScreen from './loading-screen' import LoadingScreen from './loading-screen'
import { DEFAULT_ROUTE } from '../../../../ui/app/routes' import { DEFAULT_ROUTE } from '../../../../ui/app/routes'
@ -18,6 +18,7 @@ class ConfirmSeedScreen extends Component {
seedWords: PropTypes.string, seedWords: PropTypes.string,
confirmSeedWords: PropTypes.func, confirmSeedWords: PropTypes.func,
history: PropTypes.object, history: PropTypes.object,
openBuyEtherModal: PropTypes.func,
}; };
static defaultProps = { static defaultProps = {
@ -42,10 +43,13 @@ class ConfirmSeedScreen extends Component {
} }
handleClick () { handleClick () {
const { confirmSeedWords, history } = this.props const { confirmSeedWords, history, openBuyEtherModal } = this.props
confirmSeedWords() confirmSeedWords()
.then(() => history.push(DEFAULT_ROUTE)) .then(() => {
history.push(DEFAULT_ROUTE)
openBuyEtherModal()
})
} }
render () { render () {
@ -141,6 +145,7 @@ export default compose(
}), }),
dispatch => ({ dispatch => ({
confirmSeedWords: () => dispatch(confirmSeedWords()), confirmSeedWords: () => dispatch(confirmSeedWords()),
openBuyEtherModal: () => dispatch(showModal({ name: 'DEPOSIT_ETHER'})),
}) })
) )
)(ConfirmSeedScreen) )(ConfirmSeedScreen)

View File

@ -13,6 +13,9 @@ async function runFirstTimeUsageTest (assert, done) {
await skipNotices(app) await skipNotices(app)
const welcomeButton = (await findAsync(app, '.welcome-screen__button'))[0]
welcomeButton.click()
// Scroll through terms // Scroll through terms
const title = (await findAsync(app, '.create-password__title')).text() const title = (await findAsync(app, '.create-password__title')).text()
assert.equal(title, 'Create Password', 'create password screen') assert.equal(title, 'Create Password', 'create password screen')