Skip to content

Commit

Permalink
fix: lint issues (eclipse-che#22113)
Browse files Browse the repository at this point in the history
Signed-off-by: mdolhalo <mdolhalo@redhat.com>
Co-authored-by: Maryna Dolhalova <mdolhalo@redhat.com>
  • Loading branch information
nallikaea and Maryna Dolhalova committed Mar 30, 2023
1 parent 65d396f commit f0466d9
Show file tree
Hide file tree
Showing 31 changed files with 267 additions and 263 deletions.
4 changes: 2 additions & 2 deletions tests/e2e/configs/inversify.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
**********************************************************************/


const TYPES = {
const TYPES: any = {
Driver: Symbol.for('Driver'),
CheLogin: Symbol.for('CheLogin'),
OcpLogin: Symbol.for('OcpLogin'),
Expand All @@ -18,7 +18,7 @@ const TYPES = {
ITokenHandler: Symbol.for('ITokenHandler')
};

const CLASSES = {
const CLASSES: any = {
DriverHelper: 'DriverHelper',
Dashboard: 'Dashboard',
Workspaces: 'Workspaces',
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/constants/TestConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export enum GitProviderType {
BITBUCKET = 'bitbucket'
}

export const TestConstants = {
export const TestConstants: any = {
/**
* Base URL of the application which should be checked
*/
Expand Down Expand Up @@ -217,7 +217,7 @@ export const TestConstants = {

TS_SELENIUM_FACTORY_GIT_REPO_BRANCH: process.env.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH || 'master',

TS_SELENIUM_FACTORY_URL() {
TS_SELENIUM_FACTORY_URL(): string {
return process.env.TS_SELENIUM_FACTORY_URL || TestConstants.TS_SELENIUM_BASE_URL + '/dashboard/#/' + this.TS_SELENIUM_FACTORY_GIT_REPO_URL;
},

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/constants/TimeoutConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/

export const TimeoutConstants = {
export const TimeoutConstants: any = {
// -------------------------------------------- INSTALLING AND STARTUP --------------------------------------------

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/driver/ChromeDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class ChromeDriver implements IDriver {
return this.driver;
}

async setWindowSize() {
async setWindowSize(): Promise<void> {
await this.driver
.manage()
.window()
Expand All @@ -49,7 +49,7 @@ export class ChromeDriver implements IDriver {
}

private getDriverBuilder(options: Options): Builder {
const disableW3copts = { 'goog:chromeOptions' : { 'w3c' : false }};
const disableW3copts: object = { 'goog:chromeOptions' : { 'w3c' : false }};
let builder: Builder = new Builder()
.forBrowser('chrome')
.setChromeOptions(options);
Expand Down
28 changes: 14 additions & 14 deletions tests/e2e/pageobjects/dashboard/Dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class Dashboard {
@inject(CLASSES.Workspaces) private readonly workspaces: Workspaces) {
}

async stopWorkspaceByUI(workspaceName: string) {
async stopWorkspaceByUI(workspaceName: string): Promise<void> {
Logger.debug(`Dashboard.stopWorkspaceByUI "${workspaceName}"`);

await this.clickWorkspacesButton();
Expand All @@ -53,7 +53,7 @@ export class Dashboard {
await this.workspaces.waitWorkspaceWithStoppedStatus(workspaceName);
}

async deleteStoppedWorkspaceByUI(workspaceName: string) {
async deleteStoppedWorkspaceByUI(workspaceName: string): Promise<void> {
Logger.debug(`Dashboard.deleteStoppedWorkspaceByUI "${workspaceName}"`);

await this.clickWorkspacesButton();
Expand All @@ -64,77 +64,77 @@ export class Dashboard {
await this.workspaces.waitWorkspaceListItemAbcence(workspaceName);
}

async stopAndRemoveWorkspaceByUI(workspaceName: string) {
async stopAndRemoveWorkspaceByUI(workspaceName: string): Promise<void> {
Logger.debug(`Dashboard.stopAndRemoveWorkspaceByUI "${workspaceName}"`);

await this.stopWorkspaceByUI(workspaceName);
await this.workspaces.deleteWorkspaceByActionsButton(workspaceName);
await this.workspaces.waitWorkspaceListItemAbcence(workspaceName);
}

async openDashboard() {
async openDashboard(): Promise<void> {
Logger.debug('Dashboard.openDashboard');
await this.driverHelper.getDriver().navigate().to(TestConstants.TS_SELENIUM_BASE_URL);
await this.waitPage();

}

async waitPage(timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
async waitPage(timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT): Promise<void> {
Logger.debug('Dashboard.waitPage');

await this.driverHelper.waitVisibility(By.xpath(Dashboard.WORKSPACES_BUTTON_XPATH), timeout);
await this.driverHelper.waitVisibility(By.xpath(Dashboard.CREATE_WORKSPACE_BUTTON_XPATH), timeout);
}

async clickWorkspacesButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
async clickWorkspacesButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
Logger.debug('Dashboard.clickWorkspacesButton');

await this.driverHelper.waitAndClick(By.xpath(Dashboard.WORKSPACES_BUTTON_XPATH), timeout);
}

async clickCreateWorkspaceButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
async clickCreateWorkspaceButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
Logger.debug('Dashboard.clickCreateWorkspaceButton');

await this.driverHelper.waitAndClick(By.xpath(Dashboard.CREATE_WORKSPACE_BUTTON_XPATH), timeout);
}

async getLoaderAlert(timeout: number = TimeoutConstants.TS_WAIT_LOADER_PRESENCE_TIMEOUT) {
async getLoaderAlert(timeout: number = TimeoutConstants.TS_WAIT_LOADER_PRESENCE_TIMEOUT): Promise<string> {
Logger.debug('Dashboard.getLoaderAlert');

return await this.driverHelper.waitAndGetText(By.xpath(Dashboard.LOADER_ALERT_XPATH), timeout);
}

async waitLoader(timeout: number = TimeoutConstants.TS_WAIT_LOADER_PRESENCE_TIMEOUT) {
async waitLoader(timeout: number = TimeoutConstants.TS_WAIT_LOADER_PRESENCE_TIMEOUT): Promise<void> {
Logger.debug('Dashboard.waitLoader');

await this.driverHelper.waitAllPresence(By.xpath(Dashboard.LOADER_PAGE_STEP_TITLES_XPATH), timeout);
}

async waitLoaderDisappearance(timeout: number = TimeoutConstants.TS_WAIT_LOADER_ABSENCE_TIMEOUT) {
async waitLoaderDisappearance(timeout: number = TimeoutConstants.TS_WAIT_LOADER_ABSENCE_TIMEOUT): Promise<void> {
Logger.debug('Dashboard.waitLoaderDisappearance');

await this.driverHelper.waitDisappearance(By.xpath(Dashboard.LOADER_PAGE_STEP_TITLES_XPATH), timeout);
}

async waitDisappearanceNavigationMenu(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
async waitDisappearanceNavigationMenu(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
Logger.debug('Dashboard.waitDisappearanceNavigationMenu');

await this.driverHelper.waitDisappearance(By.id('chenavmenu'), timeout);
}

async waitWorkspaceStartingPage(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
async waitWorkspaceStartingPage(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
Logger.debug(`Dashboard.waitWorkspaceStartingPage`);

await this.driverHelper.waitPresence(By.css(Dashboard.WORKSPACE_STARTING_PAGE_CSS), timeout);
}

async getRecentWorkspaceName(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
async getRecentWorkspaceName(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<string> {
Logger.debug(`Dashboard.getRecentWorkspaceName`);

return await this.driverHelper.waitAndGetText(By.css('[data-testid="recent-workspace-item"]'), timeout);
}

async logout(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
async logout(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
Logger.debug(`Dashboard.logout`);

await this.openDashboard();
Expand Down
40 changes: 20 additions & 20 deletions tests/e2e/pageobjects/dashboard/Workspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,81 +28,81 @@ export class Workspaces {
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) {
}

async waitPage(timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
async waitPage(timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT): Promise<void> {
Logger.debug('Workspaces.waitPage');

await this.driverHelper.waitVisibility(By.xpath(Workspaces.ADD_WORKSPACE_BUTTON_XPATH), timeout);
}

async clickAddWorkspaceButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
async clickAddWorkspaceButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
Logger.debug('Workspaces.clickAddWorkspaceButton');

await this.driverHelper.waitAndClick(By.xpath(Workspaces.ADD_WORKSPACE_BUTTON_XPATH), timeout);
}

async clickOpenButton(workspaceName: string, timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
async clickOpenButton(workspaceName: string, timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT): Promise<void> {
Logger.debug('Workspaces.clickOpenButton');

await this.driverHelper.waitAndClick(this.getOpenButtonLocator(workspaceName), timeout);
}

async waitWorkspaceListItem(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
async waitWorkspaceListItem(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
Logger.debug(`Workspaces.waitWorkspaceListItem "${workspaceName}"`);

const workspaceListItemLocator: By = By.xpath(this.getWorkspaceListItemLocator(workspaceName));

await this.driverHelper.waitVisibility(workspaceListItemLocator, timeout);
}

async waitWorkspaceWithRunningStatus(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
async waitWorkspaceWithRunningStatus(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
Logger.debug(`Workspaces.waitWorkspaceWithRunningStatus "${workspaceName}"`);

const runningStatusLocator: By = this.getWorkspaceStatusLocator(workspaceName, WorkspaceStatusUI.Running);

await this.driverHelper.waitVisibility(runningStatusLocator, timeout);
}

async waitWorkspaceWithStoppedStatus(workspaceName: string, timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT) {
async waitWorkspaceWithStoppedStatus(workspaceName: string, timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT): Promise<void> {
Logger.debug(`Workspaces.waitWorkspaceWithStoppedStatus "${workspaceName}"`);

const stoppedStatusLocator: By = this.getWorkspaceStatusLocator(workspaceName, WorkspaceStatusUI.Stopped);

await this.driverHelper.waitVisibility(stoppedStatusLocator, timeout);
}

async clickWorkspaceListItem(workspaceName: string, timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
async clickWorkspaceListItem(workspaceName: string, timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
Logger.debug(`Workspaces.clickWorkspaceListItem "${workspaceName}"`);

const workspaceListItemLocator: By = By.xpath(this.getWorkspaceListItemLocator(workspaceName));

await this.driverHelper.waitAndClick(workspaceListItemLocator, timeout);
}

async clickActionsButton(workspaceName: string) {
async clickActionsButton(workspaceName: string): Promise<void> {
Logger.debug(`Workspaces.clickActionsButton of the '${workspaceName}' list item`);

await this.driverHelper.waitAndClick(this.getActionsLocator(workspaceName));
}

async waitActionsPopup(workspaceName: string, timeout: number = TimeoutConstants.TS_CONTEXT_MENU_TIMEOUT) {
async waitActionsPopup(workspaceName: string, timeout: number = TimeoutConstants.TS_CONTEXT_MENU_TIMEOUT): Promise<void> {
Logger.debug(`Workspaces.waitActionsPopup of the '${workspaceName}' list item`);

await this.driverHelper.waitVisibility(this.getExpandedActionsLocator(workspaceName), timeout);
}

async openActionsPopup(workspaceName: string, timeout: number = TimeoutConstants.TS_CONTEXT_MENU_TIMEOUT) {
async openActionsPopup(workspaceName: string, timeout: number = TimeoutConstants.TS_CONTEXT_MENU_TIMEOUT): Promise<void> {
Logger.debug(`Workspaces.openActionsPopup for the '${workspaceName}' list item`);
await this.clickActionsButton(workspaceName);
await this.waitActionsPopup(workspaceName, timeout);
}

async clickActionsDeleteButton(workspaceName: string) {
async clickActionsDeleteButton(workspaceName: string): Promise<void> {
Logger.debug(`Workspaces.clickActionsDeleteButton for the '${workspaceName}' list item`);

await this.driverHelper.waitAndClick(this.getActionsPopupButtonLocator(workspaceName, 'Delete Workspace'));
}

async clickActionsStopWorkspaceButton(workspaceName: string) {
async clickActionsStopWorkspaceButton(workspaceName: string): Promise<void> {
Logger.debug(`Workspaces.clickActionsStopWorkspaceButton for the '${workspaceName}' list item`);
// todo: workaround because of issue CRW-3649
try {
Expand All @@ -115,7 +115,7 @@ export class Workspaces {
}
}

async waitDeleteWorkspaceConfirmationWindow(timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT) {
async waitDeleteWorkspaceConfirmationWindow(timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT): Promise<void> {
Logger.debug(`Workspaces.waitDeleteWorkspaceConfirmationWindow`);

const confirmationWindowLocator: By = By.xpath(`//div[@aria-label='Delete workspaces confirmation window']`);
Expand All @@ -124,15 +124,15 @@ export class Workspaces {
}


async clickToDeleteConfirmationCheckbox(timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT) {
async clickToDeleteConfirmationCheckbox(timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT): Promise<void> {
Logger.debug(`Workspaces.clickToDeleteConfirmationCheckbox`);

const deleteConfirmationCheckboxLocator: By = By.xpath(`//input[@data-testid='confirmation-checkbox']`);

await this.driverHelper.waitAndClick(deleteConfirmationCheckboxLocator, timeout);
}

async waitAndClickEnabledConfirmationWindowDeleteButton(timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT) {
async waitAndClickEnabledConfirmationWindowDeleteButton(timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT): Promise<void> {
Logger.debug(`Workspaces.waitEnabledConfirmationWindowDeleteButton`);

const enabledConfirmationWindowDeleteButton: By = By.xpath(`//button[@data-testid='delete-workspace-button' and not(@disabled)]`);
Expand All @@ -141,7 +141,7 @@ export class Workspaces {
}


async deleteWorkspaceByActionsButton(workspaceName: string, timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT) {
async deleteWorkspaceByActionsButton(workspaceName: string, timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT): Promise<void> {
Logger.debug('Workspaces.deleteWorkspaceByActionsButton');

await this.waitWorkspaceListItem(workspaceName, timeout);
Expand All @@ -152,23 +152,23 @@ export class Workspaces {
await this.waitAndClickEnabledConfirmationWindowDeleteButton(timeout);
}

async stopWorkspaceByActionsButton(workspaceName: string, timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT) {
async stopWorkspaceByActionsButton(workspaceName: string, timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT): Promise<void> {
Logger.debug('Workspaces.stopWorkspaceByActionsButton');

await this.waitWorkspaceListItem(workspaceName, timeout);
await this.openActionsPopup(workspaceName, timeout);
await this.clickActionsStopWorkspaceButton(workspaceName);
}

async waitWorkspaceListItemAbcence(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
async waitWorkspaceListItemAbcence(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
Logger.debug(`Workspaces.waitWorkspaceListItemAbcence "${workspaceName}"`);

const workspaceListItemLocator: By = By.xpath(this.getWorkspaceListItemLocator(workspaceName));

await this.driverHelper.waitDisappearance(workspaceListItemLocator, timeout);
}

async getAllCreatedWorkspacesNames(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
async getAllCreatedWorkspacesNames(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<string[]> {
Logger.debug('Workspaces.getAllCreatedWorkspacesNames');

const workspaceNames: string[] = [];
Expand Down Expand Up @@ -207,7 +207,7 @@ export class Workspaces {
return By.xpath(`${this.getWorkspaceListItemLocator(workspaceName)}//li[@role='menuitem']//button[text()='${buttonText}']`);
}

private getOpenButtonLocator(workspaceName: string) {
private getOpenButtonLocator(workspaceName: string): By {
return By.xpath(`${this.getWorkspaceListItemLocator(workspaceName)}//td[@data-key=5]//a[text()='Open']`);
}
}
Loading

0 comments on commit f0466d9

Please sign in to comment.