diff --git a/e2e/tests/bahmni-odoo-flows.spec.ts b/e2e/tests/bahmni-odoo-flows.spec.ts index e70737b..fcbb507 100644 --- a/e2e/tests/bahmni-odoo-flows.spec.ts +++ b/e2e/tests/bahmni-odoo-flows.spec.ts @@ -1,10 +1,10 @@ import { test, expect } from '@playwright/test'; import { Odoo } from '../utils/functions/odoo'; -import { BAHMNI_URL, ODOO_URL } from '../utils/configs/globalSetup'; import { Bahmni, patientName } from '../utils/functions/bahmni'; +import { BAHMNI_URL, ODOO_URL } from '../utils/configs/globalSetup'; -let bahmni: Bahmni; let odoo: Odoo; +let bahmni: Bahmni; test.beforeEach(async ({ page }) => { bahmni = new Bahmni(page); @@ -17,43 +17,35 @@ test.beforeEach(async ({ page }) => { await expect(page.getByText(/appointment scheduling/i)).toBeVisible(); await expect(page.getByText(/patient documents/i)).toBeVisible(); await bahmni.registerPatient(); - await bahmni.goToHomePage(); + await bahmni.navigateToPatientDashboard(); }); test('Ordering a lab test for a Bahmni patient creates the corresponding Odoo customer with a filled quotation.', async ({ page }) => { // setup - await bahmni.goToLabSamples(); + await bahmni.navigateToLabSamples(); // replay await bahmni.createLabOrder(); // verify await odoo.open(); - await expect(page).toHaveURL(/.*web/); await odoo.searchCustomer(); - const customerSelector = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)'); - await expect(customerSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); - - const statusSelector = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span'); - await expect(statusSelector).toHaveText('Devis'); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)')).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span')).toHaveText('Devis'); await page.getByRole('cell', { name: `${patientName.givenName + ' ' + patientName.familyName}` }).click(); - const labTest = await page.locator('tr:nth-child(1) td.o_data_cell.o_field_cell.o_list_text.o_section_and_note_text_cell.o_required_modifier'); - await expect(labTest).toContainText('Malaria'); + await expect(page.locator('tr:nth-child(1) td.o_data_cell.o_field_cell.o_list_text.o_section_and_note_text_cell.o_required_modifier')).toContainText('Malaria'); }); test('Editing the details of a Bahmni patient with a synced lab order edits the corresponding Odoo customer details.', async ({ page }) => { // setup - await bahmni.goToLabSamples(); + await bahmni.navigateToLabSamples(); await bahmni.createLabOrder(); await odoo.open(); - await expect(page).toHaveURL(/.*web/); await odoo.searchCustomer(); - const customerSelector = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)'); - await expect(customerSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); - const statusSelector = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span'); - await expect(statusSelector).toHaveText('Devis'); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)')).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span')).toHaveText('Devis'); // replay await page.goto(`${BAHMNI_URL}`); @@ -62,66 +54,57 @@ test('Editing the details of a Bahmni patient with a synced lab order edits the // verify await page.goto(`${ODOO_URL}`); await odoo.searchCustomer(); - const updatedCustomer = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)'); - await expect(updatedCustomer).toHaveText(`${patientName.updatedGivenName}` + ' ' + `${patientName.familyName}`); - await expect(statusSelector).toHaveText('Devis'); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)')).toHaveText(`${patientName.updatedGivenName}` + ' ' + `${patientName.familyName}`); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span')).toHaveText('Devis'); }); test('Revising a synced Bahmni lab order edits the corresponding Odoo quotation line.', async ({ page }) => { // setup - await bahmni.goToLabSamples(); + await bahmni.navigateToLabSamples(); await bahmni.createLabOrder(); await odoo.open(); - await expect(page).toHaveURL(/.*web/); await odoo.searchCustomer(); - const customerSelector = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)'); - await expect(customerSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); - const statusSelector = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span'); - await expect(statusSelector).toHaveText('Devis'); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)')).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span')).toHaveText('Devis'); await page.getByRole('cell', { name: `${patientName.givenName + ' ' + patientName.familyName}` }).click(); - const labTest = await page.locator('td.o_data_cell.o_field_cell.o_list_many2one.o_product_configurator_cell.o_required_modifier>span'); - await expect(labTest).toHaveText('Malaria'); + await expect(page.locator('td.o_data_cell.o_field_cell.o_list_many2one.o_product_configurator_cell.o_required_modifier>span')).toHaveText('Malaria'); // replay - await page.goto(`${BAHMNI_URL}`); - await bahmni.goToLabSamples(); + await bahmni.navigateToPatientDashboard(); + await bahmni.navigateToLabSamples(); await bahmni.reviseLabOrder(); // verify await page.goto(`${ODOO_URL}`); await odoo.searchCustomer(); - await expect(customerSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); - await expect(statusSelector).toHaveText('Devis'); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)')).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span')).toHaveText('Devis'); await page.getByRole('cell', { name: `${patientName.givenName + ' ' + patientName.familyName }` }).first().click(); - await expect(labTest).not.toContainText('Malaria'); - await expect(labTest).toHaveText('Hematocrite'); + await expect(page.locator('td.o_data_cell.o_field_cell.o_list_many2one.o_product_configurator_cell.o_required_modifier>span')).not.toHaveText('Malaria'); + await expect(page.locator('td.o_data_cell.o_field_cell.o_list_many2one.o_product_configurator_cell.o_required_modifier>span')).toHaveText('Hematocrite'); }); test('Discontinuing a synced Bahmni lab order edits the corresponding Odoo quotation line.', async ({ page }) => { // setup - await bahmni.goToLabSamples(); + await bahmni.navigateToLabSamples(); await bahmni.createLabOrder(); await odoo.open(); - await expect(page).toHaveURL(/.*web/); await odoo.searchCustomer(); - const customerSelector = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)'); - await expect(customerSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); - const statusSelector = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span'); - await expect(statusSelector).toHaveText('Devis'); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)')).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span')).toHaveText('Devis'); await page.getByRole('cell', { name: `${patientName.givenName + ' ' + patientName.familyName}` }).click(); - const labTest = await page.locator('td.o_data_cell.o_field_cell.o_list_many2one.o_product_configurator_cell.o_required_modifier>span'); - await expect(labTest).toHaveText('Malaria'); + await expect(page.locator('td.o_data_cell.o_field_cell.o_list_many2one.o_product_configurator_cell.o_required_modifier>span')).toHaveText('Malaria'); // replay - await page.goto(`${BAHMNI_URL}`); - await bahmni.goToLabSamples(); + await bahmni.navigateToPatientDashboard(); + await bahmni.navigateToLabSamples(); await bahmni.discontinueLabOrder(); // verify await page.goto(`${ODOO_URL}`); await odoo.searchCustomer(); - await expect(customerSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); - await expect(statusSelector).toHaveText('Annulé'); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)')).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span')).toHaveText('Annulé'); await page.getByRole('cell', { name: `${patientName.givenName + ' ' + patientName.familyName }` }).first().click(); await expect(page.getByText('Malaria')).not.toBeVisible(); }); @@ -136,14 +119,10 @@ test('Ordering a drug for a Bahmni patient creates the corresponding Odoo custom // verify await odoo.open(); await odoo.searchCustomer(); - const customerSelector = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)'); - await expect(customerSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); - - const statusSelector = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span'); - await expect(statusSelector).toHaveText('Devis'); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)')).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span')).toHaveText('Devis'); await page.getByRole('cell', { name: `${patientName.givenName + ' ' + patientName.familyName}` }).click(); - const drugNameSelector = await page.locator('td.o_data_cell.o_field_cell.o_list_many2one.o_product_configurator_cell.o_required_modifier>span'); - await expect(drugNameSelector).toContainText('Aspirine Co 81mg'); + await expect(page.locator('td.o_data_cell.o_field_cell.o_list_many2one.o_product_configurator_cell.o_required_modifier>span')).toContainText('Aspirine Co 81mg'); }); @@ -152,10 +131,8 @@ test('Editing the details of a Bahmni patient with a synced drug order edits the await bahmni.navigateToMedications(); await bahmni.createMedication(); await odoo.open(); - await expect(page).toHaveURL(/.*web/); await odoo.searchCustomer(); - const customerSelector = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)'); - await expect(customerSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)')).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); // replay await page.goto(`${BAHMNI_URL}`); @@ -164,8 +141,7 @@ test('Editing the details of a Bahmni patient with a synced drug order edits the // verify await page.goto(`${ODOO_URL}`); await odoo.searchCustomer(); - const updatedCustomer = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)'); - await expect(updatedCustomer).toHaveText(`${patientName.updatedGivenName}` + ' ' + `${patientName.familyName}`); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)')).toHaveText(`${patientName.updatedGivenName}` + ' ' + `${patientName.familyName}`); }); test('Revising a synced OpenMRS drug order edits the corresponding Odoo quotation line.', async ({ page }) => { @@ -173,18 +149,14 @@ test('Revising a synced OpenMRS drug order edits the corresponding Odoo quotatio await bahmni.navigateToMedications(); await bahmni.createMedication(); await odoo.open(); - await expect(page).toHaveURL(/.*web/); await odoo.searchCustomer(); - const customerSelector = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)'); - await expect(customerSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)')).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); await page.getByRole('cell', { name: `${patientName.givenName + ' ' + patientName.familyName }` }).click(); - const medicationDescrptionSelector = await page.locator('td.o_data_cell.o_field_cell.o_list_text.o_section_and_note_text_cell.o_required_modifier span'); - const drugNameSelector = await page.locator('td.o_data_cell.o_field_cell.o_list_many2one.o_product_configurator_cell.o_required_modifier>span'); - await expect(drugNameSelector).toContainText('Aspirine Co 81mg'); - await expect(medicationDescrptionSelector).toContainText('Aspirine Co 81mg | 560.0 Ampoule(s) | 2.0 Application(s) - Q3H - 5 Semaine(s)'); + await expect(page.locator('td.o_data_cell.o_field_cell.o_list_many2one.o_product_configurator_cell.o_required_modifier>span')).toContainText('Aspirine Co 81mg'); + await expect(page.locator('td.o_data_cell.o_field_cell.o_list_text.o_section_and_note_text_cell.o_required_modifier span')).toContainText('Aspirine Co 81mg | 560.0 Ampoule(s) | 2.0 Application(s) - Q3H - 5 Semaine(s)'); // replay - await page.goto(`${BAHMNI_URL}`); + await bahmni.navigateToPatientDashboard(); await bahmni.navigateToMedications(); await bahmni.editMedicationDetails(); @@ -192,8 +164,8 @@ test('Revising a synced OpenMRS drug order edits the corresponding Odoo quotatio await page.goto(`${ODOO_URL}`); await odoo.searchCustomer(); await page.getByRole('cell', { name: `${patientName.givenName + ' ' + patientName.familyName }` }).click(); - await expect(drugNameSelector).toContainText('Aspirine Co 81mg'); - await expect(medicationDescrptionSelector).toContainText('Aspirine Co 81mg | 120.0 Comprime(s) | 4.0 Comprime(s) - Q4H - 5 Jour(s)'); + await expect(page.locator('td.o_data_cell.o_field_cell.o_list_many2one.o_product_configurator_cell.o_required_modifier>span')).toContainText('Aspirine Co 81mg'); + await expect(page.locator('td.o_data_cell.o_field_cell.o_list_text.o_section_and_note_text_cell.o_required_modifier span')).toContainText('Aspirine Co 81mg | 120.0 Comprime(s) | 4.0 Comprime(s) - Q4H - 5 Jour(s)'); }); test('Discontinuing a synced Bahmni drug order for an Odoo customer with a single quotation line removes the corresponding quotation.', async ({ page }) => { @@ -201,28 +173,23 @@ test('Discontinuing a synced Bahmni drug order for an Odoo customer with a singl await bahmni.navigateToMedications(); await bahmni.createMedication(); await odoo.open(); - await expect(page).toHaveURL(/.*web/); await odoo.searchCustomer(); - const customerSelector = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)'); - await expect(customerSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); - const statusSelector = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span'); - await expect(statusSelector).toHaveText('Devis'); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)')).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span')).toHaveText('Devis'); await page.getByRole('cell', { name: `${patientName.givenName + ' ' + patientName.familyName }` }).click(); - const medicationDescrptionSelector = await page.locator('td.o_data_cell.o_field_cell.o_list_text.o_section_and_note_text_cell.o_required_modifier span'); - const drugNameSelector = await page.locator('td.o_data_cell.o_field_cell.o_list_many2one.o_product_configurator_cell.o_required_modifier>span'); - await expect(drugNameSelector).toContainText('Aspirine Co 81mg'); - await expect(medicationDescrptionSelector).toContainText('Aspirine Co 81mg | 560.0 Ampoule(s) | 2.0 Application(s) - Q3H - 5 Semaine(s)'); + await expect(page.locator('td.o_data_cell.o_field_cell.o_list_many2one.o_product_configurator_cell.o_required_modifier>span')).toContainText('Aspirine Co 81mg'); + await expect(page.locator('td.o_data_cell.o_field_cell.o_list_text.o_section_and_note_text_cell.o_required_modifier span')).toContainText('Aspirine Co 81mg | 560.0 Ampoule(s) | 2.0 Application(s) - Q3H - 5 Semaine(s)'); // replay - await page.goto(`${BAHMNI_URL}`); + await bahmni.navigateToPatientDashboard(); await bahmni.navigateToMedications(); await bahmni.discontinueMedication(); // verify await page.goto(`${ODOO_URL}`); await odoo.searchCustomer(); - await expect(customerSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); - await expect(statusSelector).toHaveText('Annulé'); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)')).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`); + await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span')).toHaveText('Annulé'); await page.getByRole('cell', { name: `${patientName.givenName + ' ' + patientName.familyName }` }).click(); await expect(page.getByText('Aspirine Co 81mg')).not.toBeVisible(); }); diff --git a/e2e/tests/diagnosis.spec.ts b/e2e/tests/diagnosis.spec.ts index 5d0f14d..275dfd5 100644 --- a/e2e/tests/diagnosis.spec.ts +++ b/e2e/tests/diagnosis.spec.ts @@ -20,6 +20,7 @@ test('Create and revise a diagnosis.', async ({ page }) => { await bahmni.registerPatient(); // replay + await bahmni.navigateToPatientDashboard(); await bahmni.navigateToDiagnosis(); await page.locator('#name-0').fill('Candidiasis (B37.9)'); await page.getByText('Candidiasis (B37.9)').click(); diff --git a/e2e/tests/lab-orders.spec.ts b/e2e/tests/lab-orders.spec.ts index 9de941e..904c022 100644 --- a/e2e/tests/lab-orders.spec.ts +++ b/e2e/tests/lab-orders.spec.ts @@ -19,8 +19,8 @@ test('Create, revise and discontinue lab tests.', async ({ page }) => { await bahmni.registerPatient(); // replay - await bahmni.goToHomePage(); - await bahmni.goToLabSamples(); + await bahmni.navigateToPatientDashboard(); + await bahmni.navigateToLabSamples(); await page.getByText('Blood', { exact: true }).click(); await page.getByText('Malaria').click(); await page.getByText('Urine').click(); diff --git a/e2e/tests/medications.spec.ts b/e2e/tests/medications.spec.ts index b89af2b..2be2a27 100644 --- a/e2e/tests/medications.spec.ts +++ b/e2e/tests/medications.spec.ts @@ -19,7 +19,7 @@ test('Create, revise and discontinue a drug order.', async ({ page }) => { await bahmni.registerPatient(); // replay - await bahmni.goToHomePage(); + await bahmni.navigateToPatientDashboard(); await bahmni.navigateToMedications(); await bahmni.createMedication(); diff --git a/e2e/tests/observation-forms.spec.ts b/e2e/tests/observation-forms.spec.ts new file mode 100644 index 0000000..a99a858 --- /dev/null +++ b/e2e/tests/observation-forms.spec.ts @@ -0,0 +1,28 @@ +import { test, expect } from '@playwright/test'; +import { Bahmni } from '../utils/functions/bahmni'; + +let bahmni: Bahmni; + +test.beforeEach(async ({ page }) => { + bahmni = new Bahmni(page); + + await bahmni.login(); + await expect(page.getByText(/registration/i)).toBeVisible(); + await expect(page.getByText(/linical/i)).toBeVisible(); + await expect(page.getByText(/admin/i)).toBeVisible(); + await expect(page.getByText(/appointment scheduling/i)).toBeVisible(); + await expect(page.getByText(/patient documents/i)).toBeVisible(); +}); + +test('Create, revise and discontinue lab tests.', async ({ page }) => { + // setup + await bahmni.registerPatient(); + + // replay + await bahmni.navigateToPatientDashboard(); +}); + +test.afterEach(async ({ page }) => { + await bahmni.voidPatient(); + await page.close(); +}); diff --git a/e2e/utils/functions/bahmni.ts b/e2e/utils/functions/bahmni.ts index fe757fc..337902f 100644 --- a/e2e/utils/functions/bahmni.ts +++ b/e2e/utils/functions/bahmni.ts @@ -25,6 +25,7 @@ export class Bahmni { await this.page.locator('#password').fill(`${process.env.BAHMNI_PASSWORD}`); await this.page.locator('#location').selectOption('object:7'); await this.page.getByRole('button', { name: 'Login' }).click(); + await expect(this.page).toHaveURL(/.*home/); } async registerPatient() { @@ -62,11 +63,12 @@ export class Bahmni { await this.page.locator('#givenName').fill(`${patientName.updatedGivenName}`); await this.page.getByRole('button', { name: 'Save' }).click(); patientName.givenName = `${patientName.updatedGivenName}`; - await delay(3000); + await delay(6000); }; async voidPatient() { await this.page.goto(`${BAHMNI_URL}/openmrs/admin/patients/index.htm`); + await expect(this.page.getByPlaceholder(' ')).toBeVisible(); await this.page.getByPlaceholder(' ').type(`${patientName.familyName}`); await this.page.locator('#openmrsSearchTable tbody tr.odd td:nth-child(1)').click(); await this.page.locator('input[name="voidReason"]').fill('Void patient created by smoke test'); @@ -75,9 +77,7 @@ export class Bahmni { await expect(message?.includes('This patient has been deleted')).toBeTruthy(); } - async goToLabSamples() { - await this.page.getByRole('link', { name: 'Clinical' }).click(); - await this.searchPatient(); + async navigateToLabSamples() { await this.page.locator('#view-content :nth-child(1).btn--success').click(); await this.page.locator('#opd-tabs').getByText('Orders').click(); await expect(this.page.getByText('Lab Samples')).toBeVisible(); @@ -102,22 +102,18 @@ export class Bahmni { await this.saveOrder(); } - async goToHomePage() { + async navigateToPatientDashboard() { await this.page.goto(`${BAHMNI_URL}/bahmni/home`); - await expect(this.page).toHaveURL(/.*home/); + await this.page.getByRole('link', { name: 'Clinical' }).click(); + await this.searchPatient(); } async navigateToDiagnosis() { - await this.page.locator('i.fa.fa-home').click(); - await this.page.getByRole('link', { name: 'Clinical' }).click(); - await this.searchPatient(); await this.page.locator('#view-content :nth-child(1).btn--success').click(); await this.page.locator('#opd-tabs').getByText('Diagnosis').click(); } async navigateToMedications() { - await this.page.getByRole('link', { name: 'Clinical' }).click(); - await this.searchPatient(); await this.page.locator('#view-content :nth-child(1).btn--success').click(); await this.page.locator('#opd-tabs').getByText('Medications').click(); await expect(this.page.getByText('Order Drug')).toBeVisible(); diff --git a/e2e/utils/functions/odoo.ts b/e2e/utils/functions/odoo.ts index 93485e0..01f33c8 100644 --- a/e2e/utils/functions/odoo.ts +++ b/e2e/utils/functions/odoo.ts @@ -1,5 +1,5 @@ -import { Page } from '@playwright/test'; -import { patientName } from './bahmni'; +import { expect, Page } from '@playwright/test'; +import { delay, patientName } from './bahmni'; import { ODOO_URL } from '../configs/globalSetup'; export class Odoo { @@ -10,12 +10,15 @@ export class Odoo { await this.page.getByPlaceholder('Email').fill(`${process.env.ODOO_USERNAME}`); await this.page.getByPlaceholder('Password').fill(`${process.env.ODOO_PASSWORD}`); await this.page.locator('button[type="submit"]').click(); + await expect(this.page).toHaveURL(/.*web/); } async searchCustomer() { await this.page.locator("//a[contains(@class, 'full')]").click(); + await delay(2000); await this.page.locator('ul.o_menu_apps a:nth-child(2)').click(); - await this.page.locator('input.o_searchview_input').fill(`${patientName.givenName + ' ' + patientName.familyName}`); + await expect(this.page.locator('.breadcrumb-item')).toHaveText('Devis'); + await this.page.locator('input.o_searchview_input').type(`${patientName.givenName + ' ' + patientName.familyName}`); await this.page.locator('input.o_searchview_input').press('Enter'); } } diff --git a/playwright.config.ts b/playwright.config.ts index 2a7aa43..c73a0ce 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -23,6 +23,7 @@ const config: PlaywrightTestConfig = { name: 'chromium', use: { ...devices['Desktop Chromium'], + viewport: { width: 1920, height: 1080 } }, }, ],