Add e2e structure
This commit is contained in:
parent
625960da26
commit
66e4baa017
@ -1,18 +1,20 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { expect, test } from "@docspace/shared/__mocks__/e2e";
|
||||
|
||||
test('has title', async ({ page }) => {
|
||||
await page.goto('https://playwright.dev/');
|
||||
test("has title", async ({ page }) => {
|
||||
await page.goto("http://192.168.0.16/login");
|
||||
|
||||
// Expect a title "to contain" a substring.
|
||||
await expect(page).toHaveTitle(/Playwright/);
|
||||
// // Expect a title "to contain" a substring.
|
||||
// await expect(page).toHaveTitle(/Playwright/);
|
||||
});
|
||||
|
||||
test('get started link', async ({ page }) => {
|
||||
await page.goto('https://playwright.dev/');
|
||||
// test("get started link", async ({ page }) => {
|
||||
// await page.goto("https://playwright.dev/");
|
||||
|
||||
// Click the get started link.
|
||||
await page.getByRole('link', { name: 'Get started' }).click();
|
||||
// // Click the get started link.
|
||||
// await page.getByRole("link", { name: "Get started" }).click();
|
||||
|
||||
// Expects page to have a heading with the name of Installation.
|
||||
await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible();
|
||||
});
|
||||
// // Expects page to have a heading with the name of Installation.
|
||||
// await expect(
|
||||
// page.getByRole("heading", { name: "Installation" }),
|
||||
// ).toBeVisible();
|
||||
// });
|
||||
|
25
packages/shared/__mocks__/e2e/handlers/capabilities.ts
Normal file
25
packages/shared/__mocks__/e2e/handlers/capabilities.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { http, HttpResponse } from "msw";
|
||||
|
||||
export const capabilitiesWithSSO = {
|
||||
response: {
|
||||
ldapEnabled: false,
|
||||
providers: [],
|
||||
ssoLabel: "Single Sign-on",
|
||||
oauthEnabled: true,
|
||||
ssoUrl: "http://192.168.0.16/sso/login",
|
||||
identityServerEnabled: true,
|
||||
},
|
||||
count: 1,
|
||||
links: [
|
||||
{
|
||||
href: "http://192.168.0.16/api/2.0/capabilities",
|
||||
action: "GET",
|
||||
},
|
||||
],
|
||||
status: 0,
|
||||
statusCode: 200,
|
||||
};
|
||||
|
||||
export default http.get("/api/2.0/capabilities", async () => {
|
||||
return HttpResponse.json(capabilitiesWithSSO);
|
||||
});
|
6
packages/shared/__mocks__/e2e/handlers/index.ts
Normal file
6
packages/shared/__mocks__/e2e/handlers/index.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import settings from "./settings";
|
||||
import capabilities from "./capabilities";
|
||||
|
||||
const handlers = [settings, capabilities];
|
||||
|
||||
export default handlers;
|
49
packages/shared/__mocks__/e2e/handlers/settings.ts
Normal file
49
packages/shared/__mocks__/e2e/handlers/settings.ts
Normal file
@ -0,0 +1,49 @@
|
||||
import { http, HttpResponse } from "msw";
|
||||
|
||||
export const settingsSuccessNoAuth = {
|
||||
response: {
|
||||
trustedDomainsType: 0,
|
||||
culture: "en-GB",
|
||||
utcOffset: "00:00:00",
|
||||
utcHoursOffset: 0,
|
||||
greetingSettings: "Web Office",
|
||||
ownerId: "00000000-0000-0000-0000-000000000000",
|
||||
enabledJoin: false,
|
||||
enableAdmMess: false,
|
||||
thirdpartyEnable: false,
|
||||
docSpace: true,
|
||||
standalone: true,
|
||||
baseDomain: "localhost",
|
||||
passwordHash: {
|
||||
size: 256,
|
||||
iterations: 100000,
|
||||
salt: "4d9abe238e2f7b14a30a4565d62214a795a15abb798ed61118a69820d6a6146c",
|
||||
},
|
||||
version: ".",
|
||||
recaptchaType: 0,
|
||||
recaptchaPublicKey: "",
|
||||
debugInfo: false,
|
||||
tenantStatus: 0,
|
||||
tenantAlias: "localhost",
|
||||
forumLink: "https://forum.onlyoffice.com",
|
||||
legalTerms:
|
||||
"https://help.onlyoffice.co/products/files/doceditor.aspx?fileid=5048502&doc=SXhWMEVzSEYxNlVVaXJJeUVtS0kyYk14YWdXTEFUQmRWL250NllHNUFGbz0_IjUwNDg1MDIi0",
|
||||
cookieSettingsEnabled: false,
|
||||
limitedAccessSpace: false,
|
||||
userNameRegex: "^[\\p{L}\\p{M}' \\-]+$",
|
||||
maxImageUploadSize: 0,
|
||||
},
|
||||
count: 1,
|
||||
links: [
|
||||
{
|
||||
href: "http://192.168.0.16/api/2.0/settings?withPassword=false",
|
||||
action: "GET",
|
||||
},
|
||||
],
|
||||
status: 0,
|
||||
statusCode: 200,
|
||||
};
|
||||
|
||||
export default http.get("/api/2.0/settings", async () => {
|
||||
return HttpResponse.json(settingsSuccessNoAuth);
|
||||
});
|
16
packages/shared/__mocks__/e2e/index.ts
Normal file
16
packages/shared/__mocks__/e2e/index.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { http } from "msw";
|
||||
import { test as base, expect } from "@playwright/test";
|
||||
import type { MockServiceWorker } from "playwright-msw";
|
||||
import { createWorkerFixture } from "playwright-msw";
|
||||
|
||||
import handlers from "./handlers";
|
||||
|
||||
const test = base.extend<{
|
||||
worker: MockServiceWorker;
|
||||
http: typeof http;
|
||||
}>({
|
||||
worker: createWorkerFixture(handlers),
|
||||
http,
|
||||
});
|
||||
|
||||
export { expect, test };
|
@ -91,7 +91,6 @@
|
||||
"@babel/preset-typescript": "^7.21.5",
|
||||
"@emotion/babel-preset-css-prop": "^10.2.1",
|
||||
"@emotion/styled": "^10.3.0",
|
||||
"@faker-js/faker": "^8.4.1",
|
||||
"@playwright/test": "^1.46.1",
|
||||
"@react-theming/storybook-addon": "^1.1.10",
|
||||
"@storybook/addon-actions": "7.6.12",
|
||||
@ -157,7 +156,6 @@
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"jest-styled-components": "^7.2.0",
|
||||
"msw": "^2.3.5",
|
||||
"msw-auto-mock": "^0.25.0",
|
||||
"playwright-msw": "^3.0.1",
|
||||
"postcss": "^7.0.39",
|
||||
"prettier": "^3.1.0",
|
||||
|
Loading…
Reference in New Issue
Block a user