fix onboarding login glitch (#1118)
This commit is contained in:
1 parent
9befd4abb9
commit
df687009bd
4 files changed
+59
-20
No files matched your search
@@ -45,7 +45,7 @@ export function loginProvider(opts: {
|
||||
if (cachedCookies) {
|
||||
await context.addCookies(cachedCookies);
|
||||
} else {
|
||||
await page.goto("http://localhost:3000/event-types");
|
||||
await page.goto("http://localhost:3000/auth/login");
|
||||
// Click input[name="email"]
|
||||
await page.click('input[name="email"]');
|
||||
// Fill input[name="email"]
|
||||
@@ -57,7 +57,12 @@ export function loginProvider(opts: {
|
||||
// Press Enter
|
||||
await page.press('input[name="password"]', "Enter");
|
||||
|
||||
await page.waitForSelector("[data-testid=event-types]");
|
||||
await page.waitForNavigation({
|
||||
url(url) {
|
||||
return !url.pathname.startsWith("/auth");
|
||||
},
|
||||
});
|
||||
|
||||
const cookies = await context.cookies();
|
||||
cookieCache.set(opts.user, cookies);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import { kont } from "kont";
|
||||
|
||||
import { loginProvider } from "./lib/loginProvider";
|
||||
|
||||
jest.setTimeout(60e3);
|
||||
jest.retryTimes(2);
|
||||
|
||||
const ctx = kont()
|
||||
.useBeforeEach(
|
||||
loginProvider({
|
||||
user: "onboarding",
|
||||
})
|
||||
)
|
||||
.done();
|
||||
|
||||
test("redirects to /getting-started after login", async () => {
|
||||
await ctx.page.waitForNavigation({
|
||||
url(url) {
|
||||
return url.pathname === "/getting-started";
|
||||
},
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user