-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e1ba825
commit 37853f8
Showing
7 changed files
with
245 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,33 @@ | ||
import { LandingPage } from "../pages/landingPage"; | ||
import { AuthPage } from "../pages/authPage"; | ||
import { test as baseTest } from '@playwright/test' | ||
import { DashboardPage } from "../pages/dashboardPage"; | ||
import { SubscriptionPaymentPage } from "../pages/subscriptionPaymentPage"; | ||
|
||
const test = baseTest.extend<{ | ||
landingPage: LandingPage; | ||
authPage: AuthPage; | ||
dashboardPage: DashboardPage; | ||
subscriptionPage: SubscriptionPaymentPage | ||
}>({ | ||
authPage: async ({ page }, use) => { | ||
await use(new AuthPage(page)) | ||
}, | ||
landingPage: async ({ page }, use) => { | ||
await use(new LandingPage(page)) | ||
}, | ||
dashboardPage: async ({ page }, use) => { | ||
await use(new DashboardPage(page)) | ||
}, | ||
subscriptionPage: async ({ page }, use) => { | ||
await use(new SubscriptionPaymentPage(page)) | ||
}, | ||
}) | ||
|
||
export default test; | ||
import { LandingPage } from "../pages/landingPage"; | ||
import { AuthPage } from "../pages/authPage"; | ||
import { test as baseTest } from '@playwright/test' | ||
import { DashboardPage } from "../pages/dashboardPage"; | ||
import { SubscriptionPaymentPage } from "../pages/subscriptionPaymentPage"; | ||
import { MozillaMonitorPage } from "../pages/mozillaMonitorPage"; | ||
|
||
const test = baseTest.extend<{ | ||
landingPage: LandingPage; | ||
authPage: AuthPage; | ||
dashboardPage: DashboardPage; | ||
subscriptionPage: SubscriptionPaymentPage | ||
mozillaMonitorPage: MozillaMonitorPage | ||
}>({ | ||
authPage: async ({ page }, use) => { | ||
await use(new AuthPage(page)) | ||
}, | ||
landingPage: async ({ page }, use) => { | ||
await use(new LandingPage(page)) | ||
}, | ||
dashboardPage: async ({ page }, use) => { | ||
await use(new DashboardPage(page)) | ||
}, | ||
subscriptionPage: async ({ page }, use) => { | ||
await use(new SubscriptionPaymentPage(page)) | ||
}, | ||
mozillaMonitorPage: async ({ page }, use) => { | ||
await use(new MozillaMonitorPage(page)) | ||
} | ||
}) | ||
|
||
export default test; | ||
export const expect = test.expect; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Page, Locator} from "@playwright/test"; | ||
import { getVerificationCode } from "../e2eTestUtils/helpers"; | ||
|
||
export class MozillaMonitorPage { | ||
readonly page: Page | ||
readonly monitorSignUpInput: Locator; | ||
readonly monitorSignUpButton: Locator; | ||
|
||
constructor(page: Page){ | ||
this.page = page; | ||
this.monitorSignUpInput = page.locator("//form[contains(@class, 'SignUpForm_form')]/input").first(); | ||
this.monitorSignUpButton = page.locator('button.Button_primary___XZsP').first(); | ||
|
||
} | ||
|
||
async signupWithMask(randomMask: string | null) { | ||
if (randomMask === null) { | ||
return new Error("Mask could not be created.") | ||
} | ||
|
||
await this.page.goto("https://monitor.mozilla.org/", { waitUntil: 'networkidle' }) | ||
await this.monitorSignUpInput.fill(randomMask as string) | ||
await this.monitorSignUpButton.click() | ||
await this.page.waitForURL('**/oauth/signup**') | ||
|
||
await this.page.locator('#password').fill(process.env.E2E_TEST_ACCOUNT_PASSWORD as string); | ||
await this.page.locator('#vpassword').fill(process.env.E2E_TEST_ACCOUNT_PASSWORD as string); | ||
await this.page.locator('#age').fill('31'); | ||
await this.page.locator('#submit-btn').click() | ||
await this.page.waitForURL('**/confirm_signup_code**') | ||
|
||
// verification email from fxa to generatedMaskEmail should be forwarded to E2E_TEST_ACCOUNT_FREE | ||
await getVerificationCode(process.env.E2E_TEST_ACCOUNT_FREE as string, this.page) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,36 @@ | ||
import { Locator, Page } from "@playwright/test"; | ||
|
||
export class SubscriptionPaymentPage { | ||
readonly page: Page | ||
readonly paypalButton: Locator | ||
readonly paymentDiv: Locator | ||
readonly productDetails: Locator | ||
readonly discountForm: Locator | ||
readonly paymentNameField: Locator | ||
readonly cardNumberField: Locator | ||
readonly cardExpiryField: Locator | ||
readonly cardCvcField: Locator | ||
readonly postalCodeField: Locator | ||
readonly authorizationCheckbox: Locator | ||
|
||
constructor(page: Page) { | ||
this.page = page | ||
this.authorizationCheckbox = page.locator('[data-testid="confirm"]') | ||
this.paypalButton = page.locator('[data-testid="pay-with-other"]') | ||
this.paymentDiv = page.locator('[data-testid="subscription-create"]') | ||
this.productDetails = page.locator('.plan-details-component-inner') | ||
this.discountForm = page.locator('[data-testid="coupon-component"]') | ||
this.paymentNameField = page.locator('[data-testid="name"]') | ||
this.cardNumberField = page.locator('[data-elements-stable-field-name="cardNumber"]') | ||
this.cardExpiryField = page.locator('[data-elements-stable-field-name="cardExpiry"]') | ||
this.cardCvcField = page.locator('[data-elements-stable-field-name="cardCvc"]') | ||
this.postalCodeField = page.locator('[data-elements-stable-field-name="postalCode"]') | ||
} | ||
import { Locator, Page } from "@playwright/test"; | ||
|
||
export class SubscriptionPaymentPage { | ||
readonly page: Page | ||
readonly paypalButton: Locator | ||
readonly paymentDiv: Locator | ||
readonly productDetails: Locator | ||
readonly discountForm: Locator | ||
readonly paymentNameField: Locator | ||
readonly cardNumberField: Locator | ||
readonly cardExpiryField: Locator | ||
readonly cardCvcField: Locator | ||
readonly postalCodeField: Locator | ||
readonly authorizationCheckbox: Locator | ||
readonly subscriptionTitle: Locator | ||
readonly subscriptionType: Locator | ||
readonly planDetails: Locator | ||
readonly planType: Locator | ||
|
||
constructor(page: Page) { | ||
this.page = page | ||
this.authorizationCheckbox = page.locator('[data-testid="confirm"]') | ||
this.paypalButton = page.locator('[data-testid="pay-with-other"]') | ||
this.paymentDiv = page.locator('[data-testid="subscription-create"]') | ||
this.productDetails = page.locator('.plan-details-component-inner') | ||
this.discountForm = page.locator('[data-testid="coupon-component"]') | ||
this.paymentNameField = page.locator('[data-testid="name"]') | ||
this.cardNumberField = page.locator('[data-elements-stable-field-name="cardNumber"]') | ||
this.cardExpiryField = page.locator('[data-elements-stable-field-name="cardExpiry"]') | ||
this.cardCvcField = page.locator('[data-elements-stable-field-name="cardCvc"]') | ||
this.postalCodeField = page.locator('[data-elements-stable-field-name="postalCode"]') | ||
this.subscriptionTitle = page.locator('[data-testid="subscription-create-title"]') | ||
this.planDetails = page.locator('#plan-details-product') | ||
this.planType = page.locator('.plan-details-description') | ||
} | ||
} |
Oops, something went wrong.