First public commit

This commit is contained in:
Luke Vella 2022-04-12 07:14:28 +01:00
commit e05cd62e53
228 changed files with 17717 additions and 0 deletions

39
tests/create-poll.spec.ts Normal file
View file

@ -0,0 +1,39 @@
import { expect, test } from "@playwright/test";
test("should be able to create a new poll", async ({ page, context }) => {
await context.addCookies([
{
name: "rallly_cookie_consent",
value: "1",
url: "http://localhost",
},
]);
await page.goto("/new");
// // // Find an element with the text 'About Page' and click on it
await page.type('[placeholder="Monthly Meetup"]', "Monthly Meetup");
// click on label to focus on input
await page.click('text="Location"');
await page.keyboard.type("Joe's Coffee Shop");
await page.click('text="Description"');
await page.keyboard.type("This is a test description");
await page.click('text="Continue"');
await page.click('[title="Next month"]');
await page.click("text=/^5$/");
await page.click("text=/^7$/");
await page.click("text=/^10$/");
await page.click("text=/^15$/");
await page.click('text="Continue"');
await page.type('[placeholder="John Doe"]', "John");
await page.type('[placeholder="john.doe@email.com"]', "john.doe@email.com");
await page.click('text="Create poll"');
await expect(page.locator('text="Monthly Meetup"')).toBeVisible();
});

View file

@ -0,0 +1,21 @@
import { expect, test } from "@playwright/test";
test("should be able to vote and comment on a poll", async ({ page }) => {
await page.goto("/demo");
await expect(page.locator('text="Lunch Meeting Demo"')).toBeVisible();
await page.click("text='New Participant'");
await page.type('[placeholder="Your name"]', "Test user");
// There is a hidden checkbox (nth=0) that exists so that the behaviour of the form is consistent even
// when we only have a single option/checkbox.
await page.locator('[name="votes"] >> nth=1').click();
await page.locator('[name="votes"] >> nth=3').click();
await page.click('[data-testid="submitNewParticipant"]');
await expect(page.locator("text='Test user'")).toBeVisible();
await page.type("[placeholder='Add your comment…']", "This is a comment!");
await page.click("text='Send'");
await expect(page.locator("text='This is a comment!'")).toBeVisible();
});