* feat: add api v2 endpoint to fetch all user schedules * chore: update typing * feat: custom hook to fetch all user schedules * refactor: shift logic to transform schedules into function of its own * init: list schedules atom * feat: api endpoints for list schedules atom * refactor: accept redirect url as prop * fix: pass redirect url prop * integrate list schedules atom with availability settings * refactor: extract types to be reused in api v2 endpoints * skip availability settings page for the time being until we have api v2 endpoints in prod * feat: add docs for list schedules atom * fixup * export Schedule type * make sure we always have a default schedule if user deletes his default schedule * chore: implement code rabbit feedback * chore: implement PR feedback * fix: resolve merge conflicts * fix: import path * update platform libraries * fix: type check * resolve merge conflicts * update atoms export * update platform libraries schedule * chore: arrange atoms in alphabetical order * update atoms controller to include endpoints for list schedules atom * add create atom scheule atom * fix: invalidate schedules on new schedule creation * chore: add changesets
70 lines
3.0 KiB
TypeScript
70 lines
3.0 KiB
TypeScript
import { test, expect } from "@playwright/test";
|
|
import type { Page } from "@playwright/test";
|
|
|
|
async function selectOption(page: Page, optionNumber: number) {
|
|
for (let i = 0; i < optionNumber; i++) {
|
|
await page.keyboard.press("ArrowDown");
|
|
}
|
|
await page.keyboard.press("Enter");
|
|
}
|
|
|
|
// eslint-disable-next-line playwright/no-skipped-test
|
|
test.skip("availability page loads with all components", async ({ page }) => {
|
|
await page.goto("/availability");
|
|
await expect(page).toHaveURL("/availability");
|
|
|
|
await expect(page.locator('[data-testid="list-schedules-atom"]')).toBeVisible();
|
|
await expect(page.locator('[data-testid="schedules"]')).toBeVisible();
|
|
|
|
await expect(page.locator('[data-testid="schedules"] li').first()).toBeVisible();
|
|
await expect(
|
|
page.locator('[data-testid="schedules"] li').first().locator('[data-testid="schedule-more"]')
|
|
).toBeVisible();
|
|
await page.locator('[data-testid="schedules"] li').first().locator('[data-testid="schedule-more"]').click();
|
|
|
|
await expect(page.locator('h1:has-text("Availability Settings")')).toBeVisible();
|
|
|
|
await expect(page.locator('button:has-text("Validate Form")')).toBeVisible();
|
|
|
|
await expect(page.locator('button:has-text("Submit Form")')).toBeVisible();
|
|
|
|
await expect(page.locator('[data-testid="Monday"]')).toBeVisible();
|
|
await expect(page.locator('[data-testid="Tuesday"]')).toBeVisible();
|
|
await expect(page.locator('[data-testid="Wednesday"]')).toBeVisible();
|
|
await expect(page.locator('[data-testid="Thursday"]')).toBeVisible();
|
|
await expect(page.locator('[data-testid="Friday"]')).toBeVisible();
|
|
await expect(page.locator('[data-testid="Saturday"]')).toBeVisible();
|
|
await expect(page.locator('[data-testid="Sunday"]')).toBeVisible();
|
|
|
|
await page.locator('[data-testid="Sunday-switch"]').click();
|
|
await page.locator('[data-testid="Monday-switch"]').click();
|
|
await page.locator('[data-testid="Thursday-switch"]').click();
|
|
|
|
await page.locator('[data-testid="Wednesday"] [data-testid="select-control"] div').first().click();
|
|
|
|
await selectOption(page, 5);
|
|
|
|
await page.locator('[data-testid="Wednesday"] [data-testid="select-control"] div').last().click();
|
|
await selectOption(page, 7);
|
|
|
|
await page.locator('[data-testid="Friday"] [data-testid="select-control"] div').first().click();
|
|
await selectOption(page, 3);
|
|
|
|
await page.locator('[data-testid="Friday"] [data-testid="select-control"] div').last().click();
|
|
await selectOption(page, 10);
|
|
|
|
await page.locator('[data-testid="Friday"] [data-testid="add-time-availability"]').click();
|
|
|
|
await page.locator('[data-testid="timezone-select"] div').first().click();
|
|
|
|
await selectOption(page, 10);
|
|
|
|
await page.locator('[data-testid="add-override"]').click();
|
|
await page.locator('[data-testid="day"]:not([data-disabled="true"])').first().click();
|
|
await page.locator('[data-testid="add-override-submit-btn"]').click();
|
|
|
|
await page.locator('[data-testid="dialog-rejection"]').click();
|
|
|
|
await page.locator('button[form="availability-form"]').click();
|
|
});
|