implement this.redirect in preload (#83)

This commit is contained in:
Rich Harris
2018-02-17 22:56:47 -05:00
parent f8ea9ebda1
commit bff6f550be
7 changed files with 71 additions and 80 deletions

View File

@@ -297,6 +297,33 @@ function run(env) {
assert.ok(matches);
});
});
it('redirects on server', () => {
return nightmare.goto(`${base}/redirect-from`)
.path()
.then(path => {
assert.equal(path, '/redirect-to');
})
.then(() => nightmare.page.title())
.then(title => {
assert.equal(title, 'redirected');
});
});
it('redirects on client', () => {
return nightmare.goto(base)
.wait('[href="/redirect-from"]')
.click('[href="/redirect-from"]')
.wait(200)
.path()
.then(path => {
assert.equal(path, '/redirect-to');
})
.then(() => nightmare.page.title())
.then(title => {
assert.equal(title, 'redirected');
});
});
});
describe('headers', () => {