I am trying to create a function like this in playwright. By the way, I am new to playwright.
import { expect } from "@playwright/test";
import { EnvCredentials } from "../helpers/getEnvCredentials";
export class PW {
static async visit(page, routeName) {
await page.goto(EnvCredentials.getCredsValue("BASE_URL") + routeName);
}
}
That visit() method above is being called in this function
static async uiLogin(username, password, page) {
const loginPage = new LoginPage(page);
PW.visit(page, route_root_page);
await loginPage.enterUsername(username);
await loginPage.enterPassword(password);
await loginPage.clickLoginBtn();
}
Upon running, I am getting this error
Error: page.goto: Test ended.
Call log:
- navigating to “https://latest.frankiefinancial.io/”, waiting until “load”
at portalhelpersplaywrightMethods.ts:6
4 | export class PW {
5 | static async visit(page, routeName) {
6 | await page.goto(EnvCredentials.getCredsValue(“BASE_URL”) + routeName);
| ^
7 | }
8 |