Skip to content

Commit

Permalink
Update 'NoSetupRepoFactory' E2E test (#23264)
Browse files Browse the repository at this point in the history
  • Loading branch information
artaleks9 authored Nov 25, 2024
1 parent 0aefb1c commit 8f466ad
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/e2e/pageobjects/dashboard/Dashboard.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** *******************************************************************
* copyright (c) 2019-2023 Red Hat, Inc.
* copyright (c) 2019-2024 Red Hat, Inc.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -38,6 +38,7 @@ export class Dashboard {
browserVersion: 'browser-version',
username: 'username'
};
private static readonly CONTINUE_WITH_DEFAULT_DEVFILE_BUTTON: By = By.xpath('//button[text()="Continue with default devfile"]');

constructor(
@inject(CLASSES.DriverHelper)
Expand Down Expand Up @@ -184,6 +185,12 @@ export class Dashboard {
await this.driverHelper.waitDisappearance(Dashboard.USER_SETTINGS_DROPDOWN, timeout);
}

async clickContinueWithDefaultDevfileButton(timeout: number = TIMEOUT_CONSTANTS.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
Logger.debug();

await this.driverHelper.waitAndClick(Dashboard.CONTINUE_WITH_DEFAULT_DEVFILE_BUTTON, timeout);
}

private getAboutMenuItemButtonLocator(text: string): By {
return By.xpath(`//li/button[text()="${text}"]`);
}
Expand Down
20 changes: 20 additions & 0 deletions tests/e2e/specs/factory/NoSetupRepoFactory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,26 @@ suite(
const allCreatedWorkspacesNames: string[] = await workspaces.getAllCreatedWorkspacesNames();
expect(allCreatedWorkspacesNames).has.length(numberOfCreatedWorkspaces);
});

test('Check creating workspace using default devfile', async function (): Promise<void> {
await browserTabsUtil.navigateTo(FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_URL());
await dashboard.waitLoader();
await dashboard.clickContinueWithDefaultDevfileButton();
await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName());
await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
});

test('Check that a project folder has not been cloned', async function (): Promise<void> {
testRepoProjectName = StringUtil.getProjectNameFromGitUrl(FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_URL);
await driverHelper.waitVisibility(webCheCodeLocators.TitleBar.itemElement);
await projectAndFileTests.performTrustAuthorDialog();
const isProjectFolderUnable: string = await driverHelper.waitAndGetElementAttribute(
(webCheCodeLocators.TreeItem as any).projectFolderItem,
'aria-label'
);
expect(isProjectFolderUnable).to.contain('No Folder Opened Section');
});
} else {
test('Obtain workspace name from workspace loader page', async function (): Promise<void> {
await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
Expand Down

0 comments on commit 8f466ad

Please sign in to comment.