mirror of https://github.com/vector-im/riot-web
Run both legacy & rust crypto tests in Playwright (#11919)
* Install playwright Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Add foundations for writing tests under Playwright Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * .gitignore juggling Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Add tsconfig and fix eslint rules Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Add docker & synapse plugins Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Add login.spec.ts Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Wire up fixture which sets up ElementAppPage & bakes config.json Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove launch test, it has served its purpose Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove test which has been ported to Playwright Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix test not cleaning up after itself Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Move registerUser to the Homeserver interface Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove unused fixture param Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove redundant launch test Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Add newline * Run both legacy & rust crypto tests in Playwright Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove redundant comment Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> Co-authored-by: R Midhun Suresh <hi@midhun.dev>pull/28217/head
parent
eb5516b7b1
commit
f3133f22ca
|
@ -14,11 +14,13 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { PlaywrightTestConfig } from "@playwright/test";
|
import { defineConfig } from "@playwright/test";
|
||||||
|
|
||||||
|
import { TestOptions } from "./playwright/element-web-test";
|
||||||
|
|
||||||
const baseURL = process.env["BASE_URL"] ?? "http://localhost:8080";
|
const baseURL = process.env["BASE_URL"] ?? "http://localhost:8080";
|
||||||
|
|
||||||
const config: PlaywrightTestConfig = {
|
export default defineConfig<TestOptions>({
|
||||||
use: {
|
use: {
|
||||||
headless: false,
|
headless: false,
|
||||||
viewport: { width: 1280, height: 720 },
|
viewport: { width: 1280, height: 720 },
|
||||||
|
@ -35,5 +37,14 @@ const config: PlaywrightTestConfig = {
|
||||||
outputDir: "playwright/test-results",
|
outputDir: "playwright/test-results",
|
||||||
workers: 1,
|
workers: 1,
|
||||||
reporter: process.env.CI ? "blob" : [["html", { outputFolder: "playwright/html-report" }]],
|
reporter: process.env.CI ? "blob" : [["html", { outputFolder: "playwright/html-report" }]],
|
||||||
};
|
projects: [
|
||||||
export default config;
|
{
|
||||||
|
name: "Legacy Crypto",
|
||||||
|
use: { crypto: "legacy" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Rust Crypto",
|
||||||
|
use: { crypto: "rust" },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
|
@ -35,15 +35,30 @@ const CONFIG_JSON = {
|
||||||
map_style_url: "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx",
|
map_style_url: "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const test = base.extend<{
|
export type TestOptions = {
|
||||||
|
crypto: "legacy" | "rust";
|
||||||
|
};
|
||||||
|
|
||||||
|
export const test = base.extend<
|
||||||
|
TestOptions & {
|
||||||
|
config: typeof CONFIG_JSON;
|
||||||
startHomeserverOpts: StartHomeserverOpts | string;
|
startHomeserverOpts: StartHomeserverOpts | string;
|
||||||
homeserver: HomeserverInstance;
|
homeserver: HomeserverInstance;
|
||||||
}>({
|
}
|
||||||
page: async ({ context, page }, use) => {
|
>({
|
||||||
|
crypto: ["legacy", { option: true }],
|
||||||
|
config: CONFIG_JSON,
|
||||||
|
page: async ({ context, page, config, crypto }, use) => {
|
||||||
await context.route(`http://localhost:8080/config.json*`, async (route) => {
|
await context.route(`http://localhost:8080/config.json*`, async (route) => {
|
||||||
await route.fulfill({ json: CONFIG_JSON });
|
const json = { ...config };
|
||||||
|
if (crypto === "rust") {
|
||||||
|
json["features"] = {
|
||||||
|
...json["features"],
|
||||||
|
feature_rust_crypto: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
await route.fulfill({ json });
|
||||||
});
|
});
|
||||||
|
|
||||||
await use(page);
|
await use(page);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue