* Copy changes
* Move search bar inline with new button
* Get rid of no more results message
* Change hidden badge to (hidden)
* Remove Cal.ai badge from sidebar
* Add dropdown to create button when there is multiple options
* Fix delete dialog
* Saved filters updates
* More string fixes
* Switch members table to use names
* Fix member spacing
* Fix routing form identifier field
* Fix routing forms stuff
* Only show SMS hint on SMS options
* Make workflow delete button minimal
* Fix padding on workflow steps
* Remove min width on workflow title
* Fix delete workflow PR
* Fix org profile buttons
* Fix org profile screen partially scrolled down
* Improve logos & banner uploads
* Personal profile fixes
* Fix settings general view stuff
* Sentence case consistency
* Fix stuff I broke
* Fix fab
* Fix hidden translation string
* Fix text fields
* Make button small for solo users too
* fix: update E2E tests to match sentence case labels in routing forms
* fix: update tests to match sentence case label changes
- insights.e2e.ts: chart titles (14 strings)
- event-types.e2e.ts: Organizer phone number location
- EditLocationDialog.test.tsx: phone number labels
* fix: address Cubic AI review feedback (confidence 9+)
- Replace hardcoded text-gray-500 with text-muted in TextField.tsx hint section
- Replace text locator with data-testid in E2E test for location select
Co-Authored-By: unknown <>
* fix: update E2E tests for sentence case label changes
- Use data-testid selectors for location options (more reliable than text)
- Update field identifiers in routing-forms tests to match new labels
- Fix Long text selector in manage-booking-questions test
* fix: replace text locator with data-testid in manage-booking-questions E2E test
Replace fragile text="Long text" locator with resilient
page.getByTestId("select-option-textarea") selector per E2E best practices.
Addresses Cubic AI review feedback (confidence 9/10).
Co-Authored-By: unknown <>
* fix: use .last() for multiple location select items
---------
Co-authored-by: Pedro Castro <pedro@cal.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
99 lines
2.9 KiB
TypeScript
99 lines
2.9 KiB
TypeScript
import type { Page } from "@playwright/test";
|
|
import { expect } from "@playwright/test";
|
|
|
|
export async function addForm(
|
|
page: Page,
|
|
{
|
|
name = "Test Form Name",
|
|
forTeam,
|
|
}: {
|
|
name?: string;
|
|
forTeam?: boolean;
|
|
} = {}
|
|
) {
|
|
await page.goto(`/routing-forms/forms`);
|
|
await page.click('[data-testid="new-routing-form"]');
|
|
|
|
if (forTeam) {
|
|
await page.click('[data-testid="option-team-1"]');
|
|
} else {
|
|
await page.click('[data-testid="option-0"]');
|
|
}
|
|
|
|
await page.fill("input[name]", name);
|
|
await page.click('[data-testid="add-form"]');
|
|
await page.waitForSelector('[data-testid="add-field"]');
|
|
const url = page.url();
|
|
const formId = new URL(url).pathname.split("/").at(-1);
|
|
if (!formId) {
|
|
throw new Error("Form ID couldn't be determined from url");
|
|
}
|
|
return formId;
|
|
}
|
|
|
|
export async function addOneFieldAndDescriptionAndSaveForm(
|
|
formId: string,
|
|
page: Page,
|
|
form: { name: string; description?: string; field?: { typeIndex: number; label: string } }
|
|
) {
|
|
await page.goto(`apps/routing-forms/form-edit/${formId}`);
|
|
await expect(page.locator('[name="name"]')).toHaveValue(form.name);
|
|
await page.click('[data-testid="add-field"]');
|
|
if (form.description) {
|
|
await page.fill('[data-testid="description"]', form.description);
|
|
}
|
|
|
|
// Verify all Options of SelectBox
|
|
const { optionsInUi: types } = await verifySelectOptions(
|
|
{ selector: ".data-testid-field-type", nth: 0 },
|
|
["Email", "Long text", "Multiple choice selection", "Number", "Phone", "Single-choice selection", "Short text"],
|
|
page
|
|
);
|
|
|
|
const nextFieldIndex = (await page.locator('[data-testid="field"]').count()) - 1;
|
|
|
|
if (form.field) {
|
|
await page.fill(`[data-testid="fields.${nextFieldIndex}.label"]`, form.field.label);
|
|
await page
|
|
.locator('[data-testid="field"]')
|
|
.nth(nextFieldIndex)
|
|
.locator(".data-testid-field-type")
|
|
.click();
|
|
await page
|
|
.locator('[data-testid="field"]')
|
|
.nth(nextFieldIndex)
|
|
.locator('[id*="react-select-"][aria-disabled]')
|
|
.nth(form.field.typeIndex)
|
|
.click();
|
|
}
|
|
await saveCurrentForm(page);
|
|
return {
|
|
types,
|
|
};
|
|
}
|
|
|
|
export async function saveCurrentForm(page: Page) {
|
|
await page.click('[data-testid="update-form"]');
|
|
await page.waitForSelector(".data-testid-toast-success");
|
|
}
|
|
|
|
export async function verifySelectOptions(
|
|
selector: { selector: string; nth: number },
|
|
expectedOptions: string[],
|
|
page: Page
|
|
) {
|
|
await page.locator(selector.selector).nth(selector.nth).click();
|
|
const selectOptions = await page
|
|
.locator(selector.selector)
|
|
.nth(selector.nth)
|
|
.locator('[id*="react-select-"][aria-disabled]')
|
|
.allInnerTexts();
|
|
|
|
const sortedSelectOptions = [...selectOptions].sort();
|
|
const sortedExpectedOptions = [...expectedOptions].sort();
|
|
expect(sortedSelectOptions).toEqual(sortedExpectedOptions);
|
|
return {
|
|
optionsInUi: selectOptions,
|
|
};
|
|
}
|