Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eliminate dead code in e2e tests #3220

Merged
merged 4 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions e2e/playwright/tests/folder-rules/tests/actions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import { test } from '../fixtures/page-initialization';
import { NodeBodyCreate } from '@alfresco/aca-testing-shared';
import { ActionType } from '../page-objects/components/actions-dropdown.component';
import { expect } from '@playwright/test';

Expand All @@ -34,7 +33,8 @@ test.describe('Folder Rules Actions', () => {
let folderId: string;

test.beforeAll(async ({ apiClient }) => {
folderId = (await apiClient.nodes.createNode('-my-', new NodeBodyCreate(randomFolderName, 'cm:folder'))).entry.id;
const node = await apiClient.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' });
folderId = node.entry.id;
});

test.beforeEach(async ({ personalFiles }) => {
Expand Down
4 changes: 2 additions & 2 deletions e2e/playwright/tests/folder-rules/tests/conditions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import { test } from '../fixtures/page-initialization';
import { NodeBodyCreate } from '@alfresco/aca-testing-shared';
import { ActionType } from '../page-objects/components/actions-dropdown.component';
import { Comparator, Field } from '../page-objects/components/conditions.component';
import { expect } from '@playwright/test';
Expand All @@ -36,7 +35,8 @@ test.describe('Folder Rules Conditions', () => {
let folderId: string;

test.beforeAll(async ({ apiClient }) => {
folderId = (await apiClient.nodes.createNode('-my-', new NodeBodyCreate(randomFolderName, 'cm:folder'))).entry.id;
const node = await apiClient.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' });
folderId = node.entry.id;
});

test.beforeEach(async ({ personalFiles }) => {
Expand Down
4 changes: 2 additions & 2 deletions e2e/playwright/tests/folder-rules/tests/manage-rules.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import { test } from '../fixtures/page-initialization';
import { NodeBodyCreate } from '@alfresco/aca-testing-shared';

test.describe('Rules - Manage Rules', () => {
const randomName = `playwright-folder-${(Math.random() + 1).toString(36).substring(6)}`;
Expand All @@ -32,7 +31,8 @@ test.describe('Rules - Manage Rules', () => {
let folderId: string;

test.beforeAll(async ({ apiClient }) => {
folderId = (await apiClient.nodes.createNode('-my-', new NodeBodyCreate(randomName, 'cm:folder'))).entry.id;
const node = await apiClient.nodes.createNode('-my-', { name: randomName, nodeType: 'cm:folder', relativePath: '/' });
folderId = node.entry.id;
await apiClient.createRandomRule(folderId, randomRuleName);
});

Expand Down
4 changes: 0 additions & 4 deletions e2e/suites/viewer/viewer-actions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,9 @@ describe('Viewer actions', () => {
it('[C279282] Full screen action', async () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles);
await viewer.waitForViewerToOpen();
await Utils.getBrowserLog();

await toolbar.fullScreenButton.click();
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is closed after pressing Full screen');
const browserLogAfter = await Utils.getBrowserLog();

expect(browserLogAfter.length).toBe(0, browserLogAfter.entries);
});

it('[C286314] Pressing ESC in the viewer closes only the action dialog', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import { browser, by } from 'protractor';
import { Component } from '../component';
import { waitForPresence, waitForStaleness } from '../../utilities/utils';
import { waitForPresence } from '../../utilities/utils';
import { BrowserActions } from '@alfresco/adf-testing';

export class DropDownBreadcrumb extends Component {
Expand All @@ -42,10 +42,6 @@ export class DropDownBreadcrumb extends Component {
return waitForPresence(this.pathItemsContainer, 'Timeout waiting for breadcrumb dropdown to open');
}

async waitForPathListDropdownToClose(): Promise<void> {
return waitForStaleness(browser.$(this.pathOptionCss), 'Timeout waiting for breadcrumb dropdown to close');
}

async openPath(): Promise<void> {
await BrowserActions.click(this.trigger);
await this.waitForPathListDropdownToOpen();
Expand Down
1 change: 0 additions & 1 deletion projects/aca-testing-shared/src/components/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
export * from './login/login';
export * from './header/header';
export * from './pageLayoutHeader/pageLayoutHeader';
export * from './header/user-info';
export * from './data-table/data-table';
export * from './dialog/confirm-dialog';
export * from './dialog/create-edit-folder-dialog';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

import { browser, by, ElementArrayFinder, ElementFinder, protractor } from 'protractor';
import { BrowserActions, BrowserVisibility, Logger } from '@alfresco/adf-testing';
import { BrowserVisibility, Logger } from '@alfresco/adf-testing';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component';
import { Menu } from '../menu/menu';
Expand Down Expand Up @@ -218,14 +218,6 @@ export class DataTable extends Component {
return '';
}

async getLockOwnerToolTip(itemName: string, location: string = ''): Promise<string> {
if (await this.hasLockIcon(itemName, location)) {
const row = this.getRowByName(itemName, location);
return BrowserActions.getAttribute(row.element(by.css('img[src*="lock"]')), 'alt');
}
return '';
}

private getNameLink(itemName: string): ElementFinder {
return this.getRowNameCell(itemName).$('.adf-datatable-link [role="link"]');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export class CreateOrEditFolderDialog extends GenericDialog {
updateButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Update'));

nameInput = this.rootElem.element(by.id('adf-folder-name-input'));
titleInput = this.rootElem.element(by.id('adf-folder-title-input'));
descriptionTextArea = this.rootElem.element(by.id('adf-folder-description-input'));
validationMessage = this.rootElem.element(by.css('.mat-hint span'));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@ export class CreateFromTemplateDialog extends GenericDialog {
return BrowserActions.getInputValue(this.nameInput);
}

async getDescriptionValue(): Promise<string> {
return BrowserActions.getInputValue(this.descriptionTextArea);
}

async getTitleInputValue(): Promise<string> {
return BrowserActions.getInputValue(this.titleInput);
}

async enterName(name: string): Promise<void> {
await typeText(this.nameInput, name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,4 @@ export class CreateLibraryDialog extends GenericDialog {
async isPublicChecked(): Promise<boolean> {
return this.isChecked(this.visibilityPublic);
}

async isModeratedChecked(): Promise<boolean> {
return this.isChecked(this.visibilityModerated);
}

async isPrivateChecked(): Promise<boolean> {
return this.isChecked(this.visibilityPrivate);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,12 @@ import { BrowserActions } from '@alfresco/adf-testing';
import { Menu } from '../menu/menu';

export class ManageVersionsDialog extends GenericDialog {
closeButton = this.childElement(by.cssContainingText('.mat-button', 'Close'));

menu = new Menu();

constructor() {
super('.adf-new-version-uploader-dialog');
}

async clickClose(): Promise<void> {
await BrowserActions.click(this.closeButton);
await this.waitForDialogToClose();
}

async clickActionButton(version: string): Promise<void> {
await BrowserActions.click(this.childElement(by.id(`adf-version-list-action-menu-button-${version}`)));
await this.menu.waitForMenuToOpen();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,6 @@ export class ShareDialog extends GenericDialog {
return toggleClass.includes('checked');
}

async closeDatetimePicker(): Promise<void> {
if (await this.dateTimePicker.isCalendarOpen()) {
await BrowserActions.click(this.datetimePickerButton);
}
}

async getExpireDate(): Promise<string> {
return BrowserActions.getInputValue(this.expireInput);
}
Expand Down
11 changes: 0 additions & 11 deletions projects/aca-testing-shared/src/components/header/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,16 @@

import { by, browser } from 'protractor';
import { Component } from '../component';
import { UserInfo } from './user-info';
import { Menu } from '../menu/menu';
import { Toolbar } from './../toolbar/toolbar';
import { SearchInput } from '../search/search-input';
import { waitElement } from '../../utilities/utils';
import { BrowserActions } from '@alfresco/adf-testing';

export class Header extends Component {
logoLink = this.byCss('.app-menu__title');
userMenuButton = this.byCss(`.aca-user-menu-button`);
sidenavToggle = this.byCss(`.sidenav-header-title-logo`);

userInfo = new UserInfo();
menu = new Menu();
toolbar = new Toolbar();
searchInput = new SearchInput();
Expand Down Expand Up @@ -66,12 +63,4 @@ export class Header extends Component {
await waitElement(`[data-automation-id='expanded']`);
}
}

async collapseSideNav(): Promise<void> {
const expanded = await this.isSidenavExpanded();
if (expanded) {
await BrowserActions.click(this.sidenavToggle);
await waitElement(`[data-automation-id='collapsed']`);
}
}
}
50 changes: 0 additions & 50 deletions projects/aca-testing-shared/src/components/header/user-info.ts

This file was deleted.

1 change: 0 additions & 1 deletion projects/aca-testing-shared/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export * from './data-table/data-table';
export * from './datetime-picker/datetime-picker';
export * from './dialog';
export * from './header/header';
export * from './header/user-info';
export * from './info-drawer';
export * from './login/login';
export * from './menu/menu';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ import { BrowserActions, BrowserVisibility } from '@alfresco/adf-testing';

export class ContentMetadata extends Component {
expandedPanel = this.byCss('.mat-expansion-panel.mat-expanded');
propertyList = this.byCss('.adf-property-list');
propertyListElements = this.allByCss('.adf-property');
propertyValue = this.byCss('.adf-property-value');
editPropertiesButton = this.byCss(`button[title='Edit']`);
lessInfoButton = this.byCssText(`[data-automation-id='meta-data-card-toggle-expand']`, 'Less information');
moreInfoButton = this.byCssText(`[data-automation-id='meta-data-card-toggle-expand']`, 'More information');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ import { Component } from '../component';
import { waitForPresence, waitForStaleness, typeText } from '../../utilities/utils';

export class LibraryMetadata extends Component {
metadataTabContent = this.byCss('.mat-card-content');
metadataTabAction = this.byCss('.mat-card-actions .mat-button');
fieldLabelWrapper = this.byCss('.mat-form-field-label-wrapper');
fieldInput = this.byCss('.mat-input-element');
visibilityDropDown = this.component.element(by.css('.mat-select'));
visibilityPublic = this.byCssText('.mat-option .mat-option-text', 'Public', browser);
visibilityPrivate = this.byCssText('.mat-option .mat-option-text', 'Private', browser);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,9 @@ export class InfoDrawer extends Component {
propertiesTab = new ContentMetadata('adf-info-drawer');
header = this.byCss('.adf-info-drawer-layout-header');
headerTitle = this.byCss('.adf-info-drawer-layout-header-title');
tabLabel = this.byCss('.mat-tab-label-content');
tabLabelsList = this.allByCss('.mat-tab-label-content');
tabActiveLabel = this.byCss('.mat-tab-label-active');
tabActiveContent = this.byCss('.mat-tab-body-active .mat-tab-body-content adf-dynamic-tab');
nextButton = this.byCss('.mat-tab-header-pagination-after .mat-tab-header-pagination-chevron');
previousButton = this.byCss('.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron');
expandDetailsButton = TestElement.byCss(`button[title='Expand']`);
selectedTab = TestElement.byCss(`.mat-tab-list [aria-selected='true'] div`);
expandedDetailsPermissionsTab = TestElement.byText('.acs-details-container .mat-tab-label-content', 'Permissions');
Expand Down Expand Up @@ -104,18 +101,10 @@ export class InfoDrawer extends Component {
return this.headerTitle.getText();
}

async isAboutTabDisplayed() {
return this.isTabDisplayed('About');
}

async isPropertiesTabDisplayed() {
return this.isTabDisplayed('Properties');
}

async isPropertiesTabActive() {
return (await this.getActiveTabTitle()) === 'PROPERTIES';
}

async isCommentsTabDisplayed() {
return this.isTabDisplayed('Comments');
}
Expand Down
1 change: 0 additions & 1 deletion projects/aca-testing-shared/src/components/login/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export class LoginComponent extends Component {
usernameInput = this.byCss('input#username');
passwordInput = this.byCss('input#password');
submitButton = this.byCss('button#login-button');
errorMessage = this.byCss('.adf-login-error-message');
copyright = this.byCss('.adf-copyright');
passwordVisibility = this.byCss('.adf-login-password-icon');

Expand Down
Loading