Skip to content

Commit

Permalink
Update E2E 'factory' tests according new UI changes (#22588)
Browse files Browse the repository at this point in the history
Update E2E 'factory' tests according new UI changes, update 'CheCodeLocatorLoader.ts' to fix up a locator
  • Loading branch information
artaleks9 authored Oct 11, 2023
1 parent d5f1527 commit 080f22f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
3 changes: 3 additions & 0 deletions tests/e2e/pageobjects/ide/CheCodeLocatorLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export class CheCodeLocatorLoader extends LocatorLoader {
WelcomeContent: {
text: By.xpath('//*[@class="dialog-message-text" and contains(text(), "trust")]'),
button: By.xpath('//div[@class="monaco-dialog-box"]//a[@class="monaco-button monaco-text-button"]')
},
ScmView: {
actionConstructor: (title: string) => By.xpath(`.//a[@title='${title}']`)
}
},
extras: {
Expand Down
8 changes: 5 additions & 3 deletions tests/e2e/specs/factory/Factory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
import { expect } from 'chai';
import { OauthPage } from '../../pageobjects/git-providers/OauthPage';
import { StringUtil } from '../../utils/StringUtil';
import { CheCodeLocatorLoader } from '../../pageobjects/ide/CheCodeLocatorLoader';
import { registerRunningWorkspace } from '../MochaHooks';
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests';
Expand All @@ -45,7 +46,8 @@ suite(
const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
const webCheCodeLocators: Locators = e2eContainer.get(CLASSES.CheCodeLocatorLoader);
const cheCodeLocatorLoader: CheCodeLocatorLoader = e2eContainer.get(CLASSES.CheCodeLocatorLoader);
const webCheCodeLocators: Locators = cheCodeLocatorLoader.webCheCodeLocators;
const oauthPage: OauthPage = e2eContainer.get(CLASSES.OauthPage);

let projectSection: ViewSection;
Expand Down Expand Up @@ -106,7 +108,7 @@ suite(

test('Make changes to the file', async function (): Promise<void> {
Logger.debug(`projectSection.openItem: "${fileToChange}"`);
await projectSection.openItem(fileToChange);
await projectSection.openItem(testRepoProjectName, fileToChange);
const editor: TextEditor = (await new EditorView().openEditor(fileToChange)) as TextEditor;
await driverHelper.waitVisibility(webCheCodeLocators.Editor.inputArea);
Logger.debug('editor.clearText');
Expand Down Expand Up @@ -184,7 +186,7 @@ suite(
webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel),
'aria-disabled'
);
expect(isCommitButtonDisabled).to.be.true;
expect(isCommitButtonDisabled).to.equal('true');
});

test('Stop the workspace', async function (): Promise<void> {
Expand Down
7 changes: 4 additions & 3 deletions tests/e2e/specs/factory/NoSetupRepoFactory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ import { OAUTH_CONSTANTS } from '../../constants/OAUTH_CONSTANTS';
import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';

suite(
`Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository without OAuth setup`,
`Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository without PAT/OAuth setup`,
function (): void {
const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
const webCheCodeLocators: Locators = new CheCodeLocatorLoader().webCheCodeLocators;
const cheCodeLocatorLoader: CheCodeLocatorLoader = e2eContainer.get(CLASSES.CheCodeLocatorLoader);
const webCheCodeLocators: Locators = cheCodeLocatorLoader.webCheCodeLocators;
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
const workspaces: Workspaces = e2eContainer.get(CLASSES.Workspaces);
Expand Down Expand Up @@ -127,7 +128,7 @@ suite(

test('Make changes to the file', async function (): Promise<void> {
Logger.debug(`projectSection.openItem: "${fileToChange}"`);
await projectSection.openItem(fileToChange);
await projectSection.openItem(testRepoProjectName, fileToChange);
const editor: TextEditor = (await new EditorView().openEditor(fileToChange)) as TextEditor;
await driverHelper.waitVisibility(webCheCodeLocators.Editor.inputArea);
Logger.debug('editor.clearText');
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/specs/factory/RefusedOAuthFactory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ suite(
const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
const webCheCodeLocators: Locators = new CheCodeLocatorLoader().webCheCodeLocators;
const cheCodeLocatorLoader: CheCodeLocatorLoader = e2eContainer.get(CLASSES.CheCodeLocatorLoader);
const webCheCodeLocators: Locators = cheCodeLocatorLoader.webCheCodeLocators;
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
const oauthPage: OauthPage = e2eContainer.get(CLASSES.OauthPage);
Expand Down Expand Up @@ -125,7 +126,7 @@ suite(

test('Make changes to the file', async function (): Promise<void> {
Logger.debug(`projectSection.openItem: "${fileToChange}"`);
await projectSection.openItem(fileToChange);
await projectSection.openItem(testRepoProjectName, fileToChange);
const editor: TextEditor = (await new EditorView().openEditor(fileToChange)) as TextEditor;
await driverHelper.waitVisibility(webCheCodeLocators.Editor.inputArea);
Logger.debug('editor.clearText');
Expand Down

0 comments on commit 080f22f

Please sign in to comment.