Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions test-automation/pages/bcros-account-creation-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export class BcrosAccountCreationPage {
this.createAnotherAccountButton = page.getByText(' Create Another Account ')
this.individualAccount = page.locator('[data-test="radio-individual-account-type"]')
this.accountNameInput = page.locator('[data-test="input-org-name"]')
this.businessType = page.getByText('Business Type')
this.bank = page.getByText('BANK')
this.smallBusiness = page.getByText('11-20 Employees')
this.businessSize = page.getByText('Business Size')
this.streetAddressInput = page.locator('[id="street-address-1"]')
this.firstAddressOption = page.getByText('1st-290 Dupuis St')
this.nextButton = page.getByText('Next')
Expand All @@ -31,31 +35,40 @@ export class BcrosAccountCreationPage {
this.successMessage = page.getByText('Your BC Registries and Online Services account has successfully been created.')
}

async bcrosAccountCreation() {
async bcrosAccountCreation(accountType) {
await this.accountName.click({timeout: 60000})
await this.page.waitForTimeout(1000) // Wait for dropdown to appear
await this.createAccountButton.click({timeout: 180000})
await this.createAnotherAccountButton.last().click({timeout: 180000})
await this.page.waitForTimeout(20000)
await this.page.waitForTimeout(10000)
await this.page.waitForLoadState('domcontentloaded')
await this.page.waitForLoadState('load')
if(accountType === 'individual')
{
// eslint-disable-next-line max-len
await this.page.locator('[class="v-label theme--light"]', { hasText: 'Individual Person' }).click({force:true, timeout: 180000})
await this.page.waitForTimeout(1000)
await this.accountNameInput.fill('Anish-bcros-individual-test')
await this.page.locator('[class="v-label theme--light"]', { hasText: 'Individual Person' }).click({force:true, timeout: 180000})
await this.page.waitForTimeout(1000)
}
await this.accountNameInput.fill('Anish-bcros-automation-test')
if(accountType === 'business') {
await this.businessType.click({timeout: 10000})
await this.bank.click({timeout: 10000})
await this.businessSize.click({timeout: 10000})
await this.smallBusiness.click({timeout: 10000})
}
await this.streetAddressInput.fill('1 street')
await this.page.waitForTimeout(1000)
await this.page.keyboard.press('Space')
await this.page.waitForTimeout(2000)
await this.firstAddressOption.click({timeout: 10000})
await this.page.waitForTimeout(2000)
await this.accountNameInput.clear()
await this.page.waitForTimeout(2000)
await this.accountNameInput.pressSequentially('Anish-bcros-individual-test12')
await this.page.waitForTimeout(1000)
await this.accountNameInput.pressSequentially('Anish-bcros-automation-testing')
await this.nextButton.click({timeout: 180000})
await this.page.waitForTimeout(2000)
await this.page.waitForTimeout(1000)
await this.nextButton.click({timeout: 10000})
await this.page.waitForTimeout(2000)
await this.page.waitForTimeout(1000)
await this.businessRegistryProductSelection.click({timeout: 10000})
await this.creditCardPaymentOption.click({timeout: 10000})
await this.createAccountButton.click({timeout: 180000})
Expand Down
4 changes: 2 additions & 2 deletions test-automation/tests/bcros-account-creation-flow.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
*/

import { test } from '../fixtures.js'
test('validate bcros account creation (individual) flow', async ({ page, bcrosAccountCreationPage}) => {
test('validate bcros account creation flow (individual & Business)', async ({ page, bcrosAccountCreationPage}) => {
console.log('Test: Current URL before navigation:', page.url())
console.log('Test: Cookies loaded:', (await page.context().cookies()).length)
await page.goto('https://test.bcregistry.gov.bc.ca/en-CA/dashboard',{timeout: 180000})
await bcrosAccountCreationPage.bcrosAccountCreation()
await bcrosAccountCreationPage.bcrosAccountCreation('business')
})
Loading