Auto-seed when resetting and migrating dev (#1513)
* Auto-seed when resetting and migrating dev * Fixes db-seed script * Oauth e2e test fixespull/1516/head
parent
fac4de1144
commit
73f607f27a
|
@ -10,7 +10,7 @@
|
||||||
"db-up": "docker-compose up -d",
|
"db-up": "docker-compose up -d",
|
||||||
"db-migrate": "yarn prisma migrate dev",
|
"db-migrate": "yarn prisma migrate dev",
|
||||||
"db-deploy": "yarn prisma migrate deploy",
|
"db-deploy": "yarn prisma migrate deploy",
|
||||||
"db-seed": "ts-node scripts/seed.ts",
|
"db-seed": "yarn prisma db seed",
|
||||||
"db-nuke": "docker-compose down --volumes --remove-orphans",
|
"db-nuke": "docker-compose down --volumes --remove-orphans",
|
||||||
"db-setup": "run-s db-up db-migrate db-seed",
|
"db-setup": "run-s db-up db-migrate db-seed",
|
||||||
"db-reset": "run-s db-nuke db-setup",
|
"db-reset": "run-s db-nuke db-setup",
|
||||||
|
@ -154,5 +154,8 @@
|
||||||
"./prisma/schema.prisma": [
|
"./prisma/schema.prisma": [
|
||||||
"prisma format"
|
"prisma format"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"prisma": {
|
||||||
|
"seed": "ts-node ./prisma/seed.ts"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,19 @@
|
||||||
import { test } from "@playwright/test";
|
import { expect, test } from "@playwright/test";
|
||||||
|
|
||||||
test("Test OAuth login buttons", async ({ page }) => {
|
import { IS_GOOGLE_LOGIN_ENABLED, IS_SAML_LOGIN_ENABLED } from "../server/lib/constants";
|
||||||
await page.goto(`${process.env.PLAYWRIGHT_TEST_BASE_URL}/auth/login`);
|
|
||||||
|
|
||||||
// Check for Google login button, then click through and check for email field
|
test("Should display Google Login button", async ({ page }) => {
|
||||||
await page.waitForSelector("[data-testid=google]");
|
test.skip(!IS_GOOGLE_LOGIN_ENABLED, "It should only run if Google Login is installed");
|
||||||
|
|
||||||
await page.click("[data-testid=google]");
|
|
||||||
|
|
||||||
await page.waitForNavigation({
|
|
||||||
waitUntil: "domcontentloaded",
|
|
||||||
});
|
|
||||||
await page.waitForSelector('input[type="email"]');
|
|
||||||
|
|
||||||
await page.goto(`${process.env.PLAYWRIGHT_TEST_BASE_URL}/auth/login`);
|
await page.goto(`${process.env.PLAYWRIGHT_TEST_BASE_URL}/auth/login`);
|
||||||
|
|
||||||
await page.waitForSelector("[data-testid=saml]");
|
await expect(page.locator(`[data-testid=google]`)).toBeVisible();
|
||||||
|
|
||||||
// Check for SAML login button, then click through
|
|
||||||
await page.click("[data-testid=saml]");
|
|
||||||
|
|
||||||
await page.waitForNavigation({
|
|
||||||
waitUntil: "domcontentloaded",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await page.context().close();
|
test("Should display SAML Login button", async ({ page }) => {
|
||||||
|
test.skip(!IS_SAML_LOGIN_ENABLED, "It should only run if SAML Login is installed");
|
||||||
|
|
||||||
|
await page.goto(`${process.env.PLAYWRIGHT_TEST_BASE_URL}/auth/login`);
|
||||||
|
|
||||||
|
await expect(page.locator(`[data-testid=saml]`)).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,3 +3,4 @@ export const { client_id: GOOGLE_CLIENT_ID, client_secret: GOOGLE_CLIENT_SECRET
|
||||||
JSON.parse(GOOGLE_API_CREDENTIALS)?.web;
|
JSON.parse(GOOGLE_API_CREDENTIALS)?.web;
|
||||||
export const GOOGLE_LOGIN_ENABLED = process.env.GOOGLE_LOGIN_ENABLED === "true";
|
export const GOOGLE_LOGIN_ENABLED = process.env.GOOGLE_LOGIN_ENABLED === "true";
|
||||||
export const IS_GOOGLE_LOGIN_ENABLED = !!(GOOGLE_CLIENT_ID && GOOGLE_CLIENT_SECRET && GOOGLE_LOGIN_ENABLED);
|
export const IS_GOOGLE_LOGIN_ENABLED = !!(GOOGLE_CLIENT_ID && GOOGLE_CLIENT_SECRET && GOOGLE_LOGIN_ENABLED);
|
||||||
|
export const IS_SAML_LOGIN_ENABLED = !!(process.env.SAML_DATABASE_URL && process.env.SAML_ADMINS);
|
||||||
|
|
Loading…
Reference in New Issue