Migrate user-view.spec.ts from Cypress to Playwright (#11944)

* Migrate user-view.spec.ts from Cypress to Playwright

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Add bot support & update screenshot

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Add screenshot

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Use JSHandle

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Remove stale snapshots

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Update element-web-test.ts

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2023-11-29 16:39:27 +00:00 committed by GitHub
parent 2160f29473
commit e897d7360d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 282 additions and 58 deletions

View file

@ -28,6 +28,7 @@ import { ElementAppPage } from "./pages/ElementAppPage";
import { OAuthServer } from "./plugins/oauth_server";
import { Crypto } from "./pages/crypto";
import { Toasts } from "./pages/toasts";
import { Bot, CreateBotOpts } from "./pages/bot";
const CONFIG_JSON: Partial<IConfigOptions> = {
// This is deliberately quite a minimal config.json, so that we can test that the default settings
@ -67,6 +68,8 @@ export const test = base.extend<
room?: { roomId: string };
toasts: Toasts;
uut?: Locator; // Unit Under Test, useful place to refer a prepared locator
botCreateOpts: CreateBotOpts;
bot: Bot;
}
>({
cryptoBackend: ["legacy", { option: true }],
@ -173,6 +176,13 @@ export const test = base.extend<
toasts: async ({ page }, use) => {
await use(new Toasts(page));
},
botCreateOpts: {},
bot: async ({ page, homeserver, botCreateOpts }, use) => {
const bot = new Bot(page, homeserver, botCreateOpts);
await bot.start();
await use(bot);
},
});
test.use({});