Skip to content

Commit

Permalink
feat : Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vijaykv5 authored and denniskigen committed May 8, 2024
1 parent b509bbb commit 1c5cbd1
Showing 1 changed file with 11 additions and 24 deletions.
35 changes: 11 additions & 24 deletions e2e/specs/appointments.spec.ts
Expand Up @@ -46,26 +46,20 @@ test('Add, edit and cancel an appointment', async ({ page, api }) => {
});

await test.step('And I add a note', async () => {
await page.getByPlaceholder(/Write any additional points here/i).fill('Testing Appointments notes');
await page
.getByPlaceholder(/write any additional points here/i)
.fill('A sample note for testing out the appointment scheduling flow');
});

await test.step('And I click Save button', async () => {
await page.getByRole('button', { name: /save and close/i }).click();
});

await test.step('Then I should see a success message', async () => {
await expect(page.getByText(/Appointment scheduled/i)).toBeVisible();
});
});

test('Edit an appointment', async ({ page, api }) => {
const appointmentsPage = new AppointmentsPage(page);

await test.step('When I go to the appointment tab in the patient chart', async () => {
await appointmentsPage.goto(patient.uuid);
await expect(page.getByText(/appointment scheduled/i)).toBeVisible();
});

await test.step('When I click the options menu in the appointments table', async () => {
await test.step('When I click the overflow menu on the table row with the newly created appointment', async () => {
await page.getByRole('button', { name: 'Options' }).click();
});

Expand All @@ -92,27 +86,20 @@ test('Edit an appointment', async ({ page, api }) => {
});

await test.step('And I change the note', async () => {
await page.getByPlaceholder(/Write any additional points here/i).fill('Editing Appointmentments notes');
await page
.getByPlaceholder('Write any additional points here')
.fill('A sample note for testing out the edit flow for scheduled appointments');
});

await test.step('And I click Save button', async () => {
await page.getByRole('button', { name: /save and close/i }).click();
});

await test.step('Then I should see a success message', async () => {
await expect(page.getByText(/Appointment edited/i)).toBeVisible();
});
});

test('Delete an appointment', async ({ page, api }) => {
const appointmentsPage = new AppointmentsPage(page);

await test.step('When I go to the appointment tab in the patient chart', async () => {
await appointmentsPage.goto(patient.uuid);
await expect(page.getByText(/appointment edited/i)).toBeVisible();
});

await test.step('When I click the options menu in the appointments table', async () => {
await page.getByRole('tab', { name: 'Today' }).click();
await test.step('When I click the options kebab menu in the appointment', async () => {
await page.getByRole('button', { name: 'Options' }).click();
});

Expand All @@ -125,7 +112,7 @@ test('Delete an appointment', async ({ page, api }) => {
});

await test.step('Then I should see a success message', async () => {
await expect(page.getByText(/Appointment cancelled successfully/i)).toBeVisible();
await expect(page.getByText(/appointment cancelled successfully/i)).toBeVisible();
});
});

Expand Down

0 comments on commit 1c5cbd1

Please sign in to comment.