Skip to content

Commit c91c27b

Browse files
committed
remove all import of local settings.json
1 parent 729f4c8 commit c91c27b

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

pages/BasePage.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Page, Locator, expect } from "@playwright/test";
2-
import settings from "../tests/config/settings.json";
32

43
export class BasePage{
54
readonly page:Page;
@@ -22,7 +21,7 @@ export class BasePage{
2221
}
2322

2423
async navigateToHome(){
25-
await this.page.goto(settings.HOME_URL);
24+
await this.page.goto(process.env.BASE_URL!);
2625
}
2726

2827
async navigateToLogin(){

pages/RegistrationPage.ts

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Page, Locator, expect } from "@playwright/test";
2-
import settings from "../tests/config/settings.json";
32
import { faker } from "@faker-js/faker/locale/en";
43

54
export class RegistrationPage {
@@ -17,6 +16,7 @@ export class RegistrationPage {
1716
readonly countryDropdown: Locator;
1817
readonly registerButton: Locator;
1918
readonly loginHeader: Locator;
19+
readonly registrationUrl: string;
2020

2121
constructor(page: Page) {
2222
this.page = page;
@@ -33,34 +33,35 @@ export class RegistrationPage {
3333
this.countryDropdown = page.locator("select#country");
3434
this.registerButton = page.locator("//button[@type='submit']");
3535
this.loginHeader = page.locator("//h3[text()='Login']");
36+
this.registrationUrl = `${process.env.BASE_URL}/auth/register`;
3637
}
3738

38-
async navigateToRegistration() {
39-
await this.page.goto(settings.REGISTRATION_URL);
40-
}
39+
async navigateToRegistration() {
40+
await this.page.goto(this.registrationUrl);
41+
}
4142

42-
async fillRegistrationForm() {
43-
await this.firstNameInput.fill(faker.person.firstName());
44-
await this.lastNameInput.fill(faker.person.lastName());
45-
await this.dobInput.fill("1990-01-01");
46-
await this.streetInput.fill(faker.location.streetAddress());
47-
await this.postalCodeInput.fill(faker.location.zipCode());
48-
await this.cityInput.fill(faker.location.city());
49-
await this.stateInput.fill(faker.location.state());
50-
await this.countryDropdown.selectOption({ label: "Canada" });
51-
const phoneNumber = faker.string.numeric(10);
52-
await this.phoneInput.fill(phoneNumber);
53-
await this.emailInput.fill(faker.internet.email());
54-
await this.passwordInput.fill(settings.PASSWORD);
55-
}
43+
async fillRegistrationForm() {
44+
await this.firstNameInput.fill(faker.person.firstName());
45+
await this.lastNameInput.fill(faker.person.lastName());
46+
await this.dobInput.fill("1990-01-01");
47+
await this.streetInput.fill(faker.location.streetAddress());
48+
await this.postalCodeInput.fill(faker.location.zipCode());
49+
await this.cityInput.fill(faker.location.city());
50+
await this.stateInput.fill(faker.location.state());
51+
await this.countryDropdown.selectOption({ label: "Canada" });
52+
const phoneNumber = faker.string.numeric(10);
53+
await this.phoneInput.fill(phoneNumber);
54+
await this.emailInput.fill(faker.internet.email());
55+
await this.passwordInput.fill(process.env.PASSWORD!);
56+
}
5657

57-
async clickRegisterButton() {
58-
await this.registerButton.click();
59-
}
58+
async clickRegisterButton() {
59+
await this.registerButton.click();
60+
}
6061

61-
async verifyRedirectionToLogin() {
62-
await this.loginHeader.waitFor({ state: "visible", timeout: 2000 });
63-
expect(this.page.url()).toBe(settings.LOGIN_URL);
64-
expect(await this.loginHeader.textContent()).toBe("Login");
65-
}
62+
async verifyRedirectionToLogin() {
63+
await this.loginHeader.waitFor({ state: "visible", timeout: 2000 });
64+
expect(this.page.url()).toBe(`${process.env.BASE_URL}/auth/login`);
65+
expect(await this.loginHeader.textContent()).toBe("Login");
66+
}
6667
}

0 commit comments

Comments
 (0)