test: add apple calendar testing (#10137)

Co-authored-by: Shivam Kalra <[email protected]>
Co-authored-by: Omar López <[email protected]>
This commit is contained in:
authored and GitHub committed 2023-08-16 12:49:10 -07:00
1 parent 3552bbc6cf
commit 5eb3af54b3
13 files changed
+84 -9

No files matched your search

+6 -7
View File
@@ -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();
});
});
+35
View File
@@ -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();
});
});
+7
View File
@@ -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"]');
}