mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
* [AAE-7160] Setup Playwright in ADF - Storybook testing * New test cases for groups component. Reorganize the files * Add to package.json scripts - npm run playwright * Change amount of workers * Change workesr to 2
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
/*
|
|
* Copyright © 2005 - 2021 Alfresco Software, Ltd. All rights reserved.
|
|
*
|
|
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
|
* pursuant to a written agreement and any use of this program without such an
|
|
* agreement is prohibited.
|
|
*/
|
|
|
|
import { Locator, Page } from '@playwright/test';
|
|
import { PlaywrightBase } from '../playwright-base';
|
|
|
|
export abstract class BaseComponent extends PlaywrightBase {
|
|
private rootElement: string;
|
|
|
|
constructor(page: Page,rootElement: string) {
|
|
super(page);
|
|
this.rootElement = rootElement;
|
|
}
|
|
|
|
/**
|
|
* Method which should be used across the repository, while creating
|
|
* reference to elements, which are in root element of component.
|
|
* @param cssLocator css selector as String. Need to be in the tree under the root element
|
|
* @param options if you want to localize it by text, then provide an optional hasText
|
|
* @returns Locator object
|
|
*/
|
|
getChild(cssLocator: string, options?: { hasText: string | RegExp }): Locator {
|
|
return this.page.locator(`${this.rootElement} ${cssLocator}`, options);
|
|
}
|
|
|
|
}
|