I just got into puppeteer testing and I have no problem writing one test case where chromium opens a new tab to a website and test the signup process. But when I try to add another test case where I test the sign in process, I have problem getting chromium to open a new tab and do that test.
My code for the first case is like this and it works:
const timeout = some number
describe("test1", () =>{
test("Sign Up", async() =>{
await page.goto(myURL, {waitUntil: "domcontentloaded"});
const navigationPromise = page.waitForNavigation({waitUntil: 'networkidle0'})
some code for steps to signing up
expect signup to be successful and goes to new page
}, timeout);
My code to test the sign in process:
describe("test2", () =>{
test("Sign In", async() =>{
await browser.newPage() //so after the first test i want to open a new tab
await page.goto(myURL, {waitUntil...}); //go to the same url and test this case
const navigationPromise...
some code for signing in process
expect to sign in and goes to new page
}, timeout);
What happens here is that it will test the first case (signup), opens to new blank tab and it stops there and does not go to the url to signin and the test fails. Thanks for the help!