1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-18 02:19:18 +00:00

Working login with password to the vault

This commit is contained in:
Matt Gibson
2025-10-09 16:21:43 -07:00
parent 397e90d8bd
commit bc471c6847
2 changed files with 27 additions and 19 deletions

View File

@@ -2,24 +2,21 @@ import { test, expect } from "@playwright/test";
import { Play, SingleUserRecipe } from "@bitwarden/playwright-scenes";
test("has title", async ({ page }) => {
await page.goto("");
// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Bitwarden/);
});
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();
// Expects page to have a heading with the name of Installation.
await expect(page.getByRole("heading", { name: "Installation" })).toBeVisible();
});
test("login with password", async ({ page }) => {
using _ = await Play.scene(new SingleUserRecipe({ email: "test@example.com" }), { noDown: true });
await page.goto("");
using _ = await Play.scene(new SingleUserRecipe({ email: "test@example.com" }));
await page.goto("https://localhost:8080/#/login");
await page.getByRole("textbox", { name: "Email address (required)" }).click();
await page.getByRole("textbox", { name: "Email address (required)" }).fill("admin@large.test");
await page.getByRole("textbox", { name: "Email address (required)" }).press("Enter");
await page.getByRole("textbox", { name: "Master password (required)" }).click();
await page.getByRole("textbox", { name: "Master password (required)" }).fill("asdfasdfasdf");
await page.getByRole("button", { name: "Log in with master password" }).click();
await expect(page.getByRole("button", { name: "Add it later" })).toBeVisible();
await page.getByRole("button", { name: "Add it later" }).click();
await expect(page.locator("bit-simple-dialog")).toContainText(
"You can't autofill passwords without the browser extension",
);
await page.getByRole("link", { name: "Skip to web app" }).click();
await expect(page.locator("app-vault")).toContainText("There are no items to list. New item");
});

View File

@@ -24,6 +24,17 @@ class Scene implements UsingRequired {
return this._recipe;
}
/**
* Chainable method to set the scene to not be torn down when disposed.
* Note: if you do not tear down the scene, you are responsible for cleaning up any side effects.
*
* @returns The scene instance for chaining
*/
noDown(): this {
this.options.noDown = true;
return this;
}
get seedId(): string {
if (!this.inited) {
throw new Error("Scene must be initialized before accessing seedId");