Skip to content

Commit

Permalink
test(workbench/router): refactor router page object to reflect the Wo…
Browse files Browse the repository at this point in the history
…rkbench 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
  • Loading branch information
Marcarrian authored and danielwiehl committed May 6, 2024
1 parent 218794d commit 43c45ac
Show file tree
Hide file tree
Showing 17 changed files with 806 additions and 812 deletions.
104 changes: 54 additions & 50 deletions projects/scion/e2e-testing/src/workbench/browser-history.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'});
Expand Down Expand Up @@ -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'});
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand Down
48 changes: 24 additions & 24 deletions projects/scion/e2e-testing/src/workbench/browser-reload.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand Down
16 changes: 8 additions & 8 deletions projects/scion/e2e-testing/src/workbench/dialog.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'});
Expand Down Expand Up @@ -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'});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading

0 comments on commit 43c45ac

Please sign in to comment.