Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: add more `waitFor`s for failing tests

Abdullah Atta7cc8b74a7a1a
diff --git a/apps/web/__e2e__/editor.test.ts b/apps/web/__e2e__/editor.test.ts
index d4a5f5dc2..a4bcc7980 100644
--- a/apps/web/__e2e__/editor.test.ts
+++ b/apps/web/__e2e__/editor.test.ts
@@ -169,7 +169,9 @@ test("select all & backspace should clear all content in editor", async ({
test("editing a note and switching immediately to another note and making an edit shouldn't overlap both notes", async ({
page
-}) => {
+}, test) => {
+ test.setTimeout(45 * 1000);
+
const app = new AppModel(page);
await app.goto();
const notes = await app.goToNotes();
@@ -206,7 +208,9 @@ test("editing a note and switching immediately to another note and making an edi
test("editing a note and switching immediately to another note and editing the title shouldn't overlap both notes", async ({
page
-}) => {
+}, test) => {
+ test.setTimeout(45 * 1000);
+
const app = new AppModel(page);
await app.goto();
const notes = await app.goToNotes();
diff --git a/apps/web/__e2e__/models/base-view.model.ts b/apps/web/__e2e__/models/base-view.model.ts
index e7b3c7e5d..85e961fc1 100644
--- a/apps/web/__e2e__/models/base-view.model.ts
+++ b/apps/web/__e2e__/models/base-view.model.ts
@@ -24,10 +24,14 @@ import { iterateList } from "./utils";
export class BaseViewModel {
protected readonly page: Page;
protected readonly list: Locator;
+ private readonly listPlaceholder: Locator;
constructor(page: Page, pageId: string) {
this.page = page;
this.list = page.locator(`#${pageId} >> ${getTestId("note-list")}`);
+ this.listPlaceholder = page.locator(
+ `#${pageId} >> ${getTestId("list-placeholder")}`
+ );
}
async findGroup(groupName: string) {
@@ -43,9 +47,11 @@ export class BaseViewModel {
}
protected async *iterateItems() {
+ await this.waitForList();
const locator = this.list.locator(
`${getTestId(`virtuoso-item-list`)} >> ${getTestId("list-item")}`
);
+
for await (const _item of iterateList(locator)) {
const id = await _item.getAttribute("id");
if (!id) return;
@@ -58,4 +64,12 @@ export class BaseViewModel {
async waitForItem(title: string) {
await this.list.locator(getTestId("title"), { hasText: title }).waitFor();
}
+
+ async waitForList() {
+ try {
+ await this.listPlaceholder.waitFor({ timeout: 1000 });
+ } catch {
+ await this.list.waitFor();
+ }
+ }
}
diff --git a/apps/web/__e2e__/models/note-properties.model.ts b/apps/web/__e2e__/models/note-properties.model.ts
index 0e6c61351..dcfe94125 100644
--- a/apps/web/__e2e__/models/note-properties.model.ts
+++ b/apps/web/__e2e__/models/note-properties.model.ts
@@ -176,6 +176,7 @@ export class NotePropertiesModel extends BaseProperties {
async open() {
await this.propertiesButton.click();
+ await this.propertiesCloseButton.waitFor();
}
async close() {
@@ -184,6 +185,8 @@ export class NotePropertiesModel extends BaseProperties {
async getSessionHistory() {
await this.open();
+ await this.sessionItems.first().waitFor();
+
const history: SessionHistoryItemModel[] = [];
for await (const item of iterateList(this.sessionItems)) {
history.push(new SessionHistoryItemModel(this, item));
diff --git a/apps/web/playwright.config.ts b/apps/web/playwright.config.ts
index 8597b1b31..2f2b414f1 100644
--- a/apps/web/playwright.config.ts
+++ b/apps/web/playwright.config.ts
@@ -65,12 +65,10 @@ const config: PlaywrightTestConfig = {
]
: [
{
- name: "Firefox",
- use: { browserName: "firefox" }
- },
- {
- name: "WebKit",
- use: { browserName: "webkit" }
+ name: "Chromium",
+ use: {
+ browserName: "chromium"
+ }
}
]
};
diff --git a/apps/web/src/components/list-container/index.tsx b/apps/web/src/components/list-container/index.tsx
index 47adf4c8f..31a26c5bc 100644
--- a/apps/web/src/components/list-container/index.tsx
+++ b/apps/web/src/components/list-container/index.tsx
@@ -100,7 +100,7 @@ function ListContainer(props: ListContainerProps) {
) : (
<>
{header || <ReminderBar />}
- <Flex variant="columnCenterFill">
+ <Flex variant="columnCenterFill" data-test-id="list-placeholder">
<props.placeholder />
</Flex>
</>