Compare commits

...

16 Commits

Author SHA1 Message Date
Shivam Kalra 16ff63fa4f
Merge branch 'main' into test/google-calendar 2023-10-05 14:39:41 +05:30
Shivam Kalra d5899bca46
Merge branch 'main' into test/google-calendar 2023-10-04 21:02:25 +05:30
Shivam Kalra 528e335127
Merge branch 'main' into test/google-calendar 2023-10-03 12:34:55 +05:30
Shivam Kalra a8f5dea40c fix: skip for self hosted 2023-09-28 13:56:17 +05:30
Shivam Kalra 90ba62c110
Merge branch 'main' into test/google-calendar 2023-09-28 11:34:34 +05:30
Leo Giovanetti bfa098741e
Merge branch 'main' into test/google-calendar 2023-09-27 15:32:58 -03:00
Shivam Kalra 65462fcfce
Merge branch 'main' into test/google-calendar 2023-09-25 18:45:20 +05:30
Shivam Kalra 3d3c8dd4c0
Merge branch 'main' into test/google-calendar 2023-09-25 14:53:16 +05:30
Shivam Kalra 4b9e8d184a feat: SHOULD_FAIL_TESTS 2023-09-25 14:52:21 +05:30
Shivam Kalra ba7c1ac9e4
Merge branch 'main' into test/google-calendar 2023-09-25 12:03:53 +05:30
Shivam Kalra 58c4ccd5dc
Merge branch 'main' into test/google-calendar 2023-09-22 03:42:04 +05:30
Shivam Kalra d0bf8a63ab feat: add env to github workflows 2023-09-22 03:07:57 +05:30
Shivam Kalra 3d4370cb46 Merge branch 'main' into test/google-calendar 2023-09-22 02:34:12 +05:30
Shivam Kalra 62045f5e8b feat: fix final assertion and cleanup connection 2023-09-21 21:46:21 +05:30
Wesley Matos 90e3ac5e46 test: implement base google calendar tests 2023-09-16 14:11:03 -03:00
Wesley Matos a5a75a26f2 chore: add google calendar E2E variables 2023-09-16 14:10:37 -03:00
5 changed files with 84 additions and 0 deletions

View File

@ -230,6 +230,13 @@ AUTH_BEARER_TOKEN_VERCEL=
E2E_TEST_APPLE_CALENDAR_EMAIL=""
E2E_TEST_APPLE_CALENDAR_PASSWORD=""
# - GOOGLE CALENDAR
# Used for E2E tests on Google Calendar
E2E_TEST_GOOGLE_CALENDAR_EMAIL=""
E2E_TEST_GOOGLE_CALENDAR_PASSWORD=""
E2E_TEST_GOOGLE_AUTH_CONSENT_APPNAME=""
# - APP CREDENTIAL SYNC ***********************************************************************************
# Used for self-hosters that are implementing Cal.com into their applications that already have certain integrations
# Under settings/admin/apps ensure that all app secrets are set the same as the parent application

View File

@ -42,6 +42,9 @@ jobs:
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 }}
E2E_TEST_GOOGLE_AUTH_CONSENT_APPNAME: ${{ secrets.E2E_TEST_GOOGLE_AUTH_CONSENT_APPNAME }}
E2E_TEST_GOOGLE_CALENDAR_EMAIL: ${{ secrets.E2E_TEST_GOOGLE_CALENDAR_EMAIL }}
E2E_TEST_GOOGLE_CALENDAR_PASSWORD: ${{ secrets.E2E_TEST_GOOGLE_CALENDAR_PASSWORD }}
E2E_TEST_MAILHOG_ENABLED: ${{ vars.E2E_TEST_MAILHOG_ENABLED }}
GOOGLE_API_CREDENTIALS: ${{ secrets.CI_GOOGLE_API_CREDENTIALS }}
EMAIL_SERVER_HOST: ${{ secrets.CI_EMAIL_SERVER_HOST }}

View File

@ -0,0 +1,64 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { expect } from "@playwright/test";
import { IS_PRODUCTION, IS_SELF_HOSTED } from "@calcom/lib/constants";
import { test } from "./lib/fixtures";
import { installGoogleCalendar } from "./lib/testUtils";
test.describe.configure({ mode: "parallel" });
const GOOGLE_CALENDAR_EMAIL = process.env.E2E_TEST_GOOGLE_CALENDAR_EMAIL!;
const GOOGLE_CALENDAR_PASSWORD = process.env.E2E_TEST_GOOGLE_CALENDAR_PASSWORD!;
const GOOGLE_APPNAME = process.env.E2E_TEST_GOOGLE_AUTH_CONSENT_APPNAME!;
const SHOULD_FAIL_TESTS = !GOOGLE_CALENDAR_EMAIL || !GOOGLE_CALENDAR_PASSWORD || !GOOGLE_APPNAME;
test.afterEach(async ({ users, page }) => {
await page.goto("https://myaccount.google.com/connections?filters=2");
await page.locator(`a:has-text("${GOOGLE_APPNAME}")`).click();
await page.locator(`div[data-name="${GOOGLE_APPNAME}"][role="button"]`).click();
await page.getByRole("button", { name: "Confirm" }).click();
await users.deleteAll();
});
test.describe("Google Calendar", () => {
// eslint-disable-next-line playwright/no-skipped-test
test.skip(IS_SELF_HOSTED && IS_PRODUCTION, "Skipping for Self Hosted in Production");
expect(SHOULD_FAIL_TESTS).toBeFalsy();
test("Should be able to install and login on Google Calendar", async ({ page, users }) => {
const user = await users.create();
await user.apiLogin();
await installGoogleCalendar(page);
// wait for https://accounts.google.com
await page.waitForURL((url) => url.hostname === "accounts.google.com");
await page.waitForSelector('input[type="email"]');
await page.type('input[type="email"]', GOOGLE_CALENDAR_EMAIL);
await page.click("#identifierNext");
// password page
await page.waitForSelector('#password input[type="password"]');
await page.type('#password input[type="password"]', GOOGLE_CALENDAR_PASSWORD);
await page.click("#passwordNext");
// this is needed because I have an test app that is not verified by Google
// await page.waitForURL(/\/warning/);
await page.waitForURL((url) => url.pathname.includes("/warning"));
await page.getByRole("button", { name: "Continue" }).click();
await page.waitForSelector("#submit_approve_access");
// allowing all permissions that our app requests
await page.getByText("Select all").click();
await page.click("#submit_approve_access");
await page.waitForURL("apps/installed/calendar?category=calendar");
await expect(page.locator(`label[for="${GOOGLE_CALENDAR_EMAIL}"]`)).toBeVisible();
});
});

View File

@ -197,6 +197,13 @@ export async function installAppleCalendar(page: Page) {
await page.click('[data-testid="install-app-button"]');
}
export async function installGoogleCalendar(page: Page) {
await page.goto("/apps/categories/calendar");
await page.click('[data-testid="app-store-app-card-google-calendar"]');
await page.waitForURL("/apps/google-calendar");
await page.click('[data-testid="install-app-button"]');
}
export async function getEmailsReceivedByUser({
emails,
userEmail,

View File

@ -216,6 +216,9 @@
"DEBUG",
"E2E_TEST_APPLE_CALENDAR_EMAIL",
"E2E_TEST_APPLE_CALENDAR_PASSWORD",
"E2E_TEST_GOOGLE_AUTH_CONSENT_APPNAME",
"E2E_TEST_GOOGLE_CALENDAR_EMAIL",
"E2E_TEST_GOOGLE_CALENDAR_PASSWORD",
"E2E_TEST_MAILHOG_ENABLED",
"E2E_TEST_OIDC_CLIENT_ID",
"E2E_TEST_OIDC_CLIENT_SECRET",