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>
t3chguy/dedup-icons-17oct
Michael Telatynski 2023-11-22 13:20:58 +00:00 committed by GitHub
parent eb5516b7b1
commit f3133f22ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 12 deletions

View File

@ -14,11 +14,13 @@ See the License for the specific language governing permissions and
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 config: PlaywrightTestConfig = {
export default defineConfig<TestOptions>({
use: {
headless: false,
viewport: { width: 1280, height: 720 },
@ -35,5 +37,14 @@ const config: PlaywrightTestConfig = {
outputDir: "playwright/test-results",
workers: 1,
reporter: process.env.CI ? "blob" : [["html", { outputFolder: "playwright/html-report" }]],
};
export default config;
projects: [
{
name: "Legacy Crypto",
use: { crypto: "legacy" },
},
{
name: "Rust Crypto",
use: { crypto: "rust" },
},
],
});

View File

@ -35,15 +35,30 @@ const CONFIG_JSON = {
map_style_url: "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx",
};
export const test = base.extend<{
startHomeserverOpts: StartHomeserverOpts | string;
homeserver: HomeserverInstance;
}>({
page: async ({ context, page }, use) => {
await context.route(`http://localhost:8080/config.json*`, async (route) => {
await route.fulfill({ json: CONFIG_JSON });
});
export type TestOptions = {
crypto: "legacy" | "rust";
};
export const test = base.extend<
TestOptions & {
config: typeof CONFIG_JSON;
startHomeserverOpts: StartHomeserverOpts | string;
homeserver: HomeserverInstance;
}
>({
crypto: ["legacy", { option: true }],
config: CONFIG_JSON,
page: async ({ context, page, config, crypto }, use) => {
await context.route(`http://localhost:8080/config.json*`, async (route) => {
const json = { ...config };
if (crypto === "rust") {
json["features"] = {
...json["features"],
feature_rust_crypto: true,
};
}
await route.fulfill({ json });
});
await use(page);
},