diff --git a/.env.example b/.env.example index 20bef8f8aa..22816b653e 100644 --- a/.env.example +++ b/.env.example @@ -215,3 +215,8 @@ PROJECT_ID_VERCEL= TEAM_ID_VERCEL= # Get it from: https://vercel.com/account/tokens AUTH_BEARER_TOKEN_VERCEL= + +# - APPLE CALENDAR +# Used for E2E tests on Apple Calendar +E2E_TEST_APPLE_CALENDAR_EMAIL="" +E2E_TEST_APPLE_CALENDAR_PASSWORD="" diff --git a/.github/workflows/e2e-app-store.yml b/.github/workflows/e2e-app-store.yml index 9b824f1e81..3ce655f4cb 100644 --- a/.github/workflows/e2e-app-store.yml +++ b/.github/workflows/e2e-app-store.yml @@ -41,6 +41,8 @@ jobs: CALENDSO_ENCRYPTION_KEY: ${{ secrets.CI_CALENDSO_ENCRYPTION_KEY }} DATABASE_URL: ${{ secrets.CI_DATABASE_URL }} DEPLOYSENTINEL_API_KEY: ${{ secrets.DEPLOYSENTINEL_API_KEY }} + E2E_TEST_APPLE_CALENDAR_EMAIL: ${{ secrets.E2E_TEST_APPLE_CALENDAR_EMAIL }} + E2E_TEST_APPLE_CALENDAR_PASSWORD: ${{ secrets.E2E_TEST_APPLE_CALENDAR_PASSWORD }} GOOGLE_API_CREDENTIALS: ${{ secrets.CI_GOOGLE_API_CREDENTIALS }} GOOGLE_LOGIN_ENABLED: ${{ vars.CI_GOOGLE_LOGIN_ENABLED }} NEXTAUTH_SECRET: ${{ secrets.CI_NEXTAUTH_SECRET }} diff --git a/.github/workflows/e2e-embed-react.yml b/.github/workflows/e2e-embed-react.yml index 6a1cbbf272..5b356246c7 100644 --- a/.github/workflows/e2e-embed-react.yml +++ b/.github/workflows/e2e-embed-react.yml @@ -38,6 +38,8 @@ jobs: CALENDSO_ENCRYPTION_KEY: ${{ secrets.CI_CALENDSO_ENCRYPTION_KEY }} DATABASE_URL: ${{ secrets.CI_DATABASE_URL }} DEPLOYSENTINEL_API_KEY: ${{ secrets.DEPLOYSENTINEL_API_KEY }} + E2E_TEST_APPLE_CALENDAR_EMAIL: ${{ secrets.E2E_TEST_APPLE_CALENDAR_EMAIL }} + E2E_TEST_APPLE_CALENDAR_PASSWORD: ${{ secrets.E2E_TEST_APPLE_CALENDAR_PASSWORD }} GOOGLE_API_CREDENTIALS: ${{ secrets.CI_GOOGLE_API_CREDENTIALS }} GOOGLE_LOGIN_ENABLED: ${{ vars.CI_GOOGLE_LOGIN_ENABLED }} NEXTAUTH_SECRET: ${{ secrets.CI_NEXTAUTH_SECRET }} diff --git a/.github/workflows/e2e-embed.yml b/.github/workflows/e2e-embed.yml index a162858006..dd6870665a 100644 --- a/.github/workflows/e2e-embed.yml +++ b/.github/workflows/e2e-embed.yml @@ -41,6 +41,8 @@ jobs: CALENDSO_ENCRYPTION_KEY: ${{ secrets.CI_CALENDSO_ENCRYPTION_KEY }} DATABASE_URL: ${{ secrets.CI_DATABASE_URL }} DEPLOYSENTINEL_API_KEY: ${{ secrets.DEPLOYSENTINEL_API_KEY }} + E2E_TEST_APPLE_CALENDAR_EMAIL: ${{ secrets.E2E_TEST_APPLE_CALENDAR_EMAIL }} + E2E_TEST_APPLE_CALENDAR_PASSWORD: ${{ secrets.E2E_TEST_APPLE_CALENDAR_PASSWORD }} GOOGLE_API_CREDENTIALS: ${{ secrets.CI_GOOGLE_API_CREDENTIALS }} GOOGLE_LOGIN_ENABLED: ${{ vars.CI_GOOGLE_LOGIN_ENABLED }} NEXTAUTH_SECRET: ${{ secrets.CI_NEXTAUTH_SECRET }} diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index d4c41d2c6c..424619bf35 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -40,6 +40,8 @@ jobs: CALENDSO_ENCRYPTION_KEY: ${{ secrets.CI_CALENDSO_ENCRYPTION_KEY }} DATABASE_URL: ${{ secrets.CI_DATABASE_URL }} DEPLOYSENTINEL_API_KEY: ${{ secrets.DEPLOYSENTINEL_API_KEY }} + E2E_TEST_APPLE_CALENDAR_EMAIL: ${{ secrets.E2E_TEST_APPLE_CALENDAR_EMAIL }} + E2E_TEST_APPLE_CALENDAR_PASSWORD: ${{ secrets.E2E_TEST_APPLE_CALENDAR_PASSWORD }} GOOGLE_API_CREDENTIALS: ${{ secrets.CI_GOOGLE_API_CREDENTIALS }} EMAIL_SERVER_HOST: ${{ secrets.CI_EMAIL_SERVER_HOST }} EMAIL_SERVER_PORT: ${{ secrets.CI_EMAIL_SERVER_PORT }} diff --git a/.github/workflows/production-build-without-database.yml b/.github/workflows/production-build-without-database.yml index 32ef0785f7..4e51066243 100644 --- a/.github/workflows/production-build-without-database.yml +++ b/.github/workflows/production-build-without-database.yml @@ -7,6 +7,8 @@ env: ALLOWED_HOSTNAMES: ${{ vars.CI_ALLOWED_HOSTNAMES }} CALENDSO_ENCRYPTION_KEY: ${{ secrets.CI_CALENDSO_ENCRYPTION_KEY }} DATABASE_URL: ${{ secrets.CI_DATABASE_URL }} + E2E_TEST_APPLE_CALENDAR_EMAIL: ${{ secrets.E2E_TEST_APPLE_CALENDAR_EMAIL }} + E2E_TEST_APPLE_CALENDAR_PASSWORD: ${{ secrets.E2E_TEST_APPLE_CALENDAR_PASSWORD }} GOOGLE_API_CREDENTIALS: ${{ secrets.CI_GOOGLE_API_CREDENTIALS }} GOOGLE_LOGIN_ENABLED: ${{ vars.CI_GOOGLE_LOGIN_ENABLED }} NEXTAUTH_SECRET: ${{ secrets.CI_NEXTAUTH_SECRET }} diff --git a/.github/workflows/production-build.yml b/.github/workflows/production-build.yml index 1a9a211b9f..3ea85d6141 100644 --- a/.github/workflows/production-build.yml +++ b/.github/workflows/production-build.yml @@ -7,6 +7,8 @@ env: ALLOWED_HOSTNAMES: ${{ vars.CI_ALLOWED_HOSTNAMES }} CALENDSO_ENCRYPTION_KEY: ${{ secrets.CI_CALENDSO_ENCRYPTION_KEY }} DATABASE_URL: ${{ secrets.CI_DATABASE_URL }} + E2E_TEST_APPLE_CALENDAR_EMAIL: ${{ secrets.E2E_TEST_APPLE_CALENDAR_EMAIL }} + E2E_TEST_APPLE_CALENDAR_PASSWORD: ${{ secrets.E2E_TEST_APPLE_CALENDAR_PASSWORD }} GOOGLE_API_CREDENTIALS: ${{ secrets.CI_GOOGLE_API_CREDENTIALS }} GOOGLE_LOGIN_ENABLED: ${{ vars.CI_GOOGLE_LOGIN_ENABLED }} NEXTAUTH_SECRET: ${{ secrets.CI_NEXTAUTH_SECRET }} diff --git a/apps/web/playwright/app-store.e2e.ts b/apps/web/playwright/app-store.e2e.ts index 92b2371da0..bf6ada8561 100644 --- a/apps/web/playwright/app-store.e2e.ts +++ b/apps/web/playwright/app-store.e2e.ts @@ -1,6 +1,7 @@ import { expect } from "@playwright/test"; import { test } from "./lib/fixtures"; +import { installAppleCalendar } from "./lib/testUtils"; test.describe.configure({ mode: "parallel" }); @@ -10,10 +11,9 @@ test.describe("App Store - Authed", () => { test("Browse apple-calendar and try to install", async ({ page, users }) => { const pro = await users.create(); await pro.apiLogin(); - await page.goto("/apps/categories/calendar"); - await page.click('[data-testid="app-store-app-card-apple-calendar"]'); - await page.waitForURL("/apps/apple-calendar"); - await page.click('[data-testid="install-app-button"]'); + + await installAppleCalendar(page); + await expect(page.locator(`text=Connect to Apple Server`)).toBeVisible(); }); @@ -31,9 +31,8 @@ test.describe("App Store - Authed", () => { test.describe("App Store - Unauthed", () => { test("Browse apple-calendar and try to install", async ({ page }) => { - await page.goto("/apps/categories/calendar"); - await page.click('[data-testid="app-store-app-card-apple-calendar"]'); - await page.click('[data-testid="install-app-button"]'); + await installAppleCalendar(page); + await expect(page.locator(`[data-testid="login-form"]`)).toBeVisible(); }); }); diff --git a/apps/web/playwright/apple-calendar.e2e.ts b/apps/web/playwright/apple-calendar.e2e.ts new file mode 100644 index 0000000000..4bdbe7e4d9 --- /dev/null +++ b/apps/web/playwright/apple-calendar.e2e.ts @@ -0,0 +1,35 @@ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ +import { expect } from "@playwright/test"; + +import { test } from "./lib/fixtures"; +import { installAppleCalendar } from "./lib/testUtils"; + +test.describe.configure({ mode: "parallel" }); + +test.afterEach(({ users }) => users.deleteAll()); + +const APPLE_CALENDAR_EMAIL = process.env.E2E_TEST_APPLE_CALENDAR_EMAIL!; +const APPLE_CALENDAR_PASSWORD = process.env.E2E_TEST_APPLE_CALENDAR_PASSWORD!; + +const SHOULD_SKIP_TESTS = !APPLE_CALENDAR_EMAIL || !APPLE_CALENDAR_PASSWORD; + +test.describe("Apple Calendar", () => { + // eslint-disable-next-line playwright/no-skipped-test + test.skip(SHOULD_SKIP_TESTS, "Skipping due to missing the testing credentials"); + + test("Should be able to install and login on Apple Calendar", async ({ page, users }) => { + const user = await users.create(); + await user.apiLogin(); + + await installAppleCalendar(page); + + await expect(page.locator('[data-testid="apple-calendar-form"]')).toBeVisible(); + + await page.fill('[data-testid="apple-calendar-email"]', APPLE_CALENDAR_EMAIL); + await page.fill('[data-testid="apple-calendar-password"]', APPLE_CALENDAR_PASSWORD); + await page.click('[data-testid="apple-calendar-login-button"]'); + + await expect(page.getByText("Apple Calendar")).toBeVisible(); + await expect(page.getByText(APPLE_CALENDAR_EMAIL)).toBeVisible(); + }); +}); diff --git a/apps/web/playwright/lib/testUtils.ts b/apps/web/playwright/lib/testUtils.ts index 4ef9eaaa43..01af676146 100644 --- a/apps/web/playwright/lib/testUtils.ts +++ b/apps/web/playwright/lib/testUtils.ts @@ -183,3 +183,10 @@ export async function gotoRoutingLink({ // HACK: There seems to be some issue with the inputs to the form getting reset if we don't wait. await new Promise((resolve) => setTimeout(resolve, 1000)); } + +export async function installAppleCalendar(page: Page) { + await page.goto("/apps/categories/calendar"); + await page.click('[data-testid="app-store-app-card-apple-calendar"]'); + await page.waitForURL("/apps/apple-calendar"); + await page.click('[data-testid="install-app-button"]'); +} diff --git a/packages/app-store/applecalendar/pages/setup/index.tsx b/packages/app-store/applecalendar/pages/setup/index.tsx index ac77a2eedf..0bef9573c6 100644 --- a/packages/app-store/applecalendar/pages/setup/index.tsx +++ b/packages/app-store/applecalendar/pages/setup/index.tsx @@ -64,13 +64,17 @@ export default function AppleCalendarSetup() { router.push(json.url); } }}> -
+
@@ -87,7 +92,10 @@ export default function AppleCalendarSetup() { - diff --git a/packages/embeds/embed-core/playwright/lib/testUtils.ts b/packages/embeds/embed-core/playwright/lib/testUtils.ts index 716a6d7341..e1afa3aa49 100644 --- a/packages/embeds/embed-core/playwright/lib/testUtils.ts +++ b/packages/embeds/embed-core/playwright/lib/testUtils.ts @@ -153,3 +153,10 @@ export async function rescheduleEvent(username: string, frame: Frame, page: Page await expect(frame.locator("[data-testid=success-page]")).toBeVisible(); return booking; } + +export async function installAppleCalendar(page: Page) { + await page.goto("/apps/categories/calendar"); + await page.click('[data-testid="app-store-app-card-apple-calendar"]'); + await page.waitForURL("/apps/apple-calendar"); + await page.click('[data-testid="install-app-button"]'); +} diff --git a/turbo.json b/turbo.json index 5d6eb147dc..ec76639de8 100644 --- a/turbo.json +++ b/turbo.json @@ -193,6 +193,8 @@ "DAILY_API_KEY", "DAILY_SCALE_PLAN", "DEBUG", + "E2E_TEST_APPLE_CALENDAR_EMAIL", + "E2E_TEST_APPLE_CALENDAR_PASSWORD", "EMAIL_FROM", "EMAIL_SERVER_HOST", "EMAIL_SERVER_PASSWORD",