I'm trying to test that the application redirects the user away from the authenticated route since they are not an admin.
But I need a way to wait for all redirects to finish before I call 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;
});
});