diff --git a/e2e/tests/observation-forms.spec.ts b/e2e/tests/observation-forms.spec.ts index 59ab9b1..16aa709 100644 --- a/e2e/tests/observation-forms.spec.ts +++ b/e2e/tests/observation-forms.spec.ts @@ -14,7 +14,7 @@ test.beforeEach(async ({ page }) => { await bahmni.registerPatient(); await bahmni.navigateToPatientDashboard(); }); - +/* test('Anthropometry form should save observations.', async ({ page }) => { // setup await bahmni.navigateToForms(); @@ -673,6 +673,32 @@ test('Systems review form should save observations.', async ({ page }) => { await expect(page.locator('#observationSection').getByText('Self Care Skill Deficiency')).toBeVisible(); await expect(page.locator('#observationSection').getByText('Motor Skills Disorder')).toBeVisible(); }); +*/ +test('TB monitoring form should save observations.', async ({ page }) => { + // setup + await bahmni.navigateToForms(); + await expect(page.getByText('Suivi TB')).toBeVisible(); + await page.getByRole('button', { name: 'Suivi TB' }).click(); + await expect(page.getByText('Suivi TB added successfully')).toBeVisible(); + + // replay + await bahmni.fillTBMonitoringForm(); + + // verify + await page.locator('#dashboard-link span.patient-name').click(); + await delay(5000); + await expect(page.locator('a.visit')).toBeVisible(); + await page.locator('a.visit').click(); + await expect(page.locator('#observationSection').getByText('TB Signs and symptoms')).toBeVisible(); + await expect(page.locator('#observationSection').getByText('Cough')).toBeVisible(); + await expect(page.locator('#observationSection').getByText('Evening fever')).toBeVisible(); + await expect(page.locator('#observationSection').getByText('Loss of appetite')).toBeVisible(); + await expect(page.locator('#observationSection').getByText('Weight Loss')).toBeVisible(); + await expect(page.locator('#observationSection').getByText('Response to treatment')).toBeVisible(); + await expect(page.locator('#observationSection').getByText('Regular follow-up tests to check for bacterial load')).toBeVisible(); + await expect(page.locator('#observationSection').getByText('Adjustments based on response and resistance patterns')).toBeVisible(); + await expect(page.locator('#observationSection').getByText('Schedule regular check-ups for progress evaluation')).toBeVisible(); +}); test('Health history form should save observations.', async ({ page }) => { // setup diff --git a/e2e/utils/functions/bahmni.ts b/e2e/utils/functions/bahmni.ts index a86b759..e22e0b9 100644 --- a/e2e/utils/functions/bahmni.ts +++ b/e2e/utils/functions/bahmni.ts @@ -324,7 +324,9 @@ export class Bahmni { await this.page.getByRole('button', { name: 'Evening fever' }).click(); await this.page.getByRole('button', { name: 'Loss of appetite' }).click(); await this.page.getByRole('button', { name: 'Weight Loss' }).click(); - await this.page.locator('div textarea').nth(0).fill('Conduct bacteriologic examination of patient\'s sputum or other specimens.'); + await this.page.locator('div textarea').nth(0).fill('Regular follow-up tests to check for bacterial load'); + await this.page.locator('div textarea').nth(1).fill('Adjustments based on response and resistance patterns'); + await this.page.locator('div textarea').nth(2).fill('Schedule regular check-ups for progress evaluation'); await this.save(); } diff --git a/playwright.config.ts b/playwright.config.ts index f9b5c40..cf11984 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -23,7 +23,9 @@ const config: PlaywrightTestConfig = { name: 'chromium', use: { ...devices['Desktop Chromium'], - viewport: { width: 1920, height: 1080 } + viewport: { width: 1920, height: 1080 }, + video: 'on', + screenshot: 'only-on-failure' }, }, ],