Skip to content

Commit

Permalink
alternative part id
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcarrian committed Dec 16, 2024
1 parent 198ac0a commit b7100ac
Show file tree
Hide file tree
Showing 69 changed files with 2,482 additions and 2,319 deletions.
2 changes: 1 addition & 1 deletion projects/scion/e2e-testing/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default {
ignoreDefaultArgs: ['--hide-scrollbars'],
},
},
maxFailures: runInCI ? 1 : undefined,
maxFailures: undefined,
testMatch: /.*\.e2e-spec\.js/,
} satisfies PlaywrightTestConfig;

Expand Down
3 changes: 2 additions & 1 deletion projects/scion/e2e-testing/src/app.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {NotificationPO} from './notification.po';
import {AppHeaderPO} from './app-header.po';
import {DialogPO} from './dialog.po';
import {ViewId} from '@scion/workbench';
import {PartId} from '../../workbench/src/lib/part/ɵworkbench-part.model';

export class AppPO {

Expand Down Expand Up @@ -149,7 +150,7 @@ export class AppPO {
* @param locateBy - Specifies how to locate the part.
* @param locateBy.partId - Identifies the part by its id
*/
public part(locateBy: {partId: string}): PartPO {
public part(locateBy: {partId: PartId}): PartPO {
return new PartPO(this.page.locator(`wb-part[data-partid="${locateBy.partId}"]`));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {ExpectationResult} from './custom-matchers.definition';
import {MAIN_AREA} from '../workbench.model';
import {retryOnError} from '../helper/testing.util';
import {ViewId} from '@scion/workbench';
import {PartId} from '../../../workbench/src/lib/part/ɵworkbench-part.model';

/**
* Provides the implementation of {@link CustomMatchers#toEqualWorkbenchLayout}.
Expand Down Expand Up @@ -331,7 +332,7 @@ interface BoundingBox {
*/
export interface MPartGrid {
root: MTreeNode | MPart;
activePartId?: string;
activePartId?: PartId;
}

/**
Expand All @@ -356,7 +357,8 @@ export class MTreeNode {
export class MPart {

public readonly type = 'MPart';
public readonly id?: string;
public readonly id?: PartId;
public readonly alternativeId?: string;
public views?: MView[];
public activeViewId?: ViewId;

Expand Down
5 changes: 3 additions & 2 deletions projects/scion/e2e-testing/src/part.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {ViewPO} from './view.po';
import {ViewTabPO} from './view-tab.po';
import {PartSashPO} from './part-sash.po';
import {PartBarPO} from './part-bar.po';
import {PartId} from '../../workbench/src/lib/part/ɵworkbench-part.model';

/**
* Handle for interacting with a workbench part.
Expand Down Expand Up @@ -40,8 +41,8 @@ export class PartPO {
this.sash = new PartSashPO(this._locator);
}

public async getPartId(): Promise<string> {
return (await this._locator.getAttribute('data-partid'))!;
public async getPartId(): Promise<PartId> {
return (await this._locator.getAttribute('data-partid'))! as PartId;
}

/**
Expand Down
5 changes: 3 additions & 2 deletions projects/scion/e2e-testing/src/start-page.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {SciTabbarPO} from './@scion/components.internal/tabbar.po';
import {SciRouterOutletPO} from './workbench-client/page-object/sci-router-outlet.po';
import {WorkbenchViewPagePO} from './workbench/page-object/workbench-view-page.po';
import {ViewId} from '@scion/workbench';
import {PartId} from '../../workbench/src/lib/part/ɵworkbench-part.model';

/**
* Page object to interact with {@link StartPageComponent}.
Expand Down Expand Up @@ -51,8 +52,8 @@ export class StartPagePO implements WorkbenchViewPagePO {
/**
* Returns the part in which this page is displayed.
*/
public getPartId(): Promise<string | null> {
return this.locator.getAttribute('data-partid');
public async getPartId(): Promise<PartId | null> {
return (await this.locator.getAttribute('data-partid')) as PartId | null;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion projects/scion/e2e-testing/src/view-drag-handle.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import {DomRect, fromRect} from './helper/testing.util';
import {Locator, Mouse, Page} from '@playwright/test';
import {PartId} from '../../workbench/src/lib/part/ɵworkbench-part.model';

/**
* Reference to the drag handle of a view to control drag and drop.
Expand Down Expand Up @@ -49,7 +50,7 @@ export class ViewDrageHandlePO {
/**
* Drags this tab to the specified region in the specified part.
*/
public async dragToPart(partId: string, options: {region: 'north' | 'east' | 'south' | 'west' | 'center'; steps?: number}): Promise<void> {
public async dragToPart(partId: PartId, options: {region: 'north' | 'east' | 'south' | 'west' | 'center'; steps?: number}): Promise<void> {
const steps = options.steps ?? 100;

// 1. Activate drop zones by dragging the drag handle over the part.
Expand Down
3 changes: 2 additions & 1 deletion projects/scion/e2e-testing/src/view-tab.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {AppPO} from './app.po';
import {ViewId} from '@scion/workbench';
import {ViewInfo, ViewInfoDialogPO} from './workbench/page-object/view-info-dialog.po';
import {ViewDrageHandlePO} from './view-drag-handle.po';
import {PartId} from '../../workbench/src/lib/part/ɵworkbench-part.model';

/**
* Handle for interacting with a workbench view tab.
Expand Down Expand Up @@ -129,7 +130,7 @@ export class ViewTabPO {
* moves the view programmatically. Use this method to move a view to another window as not supported
* by Playwright.
*/
public async moveTo(partId: string, options?: {region?: 'north' | 'south' | 'west' | 'east'; workbenchId?: string}): Promise<void> {
public async moveTo(partId: PartId, options?: {region?: 'north' | 'south' | 'west' | 'east'; workbenchId?: string}): Promise<void> {
await this.click();

const contextMenu = await this.openContextMenu();
Expand Down
Loading

0 comments on commit b7100ac

Please sign in to comment.