diff --git a/test-automation/pages/pay-admin-page.js b/test-automation/pages/pay-admin-page.js index 8f577a3e..3c539e8b 100644 --- a/test-automation/pages/pay-admin-page.js +++ b/test-automation/pages/pay-admin-page.js @@ -18,6 +18,7 @@ export class PayAdminPage { this.page = page this.ammount = page.locator('[id="amount"]') this.code = page.locator('[id="code"]') + this.description = page.locator('[id="description"]') this.comments = page.locator('[id="comments"]') this.saveButton = page.locator('[class="btn btn-primary"]') this.feeSchedule = page.getByText('Fee Schedule') @@ -26,6 +27,8 @@ export class PayAdminPage { this.showOnPriceListFlag = page.getByText('Show on Price List') this.gstAddedToStatutoryFeesFlag = page.getByText('GST Added to Statutory Fees') this.gstAddedToServicesFeesFlag = page.getByText('GST Added to Services Fees') + this.corpTypeLink = page.getByRole('link', { name: 'Corp Type' }) + this.successMessage = page.getByText('Record was successfully created.') } @@ -50,4 +53,16 @@ export class PayAdminPage { await this.gstAddedToStatutoryFeesFlag.click({timeout: 10000}) await this.gstAddedToServicesFeesFlag.click({timeout: 10000}) } + + async createCorpType() { + //TODO- will update later to use env variable for url + await this.page.goto(process.env.FEECODEURL) + await this.corpTypeLink.click({timeout: 10000}) + await this.createLink.click({timeout: 10000}) + await this.code.fill('220') + await this.description.fill('anish test automation', {timeout: 10000}) + await this.comments.fill('anish test automation comments', {timeout: 10000}) + await this.saveButton.click({timeout: 10000}) + await expect(this.successMessage).toBeVisible({ timeout: 10000 }) + } } \ No newline at end of file diff --git a/test-automation/tests/pay-admin-page.spec.js b/test-automation/tests/pay-admin-page.spec.js index 8f944fb0..fa926b18 100644 --- a/test-automation/tests/pay-admin-page.spec.js +++ b/test-automation/tests/pay-admin-page.spec.js @@ -28,7 +28,7 @@ test.describe.serial('Pay Admin Tests', () => { await payAdminPage.createFeeCode() }) - test.use({ storageState: { cookies: [], origins: [] } }) + test.use({ storageState: { cookies: [], origins: [] } }) test('validate pay admin functionality-validate fee schedule', async ({ page, payAdminPage , loginPage }) => { console.log('Test: Current URL before navigation:', page.url()) console.log('Test: Cookies loaded:', (await page.context().cookies()).length) @@ -36,4 +36,12 @@ test.describe.serial('Pay Admin Tests', () => { await loginPage.loginWithIDIR(process.env.TEST_USERNAME_IDIR, process.env.TEST_PASSWORD_IDIR) await payAdminPage.validateFeeSchedule() }) + + test('validate pay admin functionality-create corp type', async ({ page, payAdminPage , loginPage }) => { + console.log('Test: Current URL before navigation:', page.url()) + console.log('Test: Cookies loaded:', (await page.context().cookies()).length) + // use credentials for Pay admin (IDIR) + await loginPage.loginWithIDIR(process.env.TEST_USERNAME_IDIR, process.env.TEST_PASSWORD_IDIR) + await payAdminPage.createCorpType() + }) }) \ No newline at end of file