|
1 |
| -import { test } from "@playwright/test"; |
| 1 | +import { expect, test } from "@playwright/test"; |
2 | 2 |
|
3 |
| -test("Test OAuth login buttons", async ({ page }) => { |
4 |
| - await page.goto(`${process.env.PLAYWRIGHT_TEST_BASE_URL}/auth/login`); |
5 |
| - |
6 |
| - // Check for Google login button, then click through and check for email field |
7 |
| - await page.waitForSelector("[data-testid=google]"); |
8 |
| - |
9 |
| - await page.click("[data-testid=google]"); |
| 3 | +import { IS_GOOGLE_LOGIN_ENABLED, IS_SAML_LOGIN_ENABLED } from "../server/lib/constants"; |
10 | 4 |
|
11 |
| - await page.waitForNavigation({ |
12 |
| - waitUntil: "domcontentloaded", |
13 |
| - }); |
14 |
| - await page.waitForSelector('input[type="email"]'); |
| 5 | +test("Should display Google Login button", async ({ page }) => { |
| 6 | + test.skip(!IS_GOOGLE_LOGIN_ENABLED, "It should only run if Google Login is installed"); |
15 | 7 |
|
16 | 8 | await page.goto(`${process.env.PLAYWRIGHT_TEST_BASE_URL}/auth/login`);
|
17 | 9 |
|
18 |
| - await page.waitForSelector("[data-testid=saml]"); |
| 10 | + await expect(page.locator(`[data-testid=google]`)).toBeVisible(); |
| 11 | +}); |
19 | 12 |
|
20 |
| - // Check for SAML login button, then click through |
21 |
| - await page.click("[data-testid=saml]"); |
| 13 | +test("Should display SAML Login button", async ({ page }) => { |
| 14 | + test.skip(!IS_SAML_LOGIN_ENABLED, "It should only run if SAML Login is installed"); |
22 | 15 |
|
23 |
| - await page.waitForNavigation({ |
24 |
| - waitUntil: "domcontentloaded", |
25 |
| - }); |
| 16 | + await page.goto(`${process.env.PLAYWRIGHT_TEST_BASE_URL}/auth/login`); |
26 | 17 |
|
27 |
| - await page.context().close(); |
| 18 | + await expect(page.locator(`[data-testid=saml]`)).toBeVisible(); |
28 | 19 | });
|
0 commit comments