return a promise from init - fixes #99

This commit is contained in:
Rich Harris
2018-01-20 19:49:41 -05:00
parent 4590aa313c
commit a09c33d6a5
4 changed files with 49 additions and 44 deletions

View File

@@ -183,7 +183,7 @@ function run(env) {
});
it('navigates to a new page without reloading', () => {
return nightmare.goto(base).init().wait(200)
return nightmare.goto(base).init().wait(100)
.then(() => {
return capture(() => nightmare.click('a[href="/about"]'));
})
@@ -204,7 +204,6 @@ function run(env) {
return nightmare
.goto(`${base}/about`)
.init()
.wait(100)
.click('.goto')
.wait(() => window.location.pathname === '/blog/what-is-sapper')
.wait(100)
@@ -218,7 +217,6 @@ function run(env) {
return nightmare
.goto(`${base}/about`)
.init()
.wait(100)
.then(() => {
return capture(() => {
return nightmare
@@ -235,7 +233,6 @@ function run(env) {
return nightmare
.goto(`${base}/blog/a-very-long-post#four`)
.init()
.wait(100)
.evaluate(() => window.scrollY)
.then(scrollY => {
assert.ok(scrollY > 0, scrollY);
@@ -246,7 +243,6 @@ function run(env) {
return nightmare
.goto(`${base}/blog`)
.init()
.wait(200)
.then(() => {
return capture(() => {
return nightmare
@@ -310,7 +306,7 @@ function run(env) {
it('calls a delete handler', () => {
return nightmare
.goto(`${base}/delete-test`)
.init().wait(100)
.init()
.click('.del')
.wait(() => window.deleted)
.evaluate(() => window.deleted.id)
@@ -325,7 +321,7 @@ function run(env) {
.evaluate(() => {
window.el = document.querySelector('.hydrate-test');
})
.init().wait(100)
.init()
.evaluate(() => {
return document.querySelector('.hydrate-test') === window.el;
})