Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 6cb70ff

Browse files
committed
playwright: remove redundant TestOptions
1 parent 32fa059 commit 6cb70ff

File tree

2 files changed

+66
-72
lines changed

2 files changed

+66
-72
lines changed

playwright.config.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ limitations under the License.
1616

1717
import { defineConfig } from "@playwright/test";
1818

19-
import { TestOptions } from "./playwright/element-web-test";
20-
2119
const baseURL = process.env["BASE_URL"] ?? "http://localhost:8080";
2220

23-
export default defineConfig<TestOptions>({
21+
export default defineConfig({
2422
use: {
2523
viewport: { width: 1280, height: 720 },
2624
ignoreHTTPSErrors: true,

playwright/element-web-test.ts

Lines changed: 65 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -63,79 +63,75 @@ const CONFIG_JSON: Partial<IConfigOptions> = {
6363
},
6464
};
6565

66-
export type TestOptions = {};
67-
6866
interface CredentialsWithDisplayName extends Credentials {
6967
displayName: string;
7068
}
7169

72-
export const test = base.extend<
73-
TestOptions & {
74-
axe: AxeBuilder;
75-
checkA11y: () => Promise<void>;
76-
77-
/**
78-
* The contents of the config.json to send when the client requests it.
79-
*/
80-
config: typeof CONFIG_JSON;
81-
82-
/**
83-
* The options with which to run the {@link #homeserver} fixture.
84-
*/
85-
startHomeserverOpts: StartHomeserverOpts | string;
86-
87-
homeserver: HomeserverInstance;
88-
oAuthServer: { port: number };
89-
90-
/**
91-
* The displayname to use for the user registered in {@link #credentials}.
92-
*
93-
* To set it, call `test.use({ displayName: "myDisplayName" })` in the test file or `describe` block.
94-
* See {@link https://playwright.dev/docs/api/class-test#test-use}.
95-
*/
96-
displayName?: string;
97-
98-
/**
99-
* A test fixture which registers a test user on the {@link #homeserver} and supplies the details
100-
* of the registered user.
101-
*/
102-
credentials: CredentialsWithDisplayName;
103-
104-
/**
105-
* The same as {@link https://playwright.dev/docs/api/class-fixtures#fixtures-page|`page`},
106-
* but adds an initScript which will populate localStorage with the user's details from
107-
* {@link #credentials} and {@link #homeserver}.
108-
*
109-
* Similar to {@link #user}, but doesn't load the app.
110-
*/
111-
pageWithCredentials: Page;
112-
113-
/**
114-
* A (rather poorly-named) test fixture which registers a user per {@link #credentials}, stores
115-
* the credentials into localStorage per {@link #homeserver}, and then loads the front page of the
116-
* app.
117-
*/
118-
user: CredentialsWithDisplayName;
119-
120-
/**
121-
* The same as {@link https://playwright.dev/docs/api/class-fixtures#fixtures-page|`page`},
122-
* but wraps the returned `Page` in a class of utilities for interacting with the Element-Web UI,
123-
* {@link ElementAppPage}.
124-
*/
125-
app: ElementAppPage;
126-
127-
mailhog: { api: mailhog.API; instance: Instance };
128-
crypto: Crypto;
129-
room?: { roomId: string };
130-
toasts: Toasts;
131-
uut?: Locator; // Unit Under Test, useful place to refer a prepared locator
132-
botCreateOpts: CreateBotOpts;
133-
bot: Bot;
134-
slidingSyncProxy: ProxyInstance;
135-
labsFlags: string[];
136-
webserver: Webserver;
137-
}
138-
>({
70+
export const test = base.extend<{
71+
axe: AxeBuilder;
72+
checkA11y: () => Promise<void>;
73+
74+
/**
75+
* The contents of the config.json to send when the client requests it.
76+
*/
77+
config: typeof CONFIG_JSON;
78+
79+
/**
80+
* The options with which to run the {@link #homeserver} fixture.
81+
*/
82+
startHomeserverOpts: StartHomeserverOpts | string;
83+
84+
homeserver: HomeserverInstance;
85+
oAuthServer: { port: number };
86+
87+
/**
88+
* The displayname to use for the user registered in {@link #credentials}.
89+
*
90+
* To set it, call `test.use({ displayName: "myDisplayName" })` in the test file or `describe` block.
91+
* See {@link https://playwright.dev/docs/api/class-test#test-use}.
92+
*/
93+
displayName?: string;
94+
95+
/**
96+
* A test fixture which registers a test user on the {@link #homeserver} and supplies the details
97+
* of the registered user.
98+
*/
99+
credentials: CredentialsWithDisplayName;
100+
101+
/**
102+
* The same as {@link https://playwright.dev/docs/api/class-fixtures#fixtures-page|`page`},
103+
* but adds an initScript which will populate localStorage with the user's details from
104+
* {@link #credentials} and {@link #homeserver}.
105+
*
106+
* Similar to {@link #user}, but doesn't load the app.
107+
*/
108+
pageWithCredentials: Page;
109+
110+
/**
111+
* A (rather poorly-named) test fixture which registers a user per {@link #credentials}, stores
112+
* the credentials into localStorage per {@link #homeserver}, and then loads the front page of the
113+
* app.
114+
*/
115+
user: CredentialsWithDisplayName;
116+
117+
/**
118+
* The same as {@link https://playwright.dev/docs/api/class-fixtures#fixtures-page|`page`},
119+
* but wraps the returned `Page` in a class of utilities for interacting with the Element-Web UI,
120+
* {@link ElementAppPage}.
121+
*/
122+
app: ElementAppPage;
123+
124+
mailhog: { api: mailhog.API; instance: Instance };
125+
crypto: Crypto;
126+
room?: { roomId: string };
127+
toasts: Toasts;
128+
uut?: Locator; // Unit Under Test, useful place to refer a prepared locator
129+
botCreateOpts: CreateBotOpts;
130+
bot: Bot;
131+
slidingSyncProxy: ProxyInstance;
132+
labsFlags: string[];
133+
webserver: Webserver;
134+
}>({
139135
config: CONFIG_JSON,
140136
page: async ({ context, page, config, labsFlags }, use) => {
141137
await context.route(`http://localhost:8080/config.json*`, async (route) => {

0 commit comments

Comments
 (0)