memos/web/e2e-tests/002-basic.spec.ts
CorrectRoadH 81d4f01b7f
feat: add e2e test (#1486)
* add i18n

* add base e2e test

* add multiple test for e2e

* extract the funciton of write memo

* change test sturct

* deteled unused dir

* use fixture

* add fixture

* restruced the project

* feat: add workflow

* feat: change playwright test position

* feat: change playwright test position

* using yarn intead of npm

* change install method

* only enable sign in test

* adjust the order of test

* change report pos

* fix style of e2e workflow

* add review test

* unify locale

* randome write content

* change report pos

* reduce unused wait time

* reduce unused folder

* stash

* merge upstream locale

* change test name

* add test item

* change action name

* add lanuage setting

* add shotscreen

* change name of test

* fix the error of import dep

* fix the error of import dep

* fix the error of filename

* fix the format of workflow

* fix the name error of test case

* feat: change the describe of test case

* feat: remove unused test

* feat: change the fixtures name

* feat: remove unused config

* feat: change docker action

* feat: change the generate method

* feat: extrace screenshot

* feat: change extra path

* feat: change extra path

* feat: screenshot and upload

* feat: change upload filename

* feat: change login method

* feat: change e2e method

* feat: change e2e test

* feat: add wait for login

---------

Co-authored-by: CorrectRoadH <a778917369@gmail.comå>
2023-04-11 22:13:06 +08:00

38 lines
1.1 KiB
TypeScript

import { test, expect } from "@playwright/test";
import { review, login, writeMemo } from "./utils";
import randomstring from "randomstring";
test.use({
locale: "en-US",
timezoneId: "Europe/Berlin",
});
test.beforeEach(async ({ page }) => {
await login(page, "admin", "admin");
});
test.describe("Write some memos", async () => {
test("Write memos", async ({ page }) => {
const content = `${randomstring.generate()} from Write memos`;
await writeMemo(page, content);
await expect(page.getByText(content)).toBeVisible();
});
test("Write memos with Tag", async ({ page }) => {
const tag = randomstring.generate(5);
const content = `#${tag} ${randomstring.generate()} from Write memos with Tag`;
await writeMemo(page, content);
// 1.memo contentg 2.tags list of memos editor 3.tags list
await expect(page.getByText(tag)).toHaveCount(3);
});
});
test.describe("Daily Review", async () => {
test("Daily Review", async ({ page }) => {
const content = randomstring.generate();
await writeMemo(page, content);
await review(page);
await expect(page.getByText(content)).toBeVisible();
});
});