Skip to content

Commit

Permalink
[AAE-7160] Setup Playwright in ADF - Storybook testing (#7537)
Browse files Browse the repository at this point in the history
* [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
  • Loading branch information
MichalFidor committed Mar 7, 2022
1 parent 25eaf9d commit a0c7631
Show file tree
Hide file tree
Showing 24 changed files with 1,788 additions and 127 deletions.
15 changes: 15 additions & 0 deletions .travis.yml
Expand Up @@ -37,6 +37,10 @@ env:
- IDENTITY_ADMIN_EMAIL=$E2E_ADMIN_EMAIL_IDENTITY
- IDENTITY_ADMIN_PASSWORD=$E2E_ADMIN_PASSWORD_IDENTITY
- URL_HOST_ADF="http://localhost:4200"
#PLAYWRIGHT VARIABLES
- PLAYWRIGHT_WORKERS=2
- PLAYWRIGHT_STORYBOOK_E2E_HOST=http://localhost
- PLAYWRIGHT_STORYBOOK_E2E_PORT=4400

branches:
only:
Expand All @@ -61,6 +65,8 @@ stages:
if: type = pull_request || (type = cron || type = api)
- name: "e2e Test"
if: type = pull_request || (type = cron || type = api)
- name: "Storybook Playwright Tests"
if: type = pull_request || (type = cron || type = api)
- name: "Release tag"
if: branch = master
- name: "Deprecate develop builds"
Expand Down Expand Up @@ -168,6 +174,15 @@ jobs:
- ADF_VERSION=$(npm view @alfresco/adf-core@${TAG_NPM} version)
- ./scripts/travis/release/deprecate-develop-build.sh -v ${ADF_VERSION}

- stage: "Storybook Playwright Tests"
name: "Process Cloud"
before_script: ./scripts/ci/jobs/dbpci-before-playwright
script: ./scripts/travis/storybook-testing/storybook-test.sh
workspaces:
use:
- built_libs_cache
- built_demo_shell_cache

- stage: "e2e Test"
name: "Core"
before_script:
Expand Down
224 changes: 112 additions & 112 deletions cspell.json
Expand Up @@ -3,136 +3,136 @@
"language": "en",
"words": [
"activiti",
"CSRF",
"glyphicon",
"sharedlinks",
"fullscreen",
"sidenav",
"truthy",
"cryptodoc",
"mysites",
"afts",
"classlist",
"folderlink",
"filelink",
"datatable",
"repo",
"snackbar",
"promisify",
"xdescribe",
"unfavorite",
"devtools",
"gitter",
"jira",
"markdownlint",
"uploader",
"nginx",
"docx",
"SOLR",
"unshare",
"validators",
"pdfjs",
"exif",
"cardview",
"webm",
"keycodes",
"adhoc",
"swimlanes",
"datepicker",
"waypoints",
"waypoint",
"hotfix",
"typeahead",
"gridster",
"Collapsable",
"rowspan",
"typeahead",
"tabindex",
"afts",
"Arial",
"swsdp",
"Datetimepicker",
"mimetype",
"multiselect",
"arrowup",
"arrowdown",
"dialpad",
"backend",
"Unclaim",
"transclusion",
"transcluded",
"arrowup",
"auditable",
"taggable",
"datarow",
"datacolumn",
"textitem",
"boolitem",
"mapitem",
"selectitem",
"keyvaluepairsitem",
"boolitem",
"baseitem",
"checkboxes",
"tasklist",
"dateitem",
"webscript",
"minlength",
"doclib",
"fullname",
"firstname",
"lastname",
"userinfo",
"qshare",
"imgpreview",
"AUTHTYPE",
"ECMHOST",
"backend",
"baseitem",
"BASESHAREURL",
"booleanvisibility",
"booleanvisibilityprocess",
"boolitem",
"BPMHOST",
"OAUTHCONFIG",
"cardview",
"checkboxes",
"classlist",
"Collapsable",
"CONTEXTROOTBPM",
"CONTEXTROOTECM",
"cryptodoc",
"CSRF",
"datacolumn",
"datarow",
"datatable",
"dateitem",
"datepicker",
"datetimeitem",
"Datetimepicker",
"dbpci",
"DDTHH",
"devops",
"devtools",
"dialpad",
"DISABLECSRF",
"printf",
"mincount",
"listgrid",
"filesize",
"Theming",
"quicktime",
"Promise",
"Examinate",
"highlightable",
"doclib",
"docx",
"dropdownrestprocess",
"Droppable",
"UPDATEPERMISSIONS",
"Whitespaces",
"keyvaluepairs",
"datetimeitem",
"ECMBPM",
"ECMHOST",
"Examinate",
"exif",
"filedata",
"filelink",
"filesize",
"firstname",
"floatitem",
"folderlink",
"formtotestvalidations",
"fullname",
"fullscreen",
"gitter",
"glyphicon",
"gridster",
"hardend",
"highlightable",
"hotfix",
"imgpreview",
"intitem",
"DDTHH",
"jira",
"jsons",
"keycodes",
"keyvaluepairs",
"keyvaluepairsitem",
"lastname",
"listgrid",
"mapitem",
"markdownlint",
"mimetype",
"mincount",
"minlength",
"minmax",
"jsons",
"Inplace",
"MLTEXT",
"penta",
"BASESHAREURL",
"hardend",
"filedata",
"uncheck",
"subfolders",
"ECMBPM",
"processwithvariables",
"dropdownrestprocess",
"devops",
"mouseenter",
"starteventform",
"formtotestvalidations",
"requirednumbervisibility",
"multiselect",
"mysites",
"nginx",
"numbervisibilityprocess",
"booleanvisibilityprocess",
"booleanvisibility",
"OAUTHCONFIG",
"pdfjs",
"penta",
"printf",
"processparent",
"uploadfileform",
"processwithstarteventform",
"processstring",
"processwithstarteventform",
"processwithvariables",
"Promise",
"promisify",
"qshare",
"quicktime",
"repo",
"requirednumbervisibility",
"rowspan",
"selectitem",
"sharedlinks",
"sidenav",
"snackbar",
"SOLR",
"starteventform",
"subfolders",
"swimlanes",
"swsdp",
"tabindex",
"taggable",
"tasklist",
"textitem",
"Theming",
"transcluded",
"transclusion",
"truthy",
"typeahead",
"typeahed",
"minmax",
"jsons",
"Inplace"
"uncheck",
"Unclaim",
"unfavorite",
"unshare",
"UPDATEPERMISSIONS",
"uploader",
"uploadfileform",
"userinfo",
"validators",
"waypoint",
"waypoints",
"webm",
"webscript",
"Whitespaces",
"xdescribe"
],
"dictionaries": [
"html",
Expand Down
11 changes: 11 additions & 0 deletions e2e-playwright/models/component-titles.model.ts
@@ -0,0 +1,11 @@
/*
* 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.
*/

export enum ComponentTitles {
processServicesCloud = 'process-services-cloud',
}
31 changes: 31 additions & 0 deletions e2e-playwright/page-object/components/base.component.ts
@@ -0,0 +1,31 @@
/*
* 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);
}

}
19 changes: 19 additions & 0 deletions e2e-playwright/page-object/components/basic/error.component.ts
@@ -0,0 +1,19 @@
/*
* 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 { Page } from '@playwright/test';
import { BaseComponent } from '../base.component';

export class ErrorComponent extends BaseComponent {
private static rootElement = 'mat-error';
public content = this.getChild('');

constructor(page: Page) {
super(page, ErrorComponent.rootElement);
}
}
11 changes: 11 additions & 0 deletions e2e-playwright/page-object/components/basic/index.ts
@@ -0,0 +1,11 @@
/*
* 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.
*/

export * from './error.component';
export * from './listbox.component';
export * from './validation.component';
20 changes: 20 additions & 0 deletions e2e-playwright/page-object/components/basic/listbox.component.ts
@@ -0,0 +1,20 @@
/*
* 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 { Page } from '@playwright/test';
import { BaseComponent } from '../base.component';

export class ListboxComponent extends BaseComponent {
private static rootElement = 'div[role=listbox]';
public allOptions = this.getChild('');
public oneOption = this.getChild('span >> span');

constructor(page: Page) {
super(page, ListboxComponent.rootElement);
}
}

0 comments on commit a0c7631

Please sign in to comment.