Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

1.1 KB
Raw Blame
import type { Page } from "@playwright/test";
import { expect, test } from "@playwright/test";
import type { EditOptionsPage } from "./edit-options-page";
import { NewPollPage } from "./new-poll-page";

test.describe("edit options", () => {
  let page: Page;
  let editOptionsPage: EditOptionsPage;

  test.beforeAll(async ({ browser }) => {
    page = await browser.newPage();
    const newPollPage = new NewPollPage(page);
    await newPollPage.goto();
    const pollPage = await newPollPage.create({ name: "Monthly Meetup" });
    await pollPage.closeShareDialog();
    await pollPage.addParticipant("Mark");
    editOptionsPage = await pollPage.editOptions();
  });

  test("should show warning when deleting options with votes in them", async () => {
    // Polls default to timed options. Selecting all-day replaces the voted
    // time options with date options, which deletes the options that have votes.
    await editOptionsPage.selectAllDay();
    await page.getByRole("button", { name: "Save changes" }).click();
    await expect(page.locator('text="Are you sure?"')).toBeVisible();
    await page.click("text='Delete'");
  });
});