diff --git a/test/app/routes/index.html b/test/app/routes/index.html index cb37b8c..b695afe 100644 --- a/test/app/routes/index.html +++ b/test/app/routes/index.html @@ -8,6 +8,7 @@ about slow preload redirect +redirect (root) broken link error link credentials diff --git a/test/app/routes/redirect-root.html b/test/app/routes/redirect-root.html new file mode 100644 index 0000000..ddd4b49 --- /dev/null +++ b/test/app/routes/redirect-root.html @@ -0,0 +1,7 @@ + diff --git a/test/common/test.js b/test/common/test.js index c46751f..70bf890 100644 --- a/test/common/test.js +++ b/test/common/test.js @@ -436,6 +436,33 @@ function run({ mode, basepath = '' }) { }); }); + it('redirects on server (root)', () => { + return nightmare.goto(`${base}/redirect-root`) + .path() + .then(path => { + assert.equal(path, `${basepath}/`); + }) + .then(() => nightmare.page.title()) + .then(title => { + assert.equal(title, 'Great success!'); + }); + }); + + it('redirects in client (root)', () => { + return nightmare.goto(base) + .wait('[href="redirect-root"]') + .click('[href="redirect-root"]') + .wait(200) + .path() + .then(path => { + assert.equal(path, `${basepath}/`); + }) + .then(() => nightmare.page.title()) + .then(title => { + assert.equal(title, 'Great success!'); + }); + }); + it('handles 4xx error on server', () => { return nightmare.goto(`${base}/blog/nope`) .path()