This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ./objects/pages/dashboard-page.ts | |
import { BankAccountObject } from '../features'; | |
import { NavigationObject } from '../ui-components'; | |
import { PageObjectBase } from '../base'; | |
class DashboardPageObject extends PageObjectBase { | |
element = 'dashboard-page'; | |
features = [new BankAccountObject(), new NavigationObject()]; | |
url: string = '/dashboard'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ./objects/base/component-object-base.ts | |
export abstract class ComponentObjectBase { | |
componentName: string; | |
element: string; | |
elementToRender: string; | |
render = async () => { | |
if (!this.element || !this.elementToRender) { | |
throw new Error('please define an element and elementToRender to check if the feature was rendered'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ./objects/base/page-object-base.ts | |
export interface IComponentObject { | |
[key: string]: any; | |
isRendered(): Promise<any>; | |
} | |
export abstract class PageObjectBase { | |
element: string; | |
features: IComponentObject[]; | |
url: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ./spec/dashboard-page.spec.ts | |
import { dashboardPage } from '../objects/pages/'; | |
describe('Dashboard page', () => { | |
it('should render all features', async () => { | |
await browser.url(dashboardPage.url); | |
const isRendered = await dashboardPage.waitUntilRendered(); | |
// at this point, the page is rendered and we can safely kick off all our tests | |
expect(isRendered).toBe(true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ./objects/pages/dashboard-page.ts | |
import { BankAccountObject } from '../objects/features'; | |
import { NavigationObject } from '../objects/ui-components'; | |
export class DashboardPageObject { | |
// the root element for the page <dashboard-page /> | |
element = 'dashboard-page'; | |
// all registered features and UI components | |
features = [ | |
new BankAccountObject(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ./objects/base/component-object-base.ts | |
export interface IComponentObjectConfig { | |
featureName?: string; | |
visibleOnMobile: boolean; | |
visibleOnDesktop: boolean; | |
} | |
export abstract class ComponentObjectBase { | |
componentName: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ./objects/base/page-object-base.ts | |
export interface IComponentObject { | |
[key: string]: any; | |
isRendered(): Promise<any>; | |
} | |
export abstract class PageObjectBase { | |
// the root element for the page, for example: dashboard-page | |
element: string; | |
// all registered features and UI components (instances of Component Object) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Potential fix for https://github.com/ionic-team/stencil/issues/1948 (Components without shadowdom are rendering twice when dynamically added to the DOM) | |
// copied code from https://github.com/angular/angular.js/blob/master/src/ng/directive/ngIf.js#L3 and https://github.com/angular/angular.js/blob/add78e62004e80bb1e16ab2dfe224afa8e513bc3/src/Angular.js#L2015 | |
angular | |
.module('demo', []) | |
.directive('ngIf', function ($animate, $compile) { | |
function getBlockNodes(nodes) { | |
var node = nodes[0]; | |
var endNode = nodes[nodes.length - 1]; | |
var blockNodes; |
NewerOlder