diff --git a/playwright-ct.config.ts b/playwright-ct.config.ts index e0e04eaa3..b5ddfe5fb 100644 --- a/playwright-ct.config.ts +++ b/playwright-ct.config.ts @@ -9,7 +9,7 @@ import dts from "vite-plugin-dts" * See https://playwright.dev/docs/test-configuration. */ export default defineConfig({ - testDir: "./src/react-components/", + testDir: "./src", /* Maximum time one test can run for. */ timeout: 10 * 1000, /* Run tests in files in parallel */ @@ -40,13 +40,20 @@ export default defineConfig({ ctPort: 3100, ctViteConfig: { plugins: [ + vanillaExtractPlugin(), react(), - vanillaExtractPlugin({ - emitCssInSsr: true, - }), dts({ insertTypesEntry: true }), ], - root: __dirname, + build: { + rollupOptions: { + external: ["express"], + output: { + globals: { + express: "express", + }, + }, + }, + }, }, }, /* Configure projects for major browsers */ diff --git a/src/markup-components/express.spec.ts b/src/markup-components/express.spec.ts deleted file mode 100644 index 539c1921d..000000000 --- a/src/markup-components/express.spec.ts +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright © 2023 Ory Corp -// SPDX-License-Identifier: Apache-2.0 - -import { expect, test } from "@playwright/experimental-ct-react" -import express from "express" -import { RegisterOryElementsExpress } from "./express" - -test("express ory elements routes", async ({ request }) => { - const app = express() - const theme = { - fontFamily: "", - fontFamilyMono: "", - fontStyle: "", - accent: { - def: "#3D53F5", - muted: "#6475F7", - emphasis: "#3142C4", - disabled: "#E0E0E0", - subtle: "#eceefe", - }, - foreground: { - def: "#171717", - muted: "#616161", - subtle: "#9E9E9E", - disabled: "#BDBDBD", - onDark: "#FFFFFF", - onAccent: "#FFFFFF", - onDisabled: "#e0e0e0", - }, - background: { - surface: "#FFFFFF", - canvas: "#FCFCFC", - subtle: "#EEEEEE", - }, - error: { - def: "#9c0f2e", - subtle: "#fce8ec", - muted: "#e95c7b", - emphasis: "#DF1642", - }, - success: { - emphasis: "#18A957", - }, - border: { - def: "#EEEEEE", - }, - text: { - def: "#FFFFFF", - disabled: "#757575", - }, - input: { - background: "#FFFFFF", - disabled: "#E0E0E0", - placeholder: "#9E9E9E", - text: "#424242", - }, - } - - RegisterOryElementsExpress(app, theme, () => ({ - theme: theme, - })) - - const server = app.listen() - - const address = server.address() - - await request - .get(`${address?.toString()}/theme.css`) - .then(({ body, status, headersArray }) => { - expect(status()).toEqual(200) - expect(headersArray()).toEqual([{ "Content-Type": "text/css" }]) - expect(body).toMatchSnapshot() - server.closeAllConnections() - }) -}) diff --git a/src/react-components/translations.spec.ts b/src/react-components/tests/translations.spec.ts similarity index 97% rename from src/react-components/translations.spec.ts rename to src/react-components/tests/translations.spec.ts index 38e248d6c..4d1def32d 100644 --- a/src/react-components/translations.spec.ts +++ b/src/react-components/tests/translations.spec.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { expect, test as base } from "@playwright/experimental-ct-react" -import * as supportedLanguages from "../locales" +import * as supportedLanguages from "../../locales" type Language = { [K in keyof typeof supportedLanguages.en]: string