我正在尝试测试应用程序是否将用户重定向到经过身份验证的路由,因为他们不是管理员。
但是我需要一种方法来等待所有重定向完成,然后再打电话getCurrentUrl()
it('should not allow regular user access', async (test) => {
await test.remote
.then(e2e.impersonate('test@test.com'))
.get('/protected-route')
//.waitForAllRedirects()
.getCurrentUrl()
.then(url => {
console.log('url', url);
expect(url.indexOf('/landing-page')).not.toBe(-1);
return true;
});
});