Login: add test env
This commit is contained in:
parent
6183b59be3
commit
917131b534
@ -1,7 +1,7 @@
|
||||
import { expect, test } from "@docspace/shared/__mocks__/e2e";
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("has title", async ({ page }) => {
|
||||
await page.goto("http://192.168.0.16/login");
|
||||
await page.goto("http://192.168.0.16:5011/login");
|
||||
|
||||
// // Expect a title "to contain" a substring.
|
||||
// await expect(page).toHaveTitle(/Playwright/);
|
||||
|
@ -11,6 +11,8 @@
|
||||
"lint": "next lint",
|
||||
"clean": "shx rm -rf .next",
|
||||
"deploy": "shx --silent mkdir -p ../../../publish/web/login && shx --silent mkdir -p ../../../publish/web/login/.next && shx --silent mkdir -p ../../../publish/web/login/node_modules && shx --silent mkdir -p ../../../publish/web/login/.next/static && shx cp -r .next/standalone/node_modules/* ../../../publish/web/login/node_modules && shx cp -r .next/static/* ../../../publish/web/login/.next/static && shx cp -r .next/standalone/packages/login/.next/* ../../../publish/web/login/.next && shx cp -f server.prod.js ../../../publish/web/login/server.js",
|
||||
"test:build": "node ./scripts/buildTranslations.js && TEST=true next build",
|
||||
"test:start": "NODE_ENV=production TEST=true node server.js",
|
||||
"test:e2e": "npx playwright test",
|
||||
"test:e2e:ui": "npx playwright test --ui"
|
||||
},
|
||||
|
@ -70,9 +70,8 @@ export default defineConfig({
|
||||
],
|
||||
|
||||
/* Run your local dev server before starting the tests */
|
||||
// webServer: {
|
||||
// command: 'npm run start',
|
||||
// url: 'http://127.0.0.1:3000',
|
||||
// reuseExistingServer: !process.env.CI,
|
||||
// },
|
||||
webServer: {
|
||||
command: "yarn test:build && yarn test:start",
|
||||
port: 5011,
|
||||
},
|
||||
});
|
||||
|
@ -53,6 +53,9 @@ import {
|
||||
} from "@/types";
|
||||
import { TScope } from "@docspace/shared/utils/oauth/types";
|
||||
import { transformToClientProps } from "@docspace/shared/utils/oauth";
|
||||
import { getMockSettingsResponse } from "@docspace/shared/__mocks__/e2e";
|
||||
|
||||
const IS_TEST = process.env.TEST;
|
||||
|
||||
export const checkIsAuthenticated = async () => {
|
||||
const [request] = createRequest(["/authentication"], [["", ""]], "GET");
|
||||
@ -73,7 +76,9 @@ export async function getSettings() {
|
||||
"GET",
|
||||
);
|
||||
|
||||
const settingsRes = await fetch(getSettings);
|
||||
const settingsRes = IS_TEST
|
||||
? getMockSettingsResponse(true)
|
||||
: await fetch(getSettings);
|
||||
|
||||
if (settingsRes.status === 403) return `access-restricted`;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user