(
page: Page,
{
name,
isAdminApprovalRequired,
}: { name: string; isAdminApprovalRequired?: boolean | undefined }
)
| 491 | } |
| 492 | |
| 493 | export async function createCallLink( |
| 494 | page: Page, |
| 495 | { |
| 496 | name, |
| 497 | isAdminApprovalRequired, |
| 498 | }: { name: string; isAdminApprovalRequired?: boolean | undefined } |
| 499 | ): Promise<string | undefined> { |
| 500 | await page.locator('[data-testid="NavTabsItem--Calls"]').click(); |
| 501 | await page.locator('.NavSidebar__HeaderTitle').getByText('Calls').waitFor(); |
| 502 | |
| 503 | await page |
| 504 | .locator('.CallsList__ItemTile') |
| 505 | .getByText('Create a Call Link') |
| 506 | .click(); |
| 507 | |
| 508 | const editModal = page.getByRole('dialog', { name: 'Call link details' }); |
| 509 | await editModal.waitFor(); |
| 510 | |
| 511 | if (isAdminApprovalRequired !== undefined) { |
| 512 | const restrictionsInput = editModal.getByLabel('Require admin approval'); |
| 513 | if (isAdminApprovalRequired) { |
| 514 | await expect(restrictionsInput).toHaveJSProperty('value', '0'); |
| 515 | await restrictionsInput.selectOption({ label: 'On' }); |
| 516 | await expect(restrictionsInput).toHaveJSProperty('value', '1'); |
| 517 | } else { |
| 518 | await expect(restrictionsInput).toHaveJSProperty('value', '0'); |
| 519 | } |
| 520 | } |
| 521 | |
| 522 | await editModal.getByRole('button', { name: 'Add call name' }).click(); |
| 523 | |
| 524 | const addNameModal = page.locator('.CallLinkAddNameModal'); |
| 525 | await addNameModal.waitFor(); |
| 526 | |
| 527 | const nameInput = addNameModal.getByLabel('Call name'); |
| 528 | await nameInput.fill(name); |
| 529 | |
| 530 | const saveBtn = addNameModal.getByText('Save'); |
| 531 | await saveBtn.click(); |
| 532 | |
| 533 | await editModal.waitFor(); |
| 534 | |
| 535 | const doneBtn = editModal.getByText('Done'); |
| 536 | await doneBtn.click(); |
| 537 | |
| 538 | const callLinkTitle = page.locator('.CallsList__ItemTile').getByText(name); |
| 539 | |
| 540 | const callLinkItem = page.locator('.CallsList__Item', { |
| 541 | has: callLinkTitle, |
| 542 | }); |
| 543 | const testId = await callLinkItem.getAttribute('data-testid'); |
| 544 | return testId || undefined; |
| 545 | } |
no test coverage detected