From 4c720582a6599ddd46944aca0c8258de0af1471f Mon Sep 17 00:00:00 2001 From: Marcarrian Date: Fri, 12 Apr 2024 17:43:12 +0200 Subject: [PATCH] test(workbench/router): refactor router page object to reflect the Workbench Router API Page objects for the Workbench API should closely mimic the underlying API, i.e., provide a method similar to the actual API to make tests more readable and concise. Relates to #479 --- .../src/workbench/browser-history.e2e-spec.ts | 104 +-- .../src/workbench/browser-reload.e2e-spec.ts | 48 +- .../src/workbench/dialog.e2e-spec.ts | 16 +- .../workbench/maximize-main-area.e2e-spec.ts | 20 +- .../move-view-to-new-window.e2e-spec.ts | 40 +- .../workbench/navigational-state.e2e-spec.ts | 124 ++-- .../workbench/page-object/router-page.po.ts | 114 ++-- .../bulk-navigation-test-page.po.ts | 6 +- .../test-pages/input-field-test-page.po.ts | 8 +- .../workbench-theme-test-page.po.ts | 6 +- .../src/workbench/router-link.e2e-spec.ts | 150 ++-- .../src/workbench/router.e2e-spec.ts | 639 +++++++++--------- .../src/workbench/view-css-class.e2e-spec.ts | 118 ++-- .../src/workbench/view-route-data.e2e-spec.ts | 64 +- .../src/workbench/view-tab-bar.e2e-spec.ts | 110 +-- .../src/workbench/view.e2e-spec.ts | 43 +- .../src/lib/view/view.component.spec.ts | 8 +- 17 files changed, 806 insertions(+), 812 deletions(-) diff --git a/projects/scion/e2e-testing/src/workbench/browser-history.e2e-spec.ts b/projects/scion/e2e-testing/src/workbench/browser-history.e2e-spec.ts index 22d9f81c8..2f1d29a00 100644 --- a/projects/scion/e2e-testing/src/workbench/browser-history.e2e-spec.ts +++ b/projects/scion/e2e-testing/src/workbench/browser-history.e2e-spec.ts @@ -26,20 +26,22 @@ test.describe('Browser History', () => { // Add view-1 to the left part const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('view.101'); - await routerPage.enterBlankPartId('left'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'view.101', + blankPartId: 'left', + cssClass: 'testee' + }); // Expect view-1 to be active const testee1ViewPage = new ViewPagePO(appPO, {viewId: 'view.101'}); await expectView(testee1ViewPage).toBeActive(); // Add view-2 to the left part - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('view.102'); - await routerPage.enterBlankPartId('left'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'view.102', + blankPartId: 'left', + cssClass: 'testee' + }); // Expect view-2 to be active const testee2ViewPage = new ViewPagePO(appPO, {viewId: 'view.102'}); @@ -110,18 +112,20 @@ test.describe('Browser History', () => { // Add view-1 const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('view.101'); - await routerPage.checkActivate(false); - await routerPage.enterInsertionIndex('end'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'view.101', + activate: false, + blankInsertionIndex: 'end', + cssClass: 'testee' + }); // Add view-2 - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('view.102'); - await routerPage.checkActivate(false); - await routerPage.enterInsertionIndex('end'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'view.102', + activate: false, + blankInsertionIndex: 'end', + cssClass: 'testee' + }); const testee1ViewPage = new ViewPagePO(appPO, {viewId: 'view.101'}); const testee2ViewPage = new ViewPagePO(appPO, {viewId: 'view.102'}); @@ -189,10 +193,10 @@ test.describe('Browser History', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-pages/standalone-view-test-page/component'); - await routerPage.enterTarget(await routerPage.view.getViewId()); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/standalone-view-test-page/component'], { + target: await routerPage.view.getViewId(), + cssClass: 'testee' + }); const standaloneViewTestPage = new StandaloneViewTestPagePO(appPO, {cssClass: 'testee'}); await expectView(routerPage).not.toBeAttached(); @@ -211,10 +215,10 @@ test.describe('Browser History', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-pages/standalone-view-test-page/load-component'); - await routerPage.enterTarget(await routerPage.view.getViewId()); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/standalone-view-test-page/load-component'], { + target: await routerPage.view.getViewId(), + cssClass: 'testee' + }); const standaloneViewTestPage = new StandaloneViewTestPagePO(appPO, {cssClass: 'testee'}); await expectView(routerPage).not.toBeAttached(); @@ -233,10 +237,10 @@ test.describe('Browser History', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-pages/standalone-view-test-page/load-children/module'); - await routerPage.enterTarget(await routerPage.view.getViewId()); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/standalone-view-test-page/load-children/module'], { + target: await routerPage.view.getViewId(), + cssClass: 'testee' + }); const standaloneViewTestPage = new StandaloneViewTestPagePO(appPO, {cssClass: 'testee'}); await expectView(routerPage).not.toBeAttached(); @@ -255,10 +259,10 @@ test.describe('Browser History', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-pages/standalone-view-test-page/load-children/routes'); - await routerPage.enterTarget(await routerPage.view.getViewId()); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/standalone-view-test-page/load-children/routes'], { + target: await routerPage.view.getViewId(), + cssClass: 'testee' + }); const standaloneViewTestPage = new StandaloneViewTestPagePO(appPO, {cssClass: 'testee'}); await expectView(routerPage).not.toBeAttached(); @@ -277,10 +281,10 @@ test.describe('Browser History', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-pages/standalone-view-test-page/children'); - await routerPage.enterTarget(await routerPage.view.getViewId()); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/standalone-view-test-page/children'], { + target: await routerPage.view.getViewId(), + cssClass: 'testee' + }); const standaloneViewTestPage = new StandaloneViewTestPagePO(appPO, {cssClass: 'testee'}); await expectView(routerPage).not.toBeAttached(); @@ -302,10 +306,10 @@ test.describe('Browser History', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-pages/non-standalone-view-test-page/component'); - await routerPage.enterTarget(await routerPage.view.getViewId()); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/non-standalone-view-test-page/component'], { + target: await routerPage.view.getViewId(), + cssClass: 'testee' + }); const nonStandaloneViewTestPage = new NonStandaloneViewTestPagePO(appPO, {cssClass: 'testee'}); await expectView(routerPage).not.toBeAttached(); @@ -324,10 +328,10 @@ test.describe('Browser History', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-pages/non-standalone-view-test-page/load-children/module'); - await routerPage.enterTarget(await routerPage.view.getViewId()); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/non-standalone-view-test-page/load-children/module'], { + target: await routerPage.view.getViewId(), + cssClass: 'testee', + }); const nonStandaloneViewTestPage = new NonStandaloneViewTestPagePO(appPO, {cssClass: 'testee'}); await expectView(routerPage).not.toBeAttached(); @@ -346,10 +350,10 @@ test.describe('Browser History', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-pages/non-standalone-view-test-page/children'); - await routerPage.enterTarget(await routerPage.view.getViewId()); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/non-standalone-view-test-page/children'], { + target: await routerPage.view.getViewId(), + cssClass: 'testee' + }); const nonStandaloneViewTestPage = new NonStandaloneViewTestPagePO(appPO, {cssClass: 'testee'}); await expectView(routerPage).not.toBeAttached(); diff --git a/projects/scion/e2e-testing/src/workbench/browser-reload.e2e-spec.ts b/projects/scion/e2e-testing/src/workbench/browser-reload.e2e-spec.ts index 4dd5d2250..01a8d7f76 100644 --- a/projects/scion/e2e-testing/src/workbench/browser-reload.e2e-spec.ts +++ b/projects/scion/e2e-testing/src/workbench/browser-reload.e2e-spec.ts @@ -22,9 +22,9 @@ test.describe('Browser Reload', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-pages/standalone-view-test-page/component'); - await routerPage.enterTarget('view.101'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/standalone-view-test-page/component'], { + target: 'view.101', + }); const standaloneViewTestPage = new StandaloneViewTestPagePO(appPO, {viewId: 'view.101'}); await expectView(standaloneViewTestPage).toBeActive(); @@ -37,9 +37,9 @@ test.describe('Browser Reload', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-pages/standalone-view-test-page/load-component'); - await routerPage.enterTarget('view.101'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/standalone-view-test-page/load-component'], { + target: 'view.101', + }); const standaloneViewTestPage = new StandaloneViewTestPagePO(appPO, {viewId: 'view.101'}); await expectView(standaloneViewTestPage).toBeActive(); @@ -52,9 +52,9 @@ test.describe('Browser Reload', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-pages/standalone-view-test-page/load-children/module'); - await routerPage.enterTarget('view.101'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/standalone-view-test-page/load-children/module'], { + target: 'view.101', + }); const standaloneViewTestPage = new StandaloneViewTestPagePO(appPO, {viewId: 'view.101'}); await expectView(standaloneViewTestPage).toBeActive(); @@ -67,9 +67,9 @@ test.describe('Browser Reload', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-pages/standalone-view-test-page/load-children/routes'); - await routerPage.enterTarget('view.101'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/standalone-view-test-page/load-children/routes'], { + target: 'view.101', + }); const standaloneViewTestPage = new StandaloneViewTestPagePO(appPO, {viewId: 'view.101'}); await expectView(standaloneViewTestPage).toBeActive(); @@ -82,9 +82,9 @@ test.describe('Browser Reload', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-pages/standalone-view-test-page/children'); - await routerPage.enterTarget('view.101'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/standalone-view-test-page/children'], { + target: 'view.101', + }); const standaloneViewTestPage = new StandaloneViewTestPagePO(appPO, {viewId: 'view.101'}); await expectView(standaloneViewTestPage).toBeActive(); @@ -100,9 +100,9 @@ test.describe('Browser Reload', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-pages/non-standalone-view-test-page/component'); - await routerPage.enterTarget('view.101'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/non-standalone-view-test-page/component'], { + target: 'view.101', + }); const nonStandaloneViewTestPage = new NonStandaloneViewTestPagePO(appPO, {viewId: 'view.101'}); await expectView(nonStandaloneViewTestPage).toBeActive(); @@ -115,9 +115,9 @@ test.describe('Browser Reload', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-pages/non-standalone-view-test-page/load-children/module'); - await routerPage.enterTarget('view.101'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/non-standalone-view-test-page/load-children/module'], { + target: 'view.101', + }); const nonStandaloneViewTestPage = new NonStandaloneViewTestPagePO(appPO, {viewId: 'view.101'}); await expectView(nonStandaloneViewTestPage).toBeActive(); @@ -130,9 +130,9 @@ test.describe('Browser Reload', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-pages/non-standalone-view-test-page/children'); - await routerPage.enterTarget('view.101'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/non-standalone-view-test-page/children'], { + target: 'view.101', + }); const nonStandaloneViewTestPage = new NonStandaloneViewTestPagePO(appPO, {viewId: 'view.101'}); await expectView(nonStandaloneViewTestPage).toBeActive(); diff --git a/projects/scion/e2e-testing/src/workbench/dialog.e2e-spec.ts b/projects/scion/e2e-testing/src/workbench/dialog.e2e-spec.ts index 5378b3e3c..27231826f 100644 --- a/projects/scion/e2e-testing/src/workbench/dialog.e2e-spec.ts +++ b/projects/scion/e2e-testing/src/workbench/dialog.e2e-spec.ts @@ -2108,10 +2108,10 @@ test.describe('Workbench Dialog', () => { await dialogOpenerPage.view.tab.dragTo({partId: await dialogOpenerPage.view.part.getPartId(), region: 'east'}); // Navigate to FocusTestPageComponent - await routerPage.enterPath('/test-pages/focus-test-page'); - await routerPage.enterTarget(await routerPage.view.getViewId()); - await routerPage.enterCssClass('focus-page'); - await routerPage.clickNavigate(); + await routerPage.navigate(['/test-pages/focus-test-page'], { + target: await routerPage.view.getViewId(), + cssClass: 'focus-page' + }); // Open application-modal dialog. await dialogOpenerPage.open('dialog-page', {modality: 'application', cssClass: 'testee'}); @@ -2139,10 +2139,10 @@ test.describe('Workbench Dialog', () => { await dialogOpenerPage.view.tab.dragTo({partId: await dialogOpenerPage.view.part.getPartId(), region: 'east'}); // Navigate to FocusTestPageComponent - await routerPage.enterPath('/test-pages/focus-test-page'); - await routerPage.enterTarget(await routerPage.view.getViewId()); - await routerPage.enterCssClass('focus-page'); - await routerPage.clickNavigate(); + await routerPage.navigate(['/test-pages/focus-test-page'], { + target: await routerPage.view.getViewId(), + cssClass: 'focus-page' + }); // Open application-modal dialog. await dialogOpenerPage.open('dialog-page', {modality: 'application', cssClass: 'testee'}); diff --git a/projects/scion/e2e-testing/src/workbench/maximize-main-area.e2e-spec.ts b/projects/scion/e2e-testing/src/workbench/maximize-main-area.e2e-spec.ts index 2eb61ad5f..dd12cfc58 100644 --- a/projects/scion/e2e-testing/src/workbench/maximize-main-area.e2e-spec.ts +++ b/projects/scion/e2e-testing/src/workbench/maximize-main-area.e2e-spec.ts @@ -28,18 +28,18 @@ test.describe('Workbench', () => { // Open view 1 in main area. const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('blank'); - await routerPage.enterCssClass('view-1'); - await routerPage.checkActivate(false); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + activate: false, + cssClass: 'view-1' + }); // Open view 2 in main area. - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('blank'); - await routerPage.enterCssClass('view-2'); - await routerPage.checkActivate(false); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + activate: false, + cssClass: 'view-2' + }); await routerPage.view.tab.close(); // Move view 2 to the right of view 1. diff --git a/projects/scion/e2e-testing/src/workbench/move-view-to-new-window.e2e-spec.ts b/projects/scion/e2e-testing/src/workbench/move-view-to-new-window.e2e-spec.ts index e4bed0aea..48608623a 100644 --- a/projects/scion/e2e-testing/src/workbench/move-view-to-new-window.e2e-spec.ts +++ b/projects/scion/e2e-testing/src/workbench/move-view-to-new-window.e2e-spec.ts @@ -123,9 +123,9 @@ test.describe('Workbench View', () => { // Open test view in main area. const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('view.100'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'view.100', + }); // Move test view to new window. const newAppPO = await appPO.view({viewId: 'view.100'}).tab.moveToNewWindow(); @@ -172,9 +172,9 @@ test.describe('Workbench View', () => { // Open test view in main area. const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + cssClass: 'testee' + }); const testViewPage = appPO.view({cssClass: 'testee'}); @@ -314,9 +314,9 @@ test.describe('Workbench View', () => { // Open test view in main area. const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterCssClass('test-view'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + cssClass: 'test-view', + }); const testViewPage = appPO.view({cssClass: 'test-view'}); @@ -330,10 +330,10 @@ test.describe('Workbench View', () => { // Open peripheral view in the new browser window. const newAppRouterPage = await newWindow.workbenchNavigator.openInNewTab(RouterPagePO); - await newAppRouterPage.enterPath('test-view'); - await newAppRouterPage.enterCssClass('peripheral-view'); - await newAppRouterPage.enterTarget('blank'); - await newAppRouterPage.clickNavigate(); + await newAppRouterPage.navigate(['test-view'], { + target: 'blank', + cssClass: 'peripheral-view' + }); await newAppRouterPage.view.tab.close(); // Move peripheral view to workbench grid. @@ -411,9 +411,9 @@ test.describe('Workbench View', () => { // Open test view in main area. const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterCssClass('test-view'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + cssClass: 'test-view' + }); const testViewPage = appPO.view({cssClass: 'test-view'}); @@ -426,10 +426,10 @@ test.describe('Workbench View', () => { // Open peripheral view. const newAppRouterPage = await newWindow.workbenchNavigator.openInNewTab(RouterPagePO); - await newAppRouterPage.enterPath('test-view'); - await newAppRouterPage.enterCssClass('peripheral-view'); - await newAppRouterPage.enterTarget('blank'); - await newAppRouterPage.clickNavigate(); + await newAppRouterPage.navigate(['test-view'], { + target: 'blank', + cssClass: 'peripheral-view' + }); await newAppRouterPage.view.tab.close(); // Move peripheral view to workbench grid. diff --git a/projects/scion/e2e-testing/src/workbench/navigational-state.e2e-spec.ts b/projects/scion/e2e-testing/src/workbench/navigational-state.e2e-spec.ts index c67dfd01f..831a0ac41 100644 --- a/projects/scion/e2e-testing/src/workbench/navigational-state.e2e-spec.ts +++ b/projects/scion/e2e-testing/src/workbench/navigational-state.e2e-spec.ts @@ -20,9 +20,9 @@ test.describe('Navigational State', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + cssClass: 'testee', + }); const viewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); await expect.poll(() => viewPage.getState()).toEqual({}); @@ -32,10 +32,10 @@ test.describe('Navigational State', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterState({some: 'state'}); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + state: {some: 'state'}, + cssClass: 'testee', + }); const viewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); await expect.poll(() => viewPage.getState()).toEqual({some: 'state'}); @@ -58,18 +58,18 @@ test.describe('Navigational State', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterState({ - state1: 'value', - state2: '0', - state3: '2', - state4: 'true', - state5: 'false', - state6: '', - state7: '', + await routerPage.navigate(['test-view'], { + state: { + state1: 'value', + state2: '0', + state3: '2', + state4: 'true', + state5: 'false', + state6: '', + state7: '', + }, + cssClass: 'testee', }); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); const viewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); await expect.poll(() => viewPage.getState()).toEqual({ @@ -88,39 +88,39 @@ test.describe('Navigational State', () => { // Navigate view const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands(['test-view']); - await routerPage.enterState({state1: 'state 1'}); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + state: {state1: 'state 1'}, + cssClass: 'testee' + }); const viewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); await expect.poll(() => viewPage.getState()).toEqual({state1: 'state 1'}); // Navigate view again with a different state await routerPage.view.tab.click(); - await routerPage.enterCommands(['test-view', {matrix: 'param'}]); - await routerPage.enterState({state2: 'state 2'}); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view', {matrix: 'param'}], { + state: {state2: 'state 2'}, + cssClass: 'testee' + }); await expect.poll(() => viewPage.getState()).toEqual({state2: 'state 2'}); await expect.poll(() => viewPage.getParams()).toEqual({matrix: 'param'}); // Navigate view again without state await routerPage.view.tab.click(); - await routerPage.enterCommands(['test-view']); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + cssClass: 'testee' + }); await expect.poll(() => viewPage.getState()).toEqual({}); await expect.poll(() => viewPage.getParams()).toEqual({}); // Navigate view again with a different state await routerPage.view.tab.click(); - await routerPage.enterCommands(['test-view']); - await routerPage.enterState({state3: 'state 3'}); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + state: {state3: 'state 3'}, + cssClass: 'testee' + }); await expect.poll(() => viewPage.getState()).toEqual({state3: 'state 3'}); }); @@ -129,10 +129,10 @@ test.describe('Navigational State', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterState({some: 'state'}); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + state: {some: 'state'}, + cssClass: 'testee', + }); const viewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); await expect.poll(() => viewPage.getState()).toEqual({some: 'state'}); @@ -145,18 +145,18 @@ test.describe('Navigational State', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterState({some: 'state'}); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + state: {some: 'state'}, + cssClass: 'testee', + }); const viewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); await expect.poll(() => viewPage.getState()).toEqual({some: 'state'}); await routerPage.view.tab.click(); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('blank'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + }); // Expect view state to be preserved. await viewPage.view.tab.click(); @@ -178,10 +178,10 @@ test.describe('Navigational State', () => { const viewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); const routerPage = new RouterPagePO(appPO, {cssClass: 'router'}); - await routerPage.enterPath('test-view'); - await routerPage.enterState({'state': 'a'}); - await routerPage.enterTarget('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'testee', + state: {'state': 'a'}, + }); await expect.poll(() => viewPage.getState()).toEqual({state: 'a'}); // Move the view to the left and back again, simulating navigation without explicitly setting the state. @@ -189,16 +189,16 @@ test.describe('Navigational State', () => { await viewPage.view.tab.moveTo('left'); await viewPage.view.tab.moveTo('right'); - await routerPage.enterPath('test-view'); - await routerPage.enterState({'state': 'b'}); - await routerPage.enterTarget('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'testee', + state: {'state': 'b'}, + }); await expect.poll(() => viewPage.getState()).toEqual({state: 'b'}); - await routerPage.enterPath('test-view'); - await routerPage.enterState({'state': 'c'}); - await routerPage.enterTarget('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'testee', + state: {'state': 'c'}, + }); await expect.poll(() => viewPage.getState()).toEqual({state: 'c'}); await appPO.navigateBack(); @@ -228,12 +228,12 @@ test.describe('Navigational State', () => { // Open test view const routerPage = new RouterPagePO(appPO, {cssClass: 'workbench-router'}); - await routerPage.enterCommands(['test-view']); - await routerPage.enterState({some: 'state'}); - await routerPage.enterCssClass('testee'); - await routerPage.enterTarget('blank'); - await routerPage.enterBlankPartId('right'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + blankPartId: 'right', + state: {some: 'state'}, + cssClass: 'testee' + }); // Expect view state to be passed to the view. const viewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); diff --git a/projects/scion/e2e-testing/src/workbench/page-object/router-page.po.ts b/projects/scion/e2e-testing/src/workbench/page-object/router-page.po.ts index 95faf5633..34f03208a 100644 --- a/projects/scion/e2e-testing/src/workbench/page-object/router-page.po.ts +++ b/projects/scion/e2e-testing/src/workbench/page-object/router-page.po.ts @@ -8,15 +8,14 @@ * SPDX-License-Identifier: EPL-2.0 */ -import {coerceArray, commandsToPath, rejectWhenAttached, waitForCondition, waitUntilStable} from '../../helper/testing.util'; +import {coerceArray, commandsToPath, rejectWhenAttached, waitForCondition} from '../../helper/testing.util'; import {AppPO} from '../../app.po'; import {ViewPO} from '../../view.po'; import {SciKeyValueFieldPO} from '../../@scion/components.internal/key-value-field.po'; import {SciCheckboxPO} from '../../@scion/components.internal/checkbox.po'; import {Locator} from '@playwright/test'; -import {Params} from '@angular/router'; import {WorkbenchViewPagePO} from './workbench-view-page.po'; -import {Commands, ViewId, ViewState} from '@scion/workbench'; +import {Commands, ViewId, ViewState, WorkbenchNavigationExtras} from '@scion/workbench'; /** * Page object to interact with {@link RouterPageComponent}. @@ -32,80 +31,101 @@ export class RouterPagePO implements WorkbenchViewPagePO { } /** - * @deprecated use {@link enterCommands} instead. + * Navigates via {@link WorkbenchRouter}. */ - public async enterPath(path: string): Promise { - await this.locator.locator('input.e2e-commands').fill(path); + public async navigate(commands: Commands, extras?: WorkbenchNavigationExtras & RouterPageOptions): Promise { + await this.enterCommands(commands); + await this.enterExtras(extras); + + const navigationId = await this._appPO.getCurrentNavigationId(); + await this.locator.locator('button.e2e-router-navigate').click(); + + // Evaluate the response: resolve the promise on success, or reject it on error. + await Promise.race([ + waitForCondition(async () => (await this._appPO.getCurrentNavigationId()) !== navigationId), + rejectWhenAttached(this.locator.locator('output.e2e-navigate-error')), + ]); } - public async enterCommands(commands: Commands): Promise { + /** + * Navigates via workbench router link. + */ + public async navigateViaRouterLink(commands: Commands, extras?: Omit & RouterPageOptions & RouterLinkPageOptions): Promise { + await this.enterCommands(commands); + await this.enterExtras(extras); + + const navigationId = await this._appPO.getCurrentNavigationId(); + await this.locator.locator('a.e2e-router-link-navigate').click({modifiers: extras?.modifiers}); + + // Wait until navigation completed. + await waitForCondition(async () => (await this._appPO.getCurrentNavigationId()) !== navigationId); + } + + private async enterCommands(commands: Commands): Promise { await this.locator.locator('input.e2e-commands').fill(commandsToPath(commands)); } - public async enterQueryParams(params: Params): Promise { - const keyValueField = new SciKeyValueFieldPO(this.locator.locator('sci-key-value-field.e2e-query-params')); - await keyValueField.clear(); - await keyValueField.addEntries(params); + private async enterExtras(extras: WorkbenchNavigationExtras & RouterPageOptions | undefined): Promise { + await this.enterTarget(extras?.target); + await this.enterHint(extras?.hint); + await this.enterState(extras?.state); + await this.checkActivate(extras?.activate); + await this.checkClose(extras?.close); + await this.enterInsertionIndex(extras?.blankInsertionIndex); + await this.enterBlankPartId(extras?.blankPartId); + await this.checkViewContext(extras?.viewContextActive); + await this.enterCssClass(extras?.cssClass); } - public async enterState(state: ViewState): Promise { + private async enterState(state?: ViewState): Promise { const keyValueField = new SciKeyValueFieldPO(this.locator.locator('sci-key-value-field.e2e-state')); await keyValueField.clear(); - await keyValueField.addEntries(state); + await keyValueField.addEntries(state ?? {}); } - public async checkActivate(check: boolean): Promise { - await new SciCheckboxPO(this.locator.locator('sci-checkbox.e2e-activate')).toggle(check); + private async checkActivate(check?: boolean): Promise { + if (check !== undefined) { + await new SciCheckboxPO(this.locator.locator('sci-checkbox.e2e-activate')).toggle(check); + } } - public async checkClose(check: boolean): Promise { - await new SciCheckboxPO(this.locator.locator('sci-checkbox.e2e-close')).toggle(check); + private async checkClose(check?: boolean): Promise { + if (check !== undefined) { + await new SciCheckboxPO(this.locator.locator('sci-checkbox.e2e-close')).toggle(check); + } } - public async enterTarget(target?: string | 'blank' | 'auto'): Promise { + private async enterTarget(target?: string | 'blank' | 'auto'): Promise { await this.locator.locator('input.e2e-target').fill(target ?? ''); } - public async enterHint(hint?: string): Promise { + private async enterHint(hint?: string): Promise { await this.locator.locator('input.e2e-hint').fill(hint ?? ''); } - public async enterInsertionIndex(insertionIndex: number | 'start' | 'end' | undefined): Promise { - await this.locator.locator('input.e2e-insertion-index').fill(`${insertionIndex}`); + private async enterInsertionIndex(insertionIndex?: number | 'start' | 'end' | 'before-active-view' | 'after-active-view'): Promise { + await this.locator.locator('input.e2e-insertion-index').fill(`${insertionIndex ?? ''}`); } - public async enterBlankPartId(blankPartId: string): Promise { - await this.locator.locator('input.e2e-blank-part-id').fill(blankPartId); + private async enterBlankPartId(blankPartId?: string): Promise { + await this.locator.locator('input.e2e-blank-part-id').fill(blankPartId ?? ''); } - public async enterCssClass(cssClass: string | string[]): Promise { + private async enterCssClass(cssClass?: string | string[]): Promise { await this.locator.locator('input.e2e-class').fill(coerceArray(cssClass).join(' ')); } - public async checkViewContext(check: boolean): Promise { - await new SciCheckboxPO(this.locator.locator('sci-checkbox.e2e-view-context')).toggle(check); + private async checkViewContext(check?: boolean): Promise { + if (check !== undefined) { + await new SciCheckboxPO(this.locator.locator('sci-checkbox.e2e-view-context')).toggle(check); + } } +} - /** - * Clicks on a button to navigate via {@link WorkbenchRouter}. - */ - public async clickNavigate(): Promise { - const navigationId = await this._appPO.getCurrentNavigationId(); - await this.locator.locator('button.e2e-router-navigate').click(); - - // Evaluate the response: resolve the promise on success, or reject it on error. - await Promise.race([ - waitForCondition(async () => (await this._appPO.getCurrentNavigationId()) !== navigationId), - rejectWhenAttached(this.locator.locator('output.e2e-navigate-error')), - ]); - } +export interface RouterPageOptions { + viewContextActive?: boolean; +} - /** - * Clicks on the router link, optionally pressing the specified modifier key. - */ - public async clickNavigateViaRouterLink(modifiers?: Array<'Alt' | 'Control' | 'Meta' | 'Shift'>): Promise { - await this.locator.locator('a.e2e-router-link-navigate').click({modifiers}); - // Wait until navigation completed. - await waitUntilStable(() => this._appPO.getCurrentNavigationId()); - } +export interface RouterLinkPageOptions { + modifiers?: Array<'Alt' | 'Control' | 'Meta' | 'Shift'>; } diff --git a/projects/scion/e2e-testing/src/workbench/page-object/test-pages/bulk-navigation-test-page.po.ts b/projects/scion/e2e-testing/src/workbench/page-object/test-pages/bulk-navigation-test-page.po.ts index 049d2fb7f..e3f0cd554 100644 --- a/projects/scion/e2e-testing/src/workbench/page-object/test-pages/bulk-navigation-test-page.po.ts +++ b/projects/scion/e2e-testing/src/workbench/page-object/test-pages/bulk-navigation-test-page.po.ts @@ -51,9 +51,9 @@ export class BulkNavigationTestPagePO implements WorkbenchViewPagePO { const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); const viewId = await routerPage.view.getViewId(); - await routerPage.enterPath('test-pages/bulk-navigation-test-page'); - await routerPage.enterTarget(viewId); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/bulk-navigation-test-page'], { + target: viewId, + }); const view = appPO.view({cssClass: 'e2e-test-bulk-navigation', viewId}); await view.waitUntilAttached(); diff --git a/projects/scion/e2e-testing/src/workbench/page-object/test-pages/input-field-test-page.po.ts b/projects/scion/e2e-testing/src/workbench/page-object/test-pages/input-field-test-page.po.ts index c2f3b0190..4256366fa 100644 --- a/projects/scion/e2e-testing/src/workbench/page-object/test-pages/input-field-test-page.po.ts +++ b/projects/scion/e2e-testing/src/workbench/page-object/test-pages/input-field-test-page.po.ts @@ -76,10 +76,10 @@ export class InputFieldTestPagePO implements WorkbenchViewPagePO, WorkbenchDialo const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); const viewId = await routerPage.view.getViewId(); - await routerPage.enterPath('test-pages/input-field-test-page'); - await routerPage.enterTarget(viewId); - await routerPage.enterCssClass('input-field-test-page'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/input-field-test-page'], { + target: viewId, + cssClass: 'input-field-test-page' + }); const view = appPO.view({cssClass: 'input-field-test-page', viewId}); await view.waitUntilAttached(); diff --git a/projects/scion/e2e-testing/src/workbench/page-object/test-pages/workbench-theme-test-page.po.ts b/projects/scion/e2e-testing/src/workbench/page-object/test-pages/workbench-theme-test-page.po.ts index 852c3880f..3ec005e98 100644 --- a/projects/scion/e2e-testing/src/workbench/page-object/test-pages/workbench-theme-test-page.po.ts +++ b/projects/scion/e2e-testing/src/workbench/page-object/test-pages/workbench-theme-test-page.po.ts @@ -35,9 +35,9 @@ export class WorkbenchThemeTestPagePO implements WorkbenchViewPagePO { const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); const viewId = await routerPage.view.getViewId(); - await routerPage.enterPath('test-pages/workbench-theme-test-page'); - await routerPage.enterTarget(viewId); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/workbench-theme-test-page'], { + target: viewId, + }); const view = appPO.view({cssClass: 'e2e-test-workbench-theme', viewId}); await view.waitUntilAttached(); diff --git a/projects/scion/e2e-testing/src/workbench/router-link.e2e-spec.ts b/projects/scion/e2e-testing/src/workbench/router-link.e2e-spec.ts index 11d06b338..a3a463265 100644 --- a/projects/scion/e2e-testing/src/workbench/router-link.e2e-spec.ts +++ b/projects/scion/e2e-testing/src/workbench/router-link.e2e-spec.ts @@ -23,9 +23,9 @@ test.describe('Workbench RouterLink', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('/test-view'); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigateViaRouterLink(); + await routerPage.navigateViaRouterLink(['/test-view'], { + cssClass: 'testee', + }); const testeeViewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); await expect(appPO.views()).toHaveCount(1); @@ -50,9 +50,9 @@ test.describe('Workbench RouterLink', () => { // Open test view via router link. const routerPage = new RouterPagePO(appPO, {viewId: 'view.101'}); - await routerPage.enterCommands(['/test-view']); - await routerPage.enterState({navigated: 'true'}); - await routerPage.clickNavigateViaRouterLink(); + await routerPage.navigateViaRouterLink(['/test-view'], { + state: {navigated: 'true'}, + }); // Expect router page to be replaced await expect.poll(() => routerPage.view.getInfo()).toMatchObject( @@ -79,10 +79,10 @@ test.describe('Workbench RouterLink', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('/test-view'); - await routerPage.enterCssClass('testee'); - await routerPage.enterTarget('auto'); - await routerPage.clickNavigateViaRouterLink(); + await routerPage.navigateViaRouterLink(['/test-view'], { + target: 'auto', + cssClass: 'testee', + }); const testeeViewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); await expect(appPO.views()).toHaveCount(2); @@ -94,10 +94,10 @@ test.describe('Workbench RouterLink', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('/test-view'); - await routerPage.enterCssClass('testee'); - await routerPage.enterTarget('blank'); - await routerPage.clickNavigateViaRouterLink(); + await routerPage.navigateViaRouterLink(['/test-view'], { + target: 'blank', + cssClass: 'testee', + }); const testeeViewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); await expect(appPO.views()).toHaveCount(2); @@ -109,9 +109,10 @@ test.describe('Workbench RouterLink', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('/test-view'); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigateViaRouterLink(['Control']); + await routerPage.navigateViaRouterLink(['/test-view'], { + cssClass: 'testee', + modifiers: ['Control'], + }); const testeeViewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); await expect(appPO.views()).toHaveCount(2); @@ -124,10 +125,11 @@ test.describe('Workbench RouterLink', () => { const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); // Navigate via router link while pressing CTRL Modifier key. - await routerPage.enterCommands(['/test-view']); - await routerPage.enterTarget('auto'); - await routerPage.enterCssClass('testee-1'); - await routerPage.clickNavigateViaRouterLink(['Control']); + await routerPage.navigateViaRouterLink(['/test-view'], { + target: 'auto', + cssClass: 'testee-1', + modifiers: ['Control'], + }); const testeeViewPage1 = new ViewPagePO(appPO, {cssClass: 'testee-1'}); await expect(appPO.views()).toHaveCount(2); @@ -135,10 +137,11 @@ test.describe('Workbench RouterLink', () => { await expectView(testeeViewPage1).toBeInactive(); // Navigate via router link again while pressing CTRL Modifier key. - await routerPage.enterCommands(['/test-view']); - await routerPage.enterTarget('auto'); - await routerPage.enterCssClass('testee-2'); - await routerPage.clickNavigateViaRouterLink(['Control']); + await routerPage.navigateViaRouterLink(['/test-view'], { + target: 'auto', + cssClass: 'testee-2', + modifiers: ['Control'], + }); const testeeViewPage2 = new ViewPagePO(appPO, {cssClass: 'testee-2'}); await expect(appPO.views()).toHaveCount(3); @@ -155,9 +158,10 @@ test.describe('Workbench RouterLink', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('/test-view'); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigateViaRouterLink(['Meta']); + await routerPage.navigateViaRouterLink(['/test-view'], { + cssClass: 'testee', + modifiers: ['Meta'], + }); const testeeViewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); await expect(appPO.views()).toHaveCount(2); @@ -169,10 +173,11 @@ test.describe('Workbench RouterLink', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('/test-view'); - await routerPage.enterCssClass('testee'); - await routerPage.checkActivate(true); - await routerPage.clickNavigateViaRouterLink(['Control']); + await routerPage.navigateViaRouterLink(['/test-view'], { + activate: true, + cssClass: 'testee', + modifiers: ['Control'], + }); const testeeViewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); await expect(appPO.views()).toHaveCount(2); @@ -188,10 +193,11 @@ test.describe('Workbench RouterLink', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('/test-view'); - await routerPage.enterCssClass('testee'); - await routerPage.checkActivate(true); - await routerPage.clickNavigateViaRouterLink(['Meta']); + await routerPage.navigateViaRouterLink(['/test-view'], { + activate: true, + cssClass: 'testee', + modifiers: ['Meta'], + }); const testeeViewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); await expect(appPO.views()).toHaveCount(2); @@ -204,10 +210,10 @@ test.describe('Workbench RouterLink', () => { // WHEN const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('/test-view'); - await routerPage.enterCssClass('testee'); - await routerPage.checkViewContext(false); // simulate navigating outside a view context - await routerPage.clickNavigateViaRouterLink(); + await routerPage.navigateViaRouterLink(['/test-view'], { + viewContextActive: false, // simulate navigating outside a view context + cssClass: 'testee', + }); const testViewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); @@ -221,15 +227,15 @@ test.describe('Workbench RouterLink', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('/test-view'); - await routerPage.enterCssClass('testee-1'); - await routerPage.checkActivate(false); - await routerPage.clickNavigate(); + await routerPage.navigate(['/test-view'], { + activate: false, + cssClass: 'testee-1', + }); // WHEN - await routerPage.enterPath('/test-view'); - await routerPage.enterCssClass('testee-2'); - await routerPage.clickNavigateViaRouterLink(); + await routerPage.navigateViaRouterLink(['/test-view'], { + cssClass: 'testee-2', + }); const testViewPage1 = new ViewPagePO(appPO, {cssClass: 'testee-1'}); const testViewPage2 = new ViewPagePO(appPO, {cssClass: 'testee-2'}); @@ -251,8 +257,7 @@ test.describe('Workbench RouterLink', () => { // Navigate to path-based route via router link. const routerPage = new RouterPagePO(appPO, {viewId: 'view.100'}); - await routerPage.enterPath('/test-view'); - await routerPage.clickNavigateViaRouterLink(); + await routerPage.navigateViaRouterLink(['/test-view']); const testeeViewPage = new ViewPagePO(appPO, {viewId: 'view.100'}); @@ -277,10 +282,9 @@ test.describe('Workbench RouterLink', () => { // Navigate to empty-path route via router link. const routerPage = new RouterPagePO(appPO, {viewId: 'view.100'}); - await routerPage.enterPath(''); - await routerPage.enterHint(''); - await routerPage.enterState({navigated: 'true'}); - await routerPage.clickNavigateViaRouterLink(); + await routerPage.navigateViaRouterLink([], { + state: {navigated: 'true'}, + }); const testeeViewPage = new RouterPagePO(appPO, {viewId: 'view.100'}); @@ -306,9 +310,7 @@ test.describe('Workbench RouterLink', () => { // Navigate to empty-path route via router link. const routerPage = new RouterPagePO(appPO, {viewId: 'view.100'}); - await routerPage.enterPath('/'); - await routerPage.enterHint('test-view'); - await routerPage.clickNavigateViaRouterLink(); + await routerPage.navigateViaRouterLink(['/'], {hint: 'test-view'}); const testeeViewPage = new ViewPagePO(appPO, {viewId: 'view.100'}); @@ -333,9 +335,7 @@ test.describe('Workbench RouterLink', () => { // Navigate to empty-path route via router link. const routerPage = new RouterPagePO(appPO, {viewId: 'view.100'}); - await routerPage.enterPath(''); - await routerPage.enterHint('test-view'); - await routerPage.clickNavigateViaRouterLink(); + await routerPage.navigateViaRouterLink([], {hint: 'test-view'}); const testeeViewPage = new ViewPagePO(appPO, {viewId: 'view.100'}); @@ -360,9 +360,7 @@ test.describe('Workbench RouterLink', () => { // Navigate to empty-path route via router link. const routerPage = new RouterPagePO(appPO, {viewId: 'view.100'}); - await routerPage.enterPath('/'); - await routerPage.enterHint('test-view'); - await routerPage.clickNavigateViaRouterLink(); + await routerPage.navigateViaRouterLink(['/'], {hint: 'test-view'}); const testeeViewPage = new ViewPagePO(appPO, {viewId: 'view.100'}); @@ -387,8 +385,7 @@ test.describe('Workbench RouterLink', () => { // Navigate to path-based route via router link. const routerPage = new RouterPagePO(appPO, {viewId: 'view.100'}); - await routerPage.enterPath('test-view'); - await routerPage.clickNavigateViaRouterLink(); + await routerPage.navigateViaRouterLink(['test-view']); const testeeViewPage = new ViewPagePO(appPO, {viewId: 'view.100'}); @@ -406,8 +403,7 @@ test.describe('Workbench RouterLink', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands([{a: 'b', c: 'd'}]); - await routerPage.clickNavigateViaRouterLink(); + await routerPage.navigateViaRouterLink([{a: 'b', c: 'd'}]); await expectView(routerPage).toBeActive(); await expect.poll(() => routerPage.view.getInfo()).toMatchObject( @@ -437,9 +433,9 @@ test.describe('Workbench RouterLink', () => { // Open test view via router link. const routerPage = new RouterPagePO(appPO, {viewId: 'view.101'}); - await routerPage.enterPath('/test-view'); - await routerPage.enterState({navigated: 'true'}); - await routerPage.clickNavigateViaRouterLink(); + await routerPage.navigateViaRouterLink(['/test-view'], { + state: {navigated: 'true'}, + }); // Expect test view to replace the router page await expect.poll(() => view1.getInfo()).toMatchObject( @@ -487,10 +483,10 @@ test.describe('Workbench RouterLink', () => { // Open test view via router link. const routerPage = new RouterPagePO(appPO, {viewId: 'view.101'}); - await routerPage.enterCommands(['/test-view']); - await routerPage.enterTarget('blank'); - await routerPage.enterState({navigated: 'true'}); - await routerPage.clickNavigateViaRouterLink(); + await routerPage.navigateViaRouterLink(['/test-view'], { + target: 'blank', + state: {navigated: 'true'}, + }); // Expect test view to be opened await expect.poll(() => testView.getInfo()).toMatchObject( @@ -546,10 +542,10 @@ test.describe('Workbench RouterLink', () => { // Open test view via router link. const routerPage = new RouterPagePO(appPO, {viewId: 'view.101'}); - await routerPage.enterCommands(['/test-view']); - await routerPage.enterTarget('view.102'); - await routerPage.enterState({navigated: true}); - await routerPage.clickNavigateViaRouterLink(); + await routerPage.navigateViaRouterLink(['/test-view'], { + target: 'view.102', + state: {navigated: true}, + }); // Expect test view to be opened await expect.poll(() => testView.getInfo()).toMatchObject( diff --git a/projects/scion/e2e-testing/src/workbench/router.e2e-spec.ts b/projects/scion/e2e-testing/src/workbench/router.e2e-spec.ts index 5c5ff3fa7..df74cd389 100644 --- a/projects/scion/e2e-testing/src/workbench/router.e2e-spec.ts +++ b/projects/scion/e2e-testing/src/workbench/router.e2e-spec.ts @@ -25,10 +25,9 @@ test.describe('Workbench Router', () => { // open test view 1 const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands(['test-view', {param: '1'}]); - await routerPage.checkActivate(true); - await routerPage.enterTarget('view.101'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view', {param: '1'}], { + target: 'view.101', + }); const testeeViewPage = new ViewPagePO(appPO, {viewId: 'view.101'}); await expectView(testeeViewPage).toBeActive(); @@ -36,20 +35,14 @@ test.describe('Workbench Router', () => { // open test view 2 await routerPage.view.tab.click(); - await routerPage.enterCommands(['test-view', {param: '2'}]); - await routerPage.checkActivate(true); - await routerPage.enterTarget('auto'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view', {param: '2'}]); await expectView(testeeViewPage).toBeActive(); await expect(appPO.views()).toHaveCount(2); // open test view 3 await routerPage.view.tab.click(); - await routerPage.enterCommands(['test-view', {param: '3'}]); - await routerPage.checkActivate(true); - await routerPage.enterTarget('auto'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view', {param: '3'}]); await expectView(testeeViewPage).toBeActive(); await expect(appPO.views()).toHaveCount(2); @@ -60,9 +53,9 @@ test.describe('Workbench Router', () => { // open test view 1 const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands(['test-view', {param: '1'}]); - await routerPage.enterTarget('view.101'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view', {param: '1'}], { + target: 'view.101', + }); const testee1ViewPage = new ViewPagePO(appPO, {viewId: 'view.101'}); await expectView(testee1ViewPage).toBeActive(); @@ -70,9 +63,9 @@ test.describe('Workbench Router', () => { // open test view 2 await routerPage.view.tab.click(); - await routerPage.enterCommands(['test-view', {param: '2'}]); - await routerPage.enterTarget('view.102'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view', {param: '2'}], { + target: 'view.102', + }); const testee2ViewPage = new ViewPagePO(appPO, {viewId: 'view.102'}); await expectView(testee2ViewPage).toBeActive(); @@ -80,9 +73,9 @@ test.describe('Workbench Router', () => { // open test view 3 await routerPage.view.tab.click(); - await routerPage.enterCommands(['test-view', {param: '3'}]); - await routerPage.enterTarget('view.103'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view', {param: '3'}], { + target: 'view.103', + }); const testee3ViewPage = new ViewPagePO(appPO, {viewId: 'view.103'}); await expectView(testee3ViewPage).toBeActive(); @@ -90,10 +83,9 @@ test.describe('Workbench Router', () => { // close all test views await routerPage.view.tab.click(); - await routerPage.enterCommands(['test-view', {param: '1'}]); // matrix param is ignored when closing views - await routerPage.enterTarget(undefined); - await routerPage.checkClose(true); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view', {param: '1'}], { // matrix param is ignored when closing views + close: true, + }); await expectView(routerPage).toBeActive(); await expect(appPO.views()).toHaveCount(1); @@ -168,9 +160,9 @@ test.describe('Workbench Router', () => { // close all test views via router await routerPage.view.tab.click(); - await routerPage.enterPath('test-view'); - await routerPage.checkClose(true); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + close: true, + }); await expect(appPO.views()).toHaveCount(1); }); @@ -181,16 +173,15 @@ test.describe('Workbench Router', () => { // open the test view in a new view tab const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page'); - await routerPage.enterTarget('blank'); - await routerPage.enterTarget('view.101'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page'], { + target: 'view.101', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page'); - await routerPage.enterTarget('view.102'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page'], { + target: 'view.102', + }); const testee1ViewPage = new NavigationTestPagePO(appPO, {viewId: 'view.101'}); const testee2ViewPage = new NavigationTestPagePO(appPO, {viewId: 'view.102'}); @@ -200,10 +191,10 @@ test.describe('Workbench Router', () => { // close the view 1 await routerPage.view.tab.click(); - await routerPage.enterPath(''); - await routerPage.enterTarget('view.101'); - await routerPage.checkClose(true); - await routerPage.clickNavigate(); + await routerPage.navigate([], { + target: 'view.101', + close: true, + }); // expect the view 1 to be closed await expect(appPO.views()).toHaveCount(2); @@ -217,50 +208,50 @@ test.describe('Workbench Router', () => { // open the test view in a new view tab const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page'); - await routerPage.enterTarget('blank'); - await routerPage.enterCssClass('testee-1'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page'], { + target: 'blank', + cssClass: 'testee-1', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page'); - await routerPage.enterTarget('blank'); - await routerPage.enterCssClass('testee-2'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page'], { + target: 'blank', + cssClass: 'testee-2', + }); // expect the test views to be opened await expect(appPO.views()).toHaveCount(3); // try closing view 100 await routerPage.view.tab.click(); - await routerPage.enterPath(''); - await routerPage.enterTarget('view.100'); - await routerPage.checkClose(true); - await expect(() => routerPage.clickNavigate()).rejects.toThrow(/NullViewError/); + await expect(routerPage.navigate([], { + target: 'view.100', + close: true, + })).rejects.toThrow(/NullViewError/); }); test('should reject closing a view by viewId via router if a path is also given', async ({appPO, workbenchNavigator}) => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands(['test-pages/navigation-test-page']); - await routerPage.enterTarget('view.100'); - await routerPage.checkActivate(false); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page'], { + target: 'view.100', + activate: false, + }); // Expect to error when passing viewId and path - await routerPage.enterCommands(['test-pages/navigation-test-page']); - await routerPage.enterTarget('view.100'); - await routerPage.checkClose(true); - await expect(routerPage.clickNavigate()).rejects.toThrow(/\[NavigateError]/); + await expect(routerPage.navigate(['test-pages/navigation-test-page'], { + target: 'view.100', + close: true, + })).rejects.toThrow(/\[NavigateError]/); // Expect to error when passing viewId and hint - await routerPage.enterCommands([]); - await routerPage.enterTarget('view.100'); - await routerPage.enterHint('hint'); - await routerPage.checkClose(true); - await expect(routerPage.clickNavigate()).rejects.toThrow(/\[NavigateError]/); + await expect(routerPage.navigate([], { + target: 'view.100', + hint: 'hint', + close: true, + })).rejects.toThrow(/\[NavigateError]/); // Expect view not to be closed. const testeeViewPage = new NavigationTestPagePO(appPO, {viewId: 'view.100'}); @@ -273,31 +264,30 @@ test.describe('Workbench Router', () => { // open the test view in a new view tab const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page'); - await routerPage.enterTarget('view.101'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page'], { + target: 'view.101', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/1'); - await routerPage.enterTarget('view.102'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/1'], { + target: 'view.102', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page'); - await routerPage.enterTarget('view.103'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page'], { + target: 'view.103', + }); // expect the test views to be opened await expect(appPO.views()).toHaveCount(4); // close the views with the path 'test-pages/navigation-test-page' await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page'); - await routerPage.enterTarget(undefined); - await routerPage.checkClose(true); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page'], { + close: true, + }); const testee1ViewPage = new NavigationTestPagePO(appPO, {viewId: 'view.101'}); const testee2ViewPage = new NavigationTestPagePO(appPO, {viewId: 'view.102'}); @@ -317,31 +307,30 @@ test.describe('Workbench Router', () => { // open the test view in a new view tab const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page'); - await routerPage.enterTarget('view.101'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page'], { + target: 'view.101', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/1'); - await routerPage.enterTarget('view.102'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/1'], { + target: 'view.102', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/1'); - await routerPage.enterTarget('view.103'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/1'], { + target: 'view.103', + }); // expect the test views to be opened await expect(appPO.views()).toHaveCount(4); // close the views with the path 'test-pages/navigation-test-page/1' await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/1'); - await routerPage.enterTarget(undefined); - await routerPage.checkClose(true); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/1'], { + close: true, + }); const testee1ViewPage = new NavigationTestPagePO(appPO, {viewId: 'view.101'}); const testee2ViewPage = new NavigationTestPagePO(appPO, {viewId: 'view.102'}); @@ -361,31 +350,30 @@ test.describe('Workbench Router', () => { // open the test view in a new view tab const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page'); - await routerPage.enterTarget('view.101'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page'], { + target: 'view.101', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/1'); - await routerPage.enterTarget('view.102'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/1'], { + target: 'view.102', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/2'); - await routerPage.enterTarget('view.103'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/2'], { + target: 'view.103', + }); // expect the test views to be opened await expect(appPO.views()).toHaveCount(4); // close the views with the path 'test-pages/navigation-test-page/*' await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/*'); - await routerPage.enterTarget(undefined); - await routerPage.checkClose(true); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/*'], { + close: true, + }); const testee1ViewPage = new NavigationTestPagePO(appPO, {viewId: 'view.101'}); const testee2ViewPage = new NavigationTestPagePO(appPO, {viewId: 'view.102'}); @@ -405,49 +393,48 @@ test.describe('Workbench Router', () => { // open the test view in a new view tab const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page'); - await routerPage.enterTarget('view.101'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page'], { + target: 'view.101', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/1'); - await routerPage.enterTarget('view.102'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/1'], { + target: 'view.102', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/1/1'); - await routerPage.enterTarget('view.103'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/1/1'], { + target: 'view.103', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/1/2'); - await routerPage.enterTarget('view.104'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/1/2'], { + target: 'view.104', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/2/1'); - await routerPage.enterTarget('view.105'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/2/1'], { + target: 'view.105', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/2/2'); - await routerPage.enterTarget('view.106'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/2/2'], { + target: 'view.106', + }); // expect the test views to be opened await expect(appPO.views()).toHaveCount(7); // close the views with the path 'test-pages/navigation-test-page/1/1' await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/1/1'); - await routerPage.enterTarget(undefined); - await routerPage.checkClose(true); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/1/1'], { + close: true, + }); const testee1ViewPage = new NavigationTestPagePO(appPO, {viewId: 'view.101'}); const testee2ViewPage = new NavigationTestPagePO(appPO, {viewId: 'view.102'}); @@ -473,49 +460,48 @@ test.describe('Workbench Router', () => { // open the test view in a new view tab const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page'); - await routerPage.enterTarget('view.101'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page'], { + target: 'view.101', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/1'); - await routerPage.enterTarget('view.102'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/1'], { + target: 'view.102', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/1/1'); - await routerPage.enterTarget('view.103'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/1/1'], { + target: 'view.103', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/1/2'); - await routerPage.enterTarget('view.104'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/1/2'], { + target: 'view.104', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/2/1'); - await routerPage.enterTarget('view.105'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/2/1'], { + target: 'view.105', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/2/2'); - await routerPage.enterTarget('view.106'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/2/2'], { + target: 'view.106', + }); // expect the test views to be opened await expect(appPO.views()).toHaveCount(7); // close the views with the path 'test-pages/navigation-test-page/*/1' await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/*/1'); - await routerPage.enterTarget(undefined); - await routerPage.checkClose(true); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/*/1'], { + close: true, + }); const testee1ViewPage = new NavigationTestPagePO(appPO, {viewId: 'view.101'}); const testee2ViewPage = new NavigationTestPagePO(appPO, {viewId: 'view.102'}); @@ -541,49 +527,48 @@ test.describe('Workbench Router', () => { // open the test view in a new view tab const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page'); - await routerPage.enterTarget('view.101'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page'], { + target: 'view.101', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/1'); - await routerPage.enterTarget('view.102'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/1'], { + target: 'view.102', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/1/1'); - await routerPage.enterTarget('view.103'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/1/1'], { + target: 'view.103', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/1/2'); - await routerPage.enterTarget('view.104'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/1/2'], { + target: 'view.104', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/2/1'); - await routerPage.enterTarget('view.105'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/2/1'], { + target: 'view.105', + }); // open the test view in a new view tab await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/2/2'); - await routerPage.enterTarget('view.106'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/2/2'], { + target: 'view.106', + }); // expect the test views to be opened await expect(appPO.views()).toHaveCount(7); // close the views with the path 'test-pages/navigation-test-page/*/*' await routerPage.view.tab.click(); - await routerPage.enterPath('test-pages/navigation-test-page/*/*'); - await routerPage.enterTarget(undefined); - await routerPage.checkClose(true); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/*/*'], { + close: true, + }); const testee1ViewPage = new NavigationTestPagePO(appPO, {viewId: 'view.101'}); const testee2ViewPage = new NavigationTestPagePO(appPO, {viewId: 'view.102'}); @@ -608,10 +593,10 @@ test.describe('Workbench Router', () => { // navigate to the test view const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('blank'); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + cssClass: 'testee', + }); const testeeViewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); @@ -630,10 +615,10 @@ test.describe('Workbench Router', () => { const routerViewId = await routerPage.view.getViewId(); // navigate to the test view - await routerPage.enterPath('test-view'); - await routerPage.enterTarget(routerViewId); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: routerViewId, + cssClass: 'testee', + }); const testeeViewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); @@ -650,10 +635,10 @@ test.describe('Workbench Router', () => { // navigate to the test view const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterCssClass('testee-1'); - await routerPage.enterTarget('blank'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + cssClass: 'testee-1', + }); const testee1ViewPage = new ViewPagePO(appPO, {cssClass: 'testee-1'}); @@ -664,10 +649,10 @@ test.describe('Workbench Router', () => { // navigate to a new test view await routerPage.view.tab.click(); - await routerPage.enterPath('test-view'); - await routerPage.enterCssClass('testee-2'); - await routerPage.enterTarget('blank'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + cssClass: 'testee-2', + }); const testee2ViewPage = new ViewPagePO(appPO, {cssClass: 'testee-2'}); @@ -678,14 +663,14 @@ test.describe('Workbench Router', () => { await expectView(testee2ViewPage).toBeActive(); }); - test('should activate a present view if setting `checkActivate` to `true`', async ({appPO, workbenchNavigator}) => { + test('should activate a present view if setting `activate` to `true`', async ({appPO, workbenchNavigator}) => { await appPO.navigateTo({microfrontendSupport: false}); // navigate to the test view const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('view.100'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'view.100', + }); const testeeViewPage = new ViewPagePO(appPO, {viewId: 'view.100'}); @@ -696,10 +681,9 @@ test.describe('Workbench Router', () => { // activate the view via routing await routerPage.view.tab.click(); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('auto'); - await routerPage.checkActivate(true); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + activate: true, + }); // expect the view to be activated and no new view to be opened await expect(appPO.views()).toHaveCount(2); @@ -713,11 +697,10 @@ test.describe('Workbench Router', () => { const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); // navigate to the test view - await routerPage.enterPath('test-view'); - await routerPage.enterCssClass('testee-1'); - await routerPage.checkActivate(true); // activate the view - await routerPage.enterTarget('blank'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + cssClass: 'testee-1', + }); const testee1ViewPage = new ViewPagePO(appPO, {cssClass: 'testee-1'}); @@ -728,11 +711,11 @@ test.describe('Workbench Router', () => { // navigate to a new test view await routerPage.view.tab.click(); - await routerPage.enterPath('test-view'); - await routerPage.enterCssClass('testee-2'); - await routerPage.enterTarget('blank'); - await routerPage.checkActivate(false); // do not activate the view - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + activate: false, + cssClass: 'testee-2', + }); const testee2ViewPage = new ViewPagePO(appPO, {cssClass: 'testee-2'}); @@ -748,10 +731,9 @@ test.describe('Workbench Router', () => { // navigate to the test view const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterCssClass('testee'); - await routerPage.enterTarget('auto'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + cssClass: 'testee', + }); const testeeViewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); @@ -766,9 +748,9 @@ test.describe('Workbench Router', () => { // navigate to the test view const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('view.100'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'view.100', + }); const testee1ViewPage = new ViewPagePO(appPO, {viewId: 'view.100'}); @@ -779,9 +761,9 @@ test.describe('Workbench Router', () => { // activate the router test view await routerPage.view.tab.click(); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('auto'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'auto', + }); // expect the present view to be activated await expect(appPO.views()).toHaveCount(2); @@ -794,9 +776,9 @@ test.describe('Workbench Router', () => { // navigate to the test view 1 const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands(['test-view', {param: 'value1'}]); - await routerPage.enterTarget('view.101'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view', {param: 'value1'}], { + target: 'view.101', + }); const testee1ViewPage = new ViewPagePO(appPO, {viewId: 'view.101'}); @@ -805,9 +787,9 @@ test.describe('Workbench Router', () => { // navigate to the test view 2 await routerPage.view.tab.click(); - await routerPage.enterCommands(['test-view', {param: 'value1'}]); - await routerPage.enterTarget('view.102'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view', {param: 'value1'}], { + target: 'view.102', + }); const testee2ViewPage = new ViewPagePO(appPO, {viewId: 'view.102'}); @@ -816,9 +798,9 @@ test.describe('Workbench Router', () => { // update all matching present views await routerPage.view.tab.click(); - await routerPage.enterCommands(['test-view', {param: 'value2'}]); - await routerPage.enterTarget('auto'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view', {param: 'value2'}], { + target: 'auto', + }); // expect the present views to be updated await expect(appPO.views()).toHaveCount(3); @@ -835,9 +817,9 @@ test.describe('Workbench Router', () => { // navigate to the test view const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + cssClass: 'testee', + }); const testeeViewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); @@ -852,9 +834,9 @@ test.describe('Workbench Router', () => { // navigate to the test view const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('view.100'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'view.100', + }); const testeeView = new ViewPagePO(appPO, {viewId: 'view.100'}); @@ -865,9 +847,7 @@ test.describe('Workbench Router', () => { // navigate to a present view await routerPage.view.tab.click(); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget(''); // will be interpreted as undefined - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view']); // expect the present view to be activated await expect(appPO.views()).toHaveCount(2); @@ -876,9 +856,7 @@ test.describe('Workbench Router', () => { // navigate to a present view updating its matrix params await routerPage.view.tab.click(); - await routerPage.enterCommands(['test-view', {param: 'value1'}]); - await routerPage.enterTarget(''); // will be interpreted as undefined - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view', {param: 'value1'}]); // expect the present view to be updated await expect(appPO.views()).toHaveCount(2); @@ -892,9 +870,9 @@ test.describe('Workbench Router', () => { // navigate to the test view 1 const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands(['test-view', {param: 'value1'}]); - await routerPage.enterTarget('view.101'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view', {param: 'value1'}], { + target: 'view.101', + }); const testee1ViewPage = new ViewPagePO(appPO, {viewId: 'view.101'}); @@ -903,9 +881,9 @@ test.describe('Workbench Router', () => { // navigate to the test view 2 await routerPage.view.tab.click(); - await routerPage.enterCommands(['test-view', {param: 'value1'}]); - await routerPage.enterTarget('view.102'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view', {param: 'value1'}], { + target: 'view.102', + }); const testee2ViewPage = new ViewPagePO(appPO, {viewId: 'view.102'}); @@ -914,9 +892,7 @@ test.describe('Workbench Router', () => { // update all matching present views await routerPage.view.tab.click(); - await routerPage.enterCommands(['test-view', {param: 'value2'}]); - await routerPage.enterTarget(''); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view', {param: 'value2'}]); // expect the present views to be updated await expect(appPO.views()).toHaveCount(3); @@ -933,9 +909,9 @@ test.describe('Workbench Router', () => { // navigate to the test view const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('view.99'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'view.99', + }); const testee1ViewPage = new ViewPagePO(appPO, {viewId: 'view.99'}); @@ -960,13 +936,13 @@ test.describe('Workbench Router', () => { const testView1 = appPO.view({viewId: 'view.101'}); const testView2 = appPO.view({viewId: 'view.102'}); - // Navigate to empty-path route and hint 'test-view'. + // Navigate to empty-path route with hint 'test-view'. const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands([]); - await routerPage.enterHint('test-view'); - await routerPage.enterState({navigated: 'true'}); - await routerPage.enterTarget('auto'); - await routerPage.clickNavigate(); + await routerPage.navigate([], { + target: 'auto', + hint: 'test-view', + state: {navigated: 'true'}, + }); // Expect view.101 to be navigated. await expect.poll(() => testView1.getInfo()).toMatchObject( @@ -1001,10 +977,10 @@ test.describe('Workbench Router', () => { // Navigate to 'test-view' route without hint. const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands(['test-view']); - await routerPage.enterTarget('auto'); - await routerPage.enterState({navigated: 'true'}); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'auto', + state: {navigated: 'true'}, + }); // Expect view.101 not to be navigated. await expect.poll(() => testView1.getInfo()).toMatchObject( @@ -1039,11 +1015,11 @@ test.describe('Workbench Router', () => { // Navigate to 'test-view' route without hint. const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands(['test-view']); - await routerPage.enterHint('test-view'); - await routerPage.enterTarget('auto'); - await routerPage.enterState({navigated: 'true'}); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'auto', + hint: 'test-view', + state: {navigated: 'true'}, + }); // Expect view.101 to be navigated. await expect.poll(() => testView1.getInfo()).toMatchObject( @@ -1073,14 +1049,14 @@ test.describe('Workbench Router', () => { const testView1 = appPO.view({viewId: 'view.101'}); const testView2 = appPO.view({cssClass: 'testee'}); - // Navigate to empty-path route and hint 'test-view'. + // Navigate to empty-path route with hint 'test-view'. const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands([]); - await routerPage.enterHint('test-view'); - await routerPage.enterTarget('auto'); - await routerPage.enterState({navigated: 'true'}); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate([], { + target: 'auto', + hint: 'test-view', + state: {navigated: 'true'}, + cssClass: 'testee', + }); // Expect view.101 not to be navigated. await expect.poll(() => testView1.getInfo()).toMatchObject( @@ -1116,12 +1092,12 @@ test.describe('Workbench Router', () => { await expectView(testView1).toBeActive(); await expectView(testView2).toBeActive(); - // Close views navigated to empty-path route and hint 'test-view'. + // Close views navigated to empty-path route with hint 'test-view'. const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands([]); - await routerPage.enterHint('test-view'); - await routerPage.checkClose(true); - await routerPage.clickNavigate(); + await routerPage.navigate([], { + hint: 'test-view', + close: true, + }); // Expect view.101 to be closed. await expectView(testView1).not.toBeAttached(); @@ -1149,9 +1125,9 @@ test.describe('Workbench Router', () => { // Close views navigated to 'test-view' route without hint. const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands(['test-view']); - await routerPage.checkClose(true); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + close: true, + }); // Expect view.101 not to be closed. await expectView(testView1).toBeActive(); @@ -1179,10 +1155,10 @@ test.describe('Workbench Router', () => { // Close views navigated to 'test-view' route without hint. const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands(['test-view']); - await routerPage.enterHint('test-view'); - await routerPage.checkClose(true); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + hint: 'test-view', + close: true, + }); // Expect view.101 to be closed. await expectView(testView1).not.toBeAttached(); @@ -1201,12 +1177,12 @@ test.describe('Workbench Router', () => { const testView1 = new RouterPagePO(appPO, {viewId: 'view.101'}); - // Close views navigated to empty-path route and hint 'test-view'. + // Close views navigated to empty-path route with hint 'test-view'. const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands([]); - await routerPage.enterHint('test-view'); - await routerPage.checkClose(true); - await routerPage.clickNavigate(); + await routerPage.navigate([], { + hint: 'test-view', + close: true, + }); // Expect view.101 not to be closed. await expectView(testView1).toBeActive(); @@ -1297,10 +1273,10 @@ test.describe('Workbench Router', () => { // Open view in the main area. const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands([]); - await routerPage.enterHint('test-view'); - await routerPage.enterTarget('view.100'); - await routerPage.clickNavigate(); + await routerPage.navigate([], { + target: 'view.100', + hint: 'test-view', + }); await routerPage.view.tab.close(); // Expect the view to be opened in the main area. @@ -1332,9 +1308,9 @@ test.describe('Workbench Router', () => { // Navigate to path-based route. const routerPage = new RouterPagePO(appPO, {viewId: 'view.100'}); - await routerPage.enterCommands(['test-view']); - await routerPage.enterTarget('view.100'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'view.100', + }); const testeeViewPage = new ViewPagePO(appPO, {viewId: 'view.100'}); @@ -1359,10 +1335,10 @@ test.describe('Workbench Router', () => { // Navigate to empty-path route. const routerPage = new RouterPagePO(appPO, {viewId: 'view.100'}); - await routerPage.enterCommands([]); - await routerPage.enterHint('test-view'); - await routerPage.enterTarget('view.100'); - await routerPage.clickNavigate(); + await routerPage.navigate([], { + target: 'view.100', + hint: 'test-view', + }); const testeeViewPage = new ViewPagePO(appPO, {viewId: 'view.100'}); @@ -1387,10 +1363,10 @@ test.describe('Workbench Router', () => { // Navigate to empty-path route. const routerPage = new RouterPagePO(appPO, {viewId: 'view.100'}); - await routerPage.enterCommands([]); - await routerPage.enterHint('test-view'); - await routerPage.enterTarget('view.100'); - await routerPage.clickNavigate(); + await routerPage.navigate([], { + target: 'view.100', + hint: 'test-view', + }); const testeeViewPage = new ViewPagePO(appPO, {viewId: 'view.100'}); @@ -1415,9 +1391,9 @@ test.describe('Workbench Router', () => { // Navigate to path-based route. const routerPage = new RouterPagePO(appPO, {viewId: 'view.100'}); - await routerPage.enterCommands(['test-view']); - await routerPage.enterTarget('view.100'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'view.100', + }); const testeeViewPage = new ViewPagePO(appPO, {viewId: 'view.100'}); @@ -1436,10 +1412,9 @@ test.describe('Workbench Router', () => { // Open test-view with {path: 'test-view'} const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterHint(''); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + cssClass: 'testee', + }); const testeeViewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); @@ -1452,10 +1427,10 @@ test.describe('Workbench Router', () => { // Open test-view with {path: 'test-view', hint: 'test-view'} await routerPage.view.tab.click(); - await routerPage.enterPath('test-view'); - await routerPage.enterHint('test-view'); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + hint: 'test-view', + cssClass: 'testee', + }); await expect.poll(() => testeeViewPage.view.getInfo()).toMatchObject( { @@ -1466,10 +1441,10 @@ test.describe('Workbench Router', () => { // Open test-view with {path: '', hint: 'test-view'} await routerPage.view.tab.click(); - await routerPage.enterPath(''); - await routerPage.enterHint('test-view'); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate([], { + hint: 'test-view', + cssClass: 'testee', + }); await expect.poll(() => testeeViewPage.view.getInfo()).toMatchObject( { @@ -1483,11 +1458,7 @@ test.describe('Workbench Router', () => { // Open view without specifying path or hint. const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath(''); - await routerPage.enterHint(''); - - // Expect navigation to be rejected. - await expect(routerPage.clickNavigate()).rejects.toThrow(/\[NavigateError]/); + await expect(routerPage.navigate([])).rejects.toThrow(/\[NavigateError]/); }); test.describe('Navigate by alternativeViewId', () => { @@ -1507,15 +1478,15 @@ test.describe('Workbench Router', () => { const testeeViewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); // Open test view, assigning it an alternative view id - await routerPage.enterCommands(['test-pages/navigation-test-page/1']); - await routerPage.enterTarget('testee'); // alternative view id - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/1'], { + target: 'testee', // alternative view id + }); await expect.poll(() => testeeViewPage.view.getInfo()).toMatchObject({urlSegments: 'test-pages/navigation-test-page/1'} satisfies Partial); // Navigate the test view by its alternative view id - await routerPage.enterCommands(['test-pages/navigation-test-page/2']); - await routerPage.enterTarget('testee'); // alternative view id - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/2'], { + target: 'testee', // alternative view id + }); await expect.poll(() => testeeViewPage.view.getInfo()).toMatchObject({urlSegments: 'test-pages/navigation-test-page/2'} satisfies Partial); }); @@ -1541,10 +1512,10 @@ test.describe('Workbench Router', () => { await expect(appPO.views()).toHaveCount(3); // Close the view with alternative id 'testee-1'. - await routerPage.enterPath(''); - await routerPage.enterTarget('testee-1'); // alternative view id - await routerPage.checkClose(true); - await routerPage.clickNavigate(); + await routerPage.navigate([], { + target: 'testee-1', + close: true, + }); // Expect the view with alternative id 'testee-1' to be closed. await expect(appPO.views()).toHaveCount(2); @@ -1577,10 +1548,10 @@ test.describe('Workbench Router', () => { await expect(appPO.views()).toHaveCount(4); // Close the views with alternative id 'testee-1'. - await routerPage.enterPath(''); - await routerPage.enterTarget('testee-1'); - await routerPage.checkClose(true); - await routerPage.clickNavigate(); + await routerPage.navigate([], { + target: 'testee-1', + close: true, + }); // Expect the views with alterantive id 'testee-1' to be closed. await expect(appPO.views()).toHaveCount(2); diff --git a/projects/scion/e2e-testing/src/workbench/view-css-class.e2e-spec.ts b/projects/scion/e2e-testing/src/workbench/view-css-class.e2e-spec.ts index 08ad7ae42..9e80e134d 100644 --- a/projects/scion/e2e-testing/src/workbench/view-css-class.e2e-spec.ts +++ b/projects/scion/e2e-testing/src/workbench/view-css-class.e2e-spec.ts @@ -19,10 +19,10 @@ test.describe('Workbench View CSS Class', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('view.100'); - await routerPage.enterCssClass('testee-navigation'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'view.100', + cssClass: 'testee-navigation', + }); const viewPage = new ViewPagePO(appPO, {viewId: 'view.100'}); @@ -78,10 +78,11 @@ test.describe('Workbench View CSS Class', () => { // Navigate to 'test-pages/navigation-test-page/1' passing CSS class 'testee-navigation-1'. const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands(['test-pages/navigation-test-page/1']); - await routerPage.enterTarget('view.100'); - await routerPage.enterCssClass('testee-navigation-1'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/1'], { + target: 'view.100', + cssClass: 'testee-navigation-1', + }); + // Expect CSS classes of the navigation to be set. await expect.poll(() => viewPage.view.getCssClasses()).toContain('testee-navigation-1'); await expect.poll(() => viewPage.view.tab.getCssClasses()).toContain('testee-navigation-1'); @@ -93,10 +94,11 @@ test.describe('Workbench View CSS Class', () => { await expect.poll(() => viewPage.view.tab.getCssClasses()).toContain('e2e-navigation-test-page'); // Navigate to 'test-pages/navigation-test-page/2' passing CSS class 'testee-navigation-2'. - await routerPage.enterCommands(['test-pages/navigation-test-page/2']); - await routerPage.enterTarget('view.100'); - await routerPage.enterCssClass('testee-navigation-2'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/2'], { + target: 'view.100', + cssClass: 'testee-navigation-2', + }); + // Expect CSS classes of the navigation to be set. await expect.poll(() => viewPage.view.getCssClasses()).toContain('testee-navigation-2'); await expect.poll(() => viewPage.view.tab.getCssClasses()).toContain('testee-navigation-2'); @@ -111,10 +113,11 @@ test.describe('Workbench View CSS Class', () => { await expect.poll(() => viewPage.view.tab.getCssClasses()).toContain('e2e-navigation-test-page'); // Navigate to 'test-pages/navigation-test-page/2' passing CSS class 'testee-navigation-3'. - await routerPage.enterCommands(['test-pages/navigation-test-page/2']); - await routerPage.enterTarget('view.100'); - await routerPage.enterCssClass('testee-navigation-3'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/2'], { + target: 'view.100', + cssClass: 'testee-navigation-3', + }); + // Expect CSS classes of the navigation to be set. await expect.poll(() => viewPage.view.getCssClasses()).toContain('testee-navigation-3'); await expect.poll(() => viewPage.view.tab.getCssClasses()).toContain('testee-navigation-3'); @@ -131,9 +134,10 @@ test.describe('Workbench View CSS Class', () => { await expect.poll(() => viewPage.view.tab.getCssClasses()).toContain('e2e-navigation-test-page'); // Navigate to 'test-pages/navigation-test-page/1' without passing CSS class. - await routerPage.enterCommands(['test-pages/navigation-test-page/1']); - await routerPage.enterTarget('view.100'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page/1'], { + target: 'view.100', + }); + // Expect CSS classes of the previous navigations not to be set. await expect.poll(() => viewPage.view.getCssClasses()).not.toContain('testee-navigation-1'); await expect.poll(() => viewPage.view.getCssClasses()).not.toContain('testee-navigation-2'); @@ -224,10 +228,10 @@ test.describe('Workbench View CSS Class', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands(['test-view']); - await routerPage.enterTarget('view.100'); - await routerPage.enterCssClass('testee-navigation'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'view.100', + cssClass: 'testee-navigation', + }); const viewPage = new ViewPagePO(appPO, {viewId: 'view.100'}); await viewPage.view.tab.dragTo({partId: await viewPage.view.part.getPartId(), region: 'east'}); @@ -241,10 +245,10 @@ test.describe('Workbench View CSS Class', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands(['test-view']); - await routerPage.enterTarget('view.100'); - await routerPage.enterCssClass('testee-navigation'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'view.100', + cssClass: 'testee-navigation', + }); const viewPage = new ViewPagePO(appPO, {viewId: 'view.100'}); @@ -262,18 +266,18 @@ test.describe('Workbench View CSS Class', () => { // Open view 1 const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands(['test-view']); - await routerPage.enterTarget('view.101'); - await routerPage.enterCssClass('testee-navigation-1'); - await routerPage.checkActivate(false); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'view.101', + activate: false, + cssClass: 'testee-navigation-1', + }); // Open view 2 - await routerPage.enterCommands(['test-view']); - await routerPage.enterTarget('view.102'); - await routerPage.enterCssClass('testee-navigation-2'); - await routerPage.checkActivate(false); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'view.102', + activate: false, + cssClass: 'testee-navigation-2', + }); const viewPage1 = new ViewPagePO(appPO, {viewId: 'view.101'}); const viewPage2 = new ViewPagePO(appPO, {viewId: 'view.102'}); @@ -295,10 +299,10 @@ test.describe('Workbench View CSS Class', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands(['test-view']); - await routerPage.enterTarget('view.100'); - await routerPage.enterCssClass('testee-navigation'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'view.100', + cssClass: 'testee-navigation', + }); const viewPage = new ViewPagePO(appPO, {viewId: 'view.100'}); @@ -318,17 +322,17 @@ test.describe('Workbench View CSS Class', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('view.101'); - await routerPage.enterCssClass('testee-1'); - await routerPage.checkActivate(false); - await routerPage.clickNavigate(); - - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('view.102'); - await routerPage.enterCssClass('testee-2'); - await routerPage.checkActivate(false); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'view.101', + activate: false, + cssClass: 'testee-1', + }); + + await routerPage.navigate(['test-view'], { + target: 'view.102', + activate: false, + cssClass: 'testee-2', + }); const viewPage1 = new ViewPagePO(appPO, {viewId: 'view.101'}); const viewPage2 = new ViewPagePO(appPO, {viewId: 'view.102'}); @@ -348,11 +352,11 @@ test.describe('Workbench View CSS Class', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterTarget('view.100'); - await routerPage.enterPath('test-view'); - await routerPage.enterCssClass('testee'); - await routerPage.checkActivate(false); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'view.100', + activate: false, + cssClass: 'testee', + }); const viewPage = new ViewPagePO(appPO, {viewId: 'view.100'}); await expect.poll(() => viewPage.view.tab.getCssClasses()).toContain('testee'); diff --git a/projects/scion/e2e-testing/src/workbench/view-route-data.e2e-spec.ts b/projects/scion/e2e-testing/src/workbench/view-route-data.e2e-spec.ts index 793a9fb99..86395e24c 100644 --- a/projects/scion/e2e-testing/src/workbench/view-route-data.e2e-spec.ts +++ b/projects/scion/e2e-testing/src/workbench/view-route-data.e2e-spec.ts @@ -26,10 +26,10 @@ test.describe('View Route Data', () => { await appPO.setDesignToken('--sci-workbench-tab-height', '3.5rem'); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath(`${basePath}/feature-a`); - await routerPage.enterTarget('blank'); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate([`${basePath}/feature-a`], { + target: 'blank', + cssClass: 'testee' + }); const view = appPO.view({cssClass: 'testee'}); await expect(view.tab.title).toHaveText('Features Title'); @@ -42,10 +42,10 @@ test.describe('View Route Data', () => { await appPO.setDesignToken('--sci-workbench-tab-height', '3.5rem'); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath(`${basePath}/feature-b`); - await routerPage.enterTarget('blank'); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate([`${basePath}/feature-b`], { + target: 'blank', + cssClass: 'testee', + }); const view = appPO.view({cssClass: 'testee'}); await expect(view.tab.title).toHaveText('Feature B Title'); @@ -59,10 +59,10 @@ test.describe('View Route Data', () => { await appPO.setDesignToken('--sci-workbench-tab-height', '3.5rem'); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath(`${basePath}/feature-c`); - await routerPage.enterTarget('blank'); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate([`${basePath}/feature-c`], { + target: 'blank', + cssClass: 'testee', + }); const view = appPO.view({cssClass: 'testee'}); await expect(view.tab.title).toHaveText('Features Title'); @@ -75,10 +75,10 @@ test.describe('View Route Data', () => { await appPO.setDesignToken('--sci-workbench-tab-height', '3.5rem'); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath(`${basePath}/feature-d`); - await routerPage.enterTarget('blank'); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate([`${basePath}/feature-d`], { + target: 'blank', + cssClass: 'testee', + }); const view = appPO.view({cssClass: 'testee'}); await expect(view.tab.title).toHaveText('Feature D Title'); @@ -97,10 +97,10 @@ test.describe('View Route Data', () => { await appPO.setDesignToken('--sci-workbench-tab-height', '3.5rem'); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath(`${basePath}/feature-a`); - await routerPage.enterTarget('blank'); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate([`${basePath}/feature-a`], { + target: 'blank', + cssClass: 'testee', + }); const view = appPO.view({cssClass: 'testee'}); await expect(view.tab.title).toHaveText('Features Lazy Title'); @@ -113,10 +113,10 @@ test.describe('View Route Data', () => { await appPO.setDesignToken('--sci-workbench-tab-height', '3.5rem'); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath(`${basePath}/feature-b`); - await routerPage.enterTarget('blank'); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate([`${basePath}/feature-b`], { + target: 'blank', + cssClass: 'testee', + }); const view = appPO.view({cssClass: 'testee'}); await expect(view.tab.title).toHaveText('Feature B Title'); @@ -130,10 +130,10 @@ test.describe('View Route Data', () => { await appPO.setDesignToken('--sci-workbench-tab-height', '3.5rem'); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath(`${basePath}/feature-c`); - await routerPage.enterTarget('blank'); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate([`${basePath}/feature-c`], { + target: 'blank', + cssClass: 'testee', + }); const view = appPO.view({cssClass: 'testee'}); await expect(view.tab.title).toHaveText('Features Lazy Title'); @@ -146,10 +146,10 @@ test.describe('View Route Data', () => { await appPO.setDesignToken('--sci-workbench-tab-height', '3.5rem'); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath(`${basePath}/feature-d`); - await routerPage.enterTarget('blank'); - await routerPage.enterCssClass('testee'); - await routerPage.clickNavigate(); + await routerPage.navigate([`${basePath}/feature-d`], { + target: 'blank', + cssClass: 'testee', + }); const view = appPO.view({cssClass: 'testee'}); await expect(view.tab.title).toHaveText('Feature D Title'); diff --git a/projects/scion/e2e-testing/src/workbench/view-tab-bar.e2e-spec.ts b/projects/scion/e2e-testing/src/workbench/view-tab-bar.e2e-spec.ts index fc77743ef..bf03d367d 100644 --- a/projects/scion/e2e-testing/src/workbench/view-tab-bar.e2e-spec.ts +++ b/projects/scion/e2e-testing/src/workbench/view-tab-bar.e2e-spec.ts @@ -23,10 +23,10 @@ test.describe('View Tabbar', () => { const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); // open view-1 - await routerPage.enterPath('test-view'); - await routerPage.enterCssClass('testee-1'); - await routerPage.enterTarget('blank'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + cssClass: 'testee-1', + }); const testee1ViewPage = new ViewPagePO(appPO, {cssClass: 'testee-1'}); @@ -36,10 +36,10 @@ test.describe('View Tabbar', () => { // open view-2 await routerPage.view.tab.click(); - await routerPage.enterPath('test-view'); - await routerPage.enterCssClass('testee-2'); - await routerPage.enterTarget('blank'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + cssClass: 'testee-2', + }); const testee2ViewPage = new ViewPagePO(appPO, {cssClass: 'testee-2'}); @@ -50,10 +50,10 @@ test.describe('View Tabbar', () => { // open view-3 await routerPage.view.tab.click(); - await routerPage.enterPath('test-view'); - await routerPage.enterCssClass('testee-3'); - await routerPage.enterTarget('blank'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + cssClass: 'testee-3', + }); const testee3ViewPage = new ViewPagePO(appPO, {cssClass: 'testee-3'}); @@ -116,9 +116,9 @@ test.describe('View Tabbar', () => { // Open view in the active part (left part). const routerPage = new RouterPagePO(appPO, {viewId: 'view.2'}); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('blank'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + }); // Expect view.7 (new view) to be opened to the right of the active view. await expect(appPO.workbench).toEqualWorkbenchLayout({ @@ -143,10 +143,10 @@ test.describe('View Tabbar', () => { // Open view in the right part. await routerPage.view.tab.click(); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('blank'); - await routerPage.enterBlankPartId('right'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + blankPartId: 'right', + }); // Expect view.8 (new view) to be opened to the right of the active view. await expect(appPO.workbench).toEqualWorkbenchLayout({ @@ -302,10 +302,10 @@ test.describe('View Tabbar', () => { const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); // open view.2 - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('blank'); - await routerPage.enterInsertionIndex('end'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + blankInsertionIndex: 'end', + }); const testee2ViewPage = new ViewPagePO(appPO, {viewId: 'view.2'}); @@ -315,10 +315,10 @@ test.describe('View Tabbar', () => { // open view.3 await routerPage.view.tab.click(); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('blank'); - await routerPage.enterInsertionIndex('end'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + blankInsertionIndex: 'end', + }); const testee3ViewPage = new ViewPagePO(appPO, {viewId: 'view.3'}); @@ -329,10 +329,10 @@ test.describe('View Tabbar', () => { // open view.4 await routerPage.view.tab.click(); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('blank'); - await routerPage.enterInsertionIndex('end'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + blankInsertionIndex: 'end', + }); const testee4ViewPage = new ViewPagePO(appPO, {viewId: 'view.4'}); @@ -348,10 +348,10 @@ test.describe('View Tabbar', () => { const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); // open view.2 - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('blank'); - await routerPage.enterInsertionIndex('start'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + blankInsertionIndex: 'start', + }); const testee2ViewPage = new ViewPagePO(appPO, {viewId: 'view.2'}); @@ -361,10 +361,10 @@ test.describe('View Tabbar', () => { // open view.3 await routerPage.view.tab.click(); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('blank'); - await routerPage.enterInsertionIndex('start'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + blankInsertionIndex: 'start', + }); const testee3ViewPage = new ViewPagePO(appPO, {viewId: 'view.3'}); @@ -375,10 +375,10 @@ test.describe('View Tabbar', () => { // open view.4 await routerPage.view.tab.click(); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('blank'); - await routerPage.enterInsertionIndex('start'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + blankInsertionIndex: 'start', + }); const testee4ViewPage = new ViewPagePO(appPO, {viewId: 'view.4'}); @@ -394,10 +394,10 @@ test.describe('View Tabbar', () => { const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); // open view.2 - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('blank'); - await routerPage.enterInsertionIndex(1); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + blankInsertionIndex: 1, + }); const testee2ViewPage = new ViewPagePO(appPO, {viewId: 'view.2'}); @@ -407,10 +407,10 @@ test.describe('View Tabbar', () => { // open view.3 await routerPage.view.tab.click(); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('blank'); - await routerPage.enterInsertionIndex(1); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + blankInsertionIndex: 1, + }); const testee3ViewPage = new ViewPagePO(appPO, {viewId: 'view.3'}); @@ -421,10 +421,10 @@ test.describe('View Tabbar', () => { // open view.4 await routerPage.view.tab.click(); - await routerPage.enterPath('test-view'); - await routerPage.enterTarget('blank'); - await routerPage.enterInsertionIndex(1); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view'], { + target: 'blank', + blankInsertionIndex: 1, + }); const testee4ViewPage = new ViewPagePO(appPO, {viewId: 'view.4'}); diff --git a/projects/scion/e2e-testing/src/workbench/view.e2e-spec.ts b/projects/scion/e2e-testing/src/workbench/view.e2e-spec.ts index bfc243b00..4fdf5eef9 100644 --- a/projects/scion/e2e-testing/src/workbench/view.e2e-spec.ts +++ b/projects/scion/e2e-testing/src/workbench/view.e2e-spec.ts @@ -21,14 +21,14 @@ test.describe('Workbench View', () => { await appPO.navigateTo({microfrontendSupport: false}); const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterPath('/test-view'); - await routerPage.enterCssClass('testee'); - await routerPage.enterTarget('view.99'); - await routerPage.clickNavigate(); + await routerPage.navigate(['/test-view'], { + target: 'view.100', + cssClass: 'testee', + }); const viewPage = new ViewPagePO(appPO, {cssClass: 'testee'}); - await expect(viewPage.viewId).toHaveText('view.99'); + await expect(viewPage.viewId).toHaveText('view.100'); }); test('should allow updating the view tab title', async ({appPO, workbenchNavigator}) => { @@ -47,15 +47,15 @@ test.describe('Workbench View', () => { // open test view 1 const routerPage = await workbenchNavigator.openInNewTab(RouterPagePO); - await routerPage.enterCommands(['test-pages/navigation-test-page', {title: 'view-1-title'}]); - await routerPage.enterTarget('view.101'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page', {title: 'view-1-title'}], { + target: 'view.101', + }); // open test view 2 await routerPage.view.tab.click(); - await routerPage.enterCommands(['test-pages/navigation-test-page', {title: 'view-2-title'}]); - await routerPage.enterTarget('view.102'); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-pages/navigation-test-page', {title: 'view-2-title'}], { + target: 'view.102', + }); const testee1ViewPage = new NavigationTestPagePO(appPO, {viewId: 'view.101'}); const testee2ViewPage = new NavigationTestPagePO(appPO, {viewId: 'view.102'}); @@ -138,9 +138,9 @@ test.describe('Workbench View', () => { // Navigate to a different route in the same view await routerPage.view.tab.click(); - await routerPage.enterPath('test-router'); - await routerPage.enterTarget(viewId); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-router'], { + target: viewId, + }); // Expect the view to be pristine const testeeView = appPO.view({viewId}); @@ -158,9 +158,9 @@ test.describe('Workbench View', () => { // Update matrix params (does not affect routing) await routerPage.view.tab.click(); - await routerPage.enterCommands(['test-view', {matrixParam: 'value'}]); - await routerPage.enterTarget(await viewPage.view.getViewId()); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view', {matrixParam: 'value'}], { + target: await viewPage.view.getViewId(), + }); // Expect the view to still be dirty await expect.poll(() => viewPage.view.tab.isDirty()).toBe(true); @@ -181,9 +181,9 @@ test.describe('Workbench View', () => { // Update matrix params (does not affect routing) await routerPage.view.tab.click(); - await routerPage.enterCommands(['test-view', {matrixParam: 'value'}]); - await routerPage.enterTarget(await viewPage.view.getViewId()); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view', {matrixParam: 'value'}], { + target: await viewPage.view.getViewId(), + }); // Expect the title has not changed await expect(viewPage.view.tab.title).toHaveText('TITLE'); @@ -205,8 +205,7 @@ test.describe('Workbench View', () => { // Update matrix params (does not affect routing) await routerPage.view.tab.click(); - await routerPage.enterCommands(['test-view', {matrixParam: 'value'}]); - await routerPage.clickNavigate(); + await routerPage.navigate(['test-view', {matrixParam: 'value'}]); // Expect the heading has not changed await expect(viewPage.view.tab.heading).toHaveText('HEADING'); diff --git a/projects/scion/workbench/src/lib/view/view.component.spec.ts b/projects/scion/workbench/src/lib/view/view.component.spec.ts index 5ff894308..a73f82de6 100644 --- a/projects/scion/workbench/src/lib/view/view.component.spec.ts +++ b/projects/scion/workbench/src/lib/view/view.component.spec.ts @@ -304,7 +304,7 @@ describe('ViewComponent', () => { expect(getViewDebugElement('view.1').component.destroyed).withContext('(H)').toBeFalse(); // Switch to View 1 - TestBed.inject(WorkbenchRouter).navigate(['view-1'], {activate: true}).then(); + TestBed.inject(WorkbenchRouter).navigate(['view-1']).then(); advance(fixture); view1DebugElement.component.checked = false; @@ -320,7 +320,7 @@ describe('ViewComponent', () => { expect(getViewDebugElement('view.2').component.destroyed).withContext('(N)').toBeFalse(); // Switch to View 2 - TestBed.inject(WorkbenchRouter).navigate(['view-2'], {activate: true}).then(); + TestBed.inject(WorkbenchRouter).navigate(['view-2']).then(); advance(fixture); view1DebugElement.component.checked = false; @@ -356,7 +356,7 @@ describe('ViewComponent', () => { expect(view2DebugElement.component.activated).withContext('(F)').toBeTrue(); // Switch to View 1 - TestBed.inject(WorkbenchRouter).navigate(['view-1'], {activate: true}).then(); + TestBed.inject(WorkbenchRouter).navigate(['view-1']).then(); advance(fixture); expect(view1DebugElement.view.active).withContext('(G)').toBeTrue(); @@ -365,7 +365,7 @@ describe('ViewComponent', () => { expect(view2DebugElement.component.activated).withContext('(J)').toBeFalse(); // Switch to View 2 - TestBed.inject(WorkbenchRouter).navigate(['view-2'], {activate: true}).then(); + TestBed.inject(WorkbenchRouter).navigate(['view-2']).then(); advance(fixture); expect(view1DebugElement.view.active).withContext('(K)').toBeFalse();