A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: wait for route header to be visible before running tests
Abdullah Atta7e9dc0e55cc3
diff --git a/apps/web/__e2e__/models/app.model.ts b/apps/web/__e2e__/models/app.model.tsindex 1392e9192..98f728b3f 100644--- a/apps/web/__e2e__/models/app.model.ts+++ b/apps/web/__e2e__/models/app.model.ts@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-import { Page } from "@playwright/test";+import { Locator, Page } from "@playwright/test";import { getTestId } from "../utils";import { AuthModel } from "./auth.model";import { CheckoutModel } from "./checkout.model";@@ -36,6 +36,7 @@ export class AppModel {readonly navigation: NavigationMenuModel;readonly auth: AuthModel;readonly checkout: CheckoutModel;+ readonly routeHeader: Locator;constructor(page: Page) {this.page = page;@@ -43,11 +44,12 @@ export class AppModel {this.navigation = new NavigationMenuModel(page);this.auth = new AuthModel(page);this.checkout = new CheckoutModel(page);+ this.routeHeader = this.page.locator(getTestId("routeHeader"));}async goto() {await this.page.goto("/");- await this.getRouteHeader();+ await this.routeHeader.waitFor({ state: "visible" });}goBack() {@@ -90,7 +92,7 @@ export class AppModel {return new SettingsViewModel(this.page);}- private async navigateTo(title: string) {+ async navigateTo(title: string) {if ((await this.getRouteHeader()) === title) return;const item = await this.navigation.findItem(title);await item?.click();@@ -98,10 +100,9 @@ export class AppModel {}async getRouteHeader() {- const routeHeader = this.page.locator(getTestId("routeHeader"));- if (!(await routeHeader.isVisible())) return;+ if (!(await this.routeHeader.isVisible())) return;- return await routeHeader.inputValue();+ return await this.routeHeader.inputValue();}async isSynced() {diff --git a/apps/web/__e2e__/navigation.test.ts b/apps/web/__e2e__/navigation.test.tsindex 7627447d8..36e01ee72 100644--- a/apps/web/__e2e__/navigation.test.ts+++ b/apps/web/__e2e__/navigation.test.ts@@ -40,10 +40,8 @@ for (const route of routes) {const app = new AppModel(page);await app.goto();- const item = await app.navigation.findItem(route.header);- await item?.click();+ await app.navigateTo(route.header);- expect(item).toBeDefined();expect(await app.getRouteHeader()).toBe(route.header);});}