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

Fix up E2E tests related to factory test flow #22861

Merged
merged 4 commits into from
Mar 5, 2024
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
18 changes: 9 additions & 9 deletions tests/e2e/configs/mocharc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ module.exports = {
BASE_TEST_CONSTANTS.TEST_ENVIRONMENT !== ''
? `dist/suites/${MOCHA_CONSTANTS.MOCHA_DIRECTORY}/${MOCHA_CONSTANTS.MOCHA_SUITE}.suite.js`
: // variable MOCHA_DIRECTORY uses in command "test-all-devfiles" and sets up automatically.
// you can set it up to run files from specific directory with export environmental variable.
MOCHA_CONSTANTS.MOCHA_DIRECTORY
? // to run one file (name without extension). uses in "test", "test-all-devfiles".
MOCHA_CONSTANTS.MOCHA_USERSTORY
? `dist/specs/${MOCHA_CONSTANTS.MOCHA_DIRECTORY}/${MOCHA_CONSTANTS.MOCHA_USERSTORY}.spec.js`
: `dist/specs/${MOCHA_CONSTANTS.MOCHA_DIRECTORY}/**.spec.js`
: MOCHA_CONSTANTS.MOCHA_USERSTORY
? [`dist/specs/**/${MOCHA_CONSTANTS.MOCHA_USERSTORY}.spec.js`, `dist/specs/${MOCHA_CONSTANTS.MOCHA_USERSTORY}.spec.js`]
: ['dist/specs/**/**.spec.js', 'dist/specs/**.spec.js'],
// you can set it up to run files from specific directory with export environmental variable.
MOCHA_CONSTANTS.MOCHA_DIRECTORY
? // to run one file (name without extension). uses in "test", "test-all-devfiles".
MOCHA_CONSTANTS.MOCHA_USERSTORY
? `dist/specs/${MOCHA_CONSTANTS.MOCHA_DIRECTORY}/${MOCHA_CONSTANTS.MOCHA_USERSTORY}.spec.js`
: `dist/specs/${MOCHA_CONSTANTS.MOCHA_DIRECTORY}/**.spec.js`
: MOCHA_CONSTANTS.MOCHA_USERSTORY
? [`dist/specs/**/${MOCHA_CONSTANTS.MOCHA_USERSTORY}.spec.js`, `dist/specs/${MOCHA_CONSTANTS.MOCHA_USERSTORY}.spec.js`]
: ['dist/specs/**/**.spec.js', 'dist/specs/**.spec.js'],
retries: MOCHA_CONSTANTS.MOCHA_RETRIES,
grep: MOCHA_CONSTANTS.MOCHA_GREP
};
4 changes: 2 additions & 2 deletions tests/e2e/constants/BASE_TEST_CONSTANTS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ export const BASE_TEST_CONSTANTS: {
return BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL.includes('devspaces')
? 'devspaces'
: BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL.includes('che')
? 'che'
: 'default';
? 'che'
: 'default';
},
/**
* testing application version
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/pageobjects/ide/CheCodeLocatorLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class CheCodeLocatorLoader extends LocatorLoader {
button: By.xpath('//div[@class="monaco-dialog-box"]//a[@class="monaco-button monaco-text-button"]')
},
ScmView: {
actionConstructor: (title: string): By => By.xpath(`.//a[@title='${title}']`)
actionConstructor: (title: string): By => By.xpath(`.//a[@aria-label='${title}']`)
}
},
extras: {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/MochaHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function registerRunningWorkspace(workspaceName: string): void {
: ((): void => {
Logger.debug('delete workspace name');
WorkspaceHandlingTests.clearWorkspaceName();
})();
})();

latestWorkspace = workspaceName;
}
Expand Down
21 changes: 8 additions & 13 deletions tests/e2e/specs/factory/Factory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ suite(
const timeToRefresh: number = 1500;
const changesToCommit: string = new Date().getTime().toString();
const fileToChange: string = 'Date.txt';
const commitChangesButtonLabel: string = `Commit Changes on "${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}"`;
const refreshButtonLabel: string = 'Refresh';
const pushItemLabel: string = 'Push';
let testRepoProjectName: string;
Expand Down Expand Up @@ -141,8 +140,8 @@ suite(
test('Check if the changes are displayed in the source control manager', async function (): Promise<void> {
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
await driverHelper.wait(timeToRefresh);
Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
await scmProvider.takeAction(refreshButtonLabel);
Logger.debug(`wait and click on: "${refreshButtonLabel}"`);
await driverHelper.waitAndClick(webCheCodeLocators.ScmView.actionConstructor(refreshButtonLabel));
// wait while changes counter will be refreshed
await driverHelper.wait(timeToRefresh);
const changes: number = await scmProvider.getChangeCount();
Expand All @@ -164,8 +163,8 @@ suite(
await scmProvider.commitChanges('Commit ' + changesToCommit);
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
await driverHelper.wait(timeToRefresh);
Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
await scmProvider.takeAction(refreshButtonLabel);
Logger.debug(`wait and click on: "${refreshButtonLabel}"`);
await driverHelper.waitAndClick(webCheCodeLocators.ScmView.actionConstructor(refreshButtonLabel));
// wait while changes counter will be refreshed
await driverHelper.wait(timeToRefresh);
const changes: number = await scmProvider.getChangeCount();
Expand All @@ -174,11 +173,7 @@ suite(
});

test('Push the changes', async function (): Promise<void> {
await driverHelper.waitVisibility(
webCheCodeLocators.ScmView.actionConstructor(
`Push 1 commits to origin/${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}`
)
);
await driverHelper.waitVisibility(webCheCodeLocators.Notification.action);
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
Logger.debug('scmProvider.openMoreActions');
scmContextMenu = await scmProvider.openMoreActions();
Expand All @@ -190,10 +185,10 @@ suite(
test('Check if the changes were pushed', async function (): Promise<void> {
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
await driverHelper.wait(timeToRefresh);
Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
await scmProvider.takeAction(refreshButtonLabel);
Logger.debug(`wait and click on: "${refreshButtonLabel}"`);
await driverHelper.waitAndClick(webCheCodeLocators.ScmView.actionConstructor(refreshButtonLabel));
const isCommitButtonDisabled: string = await driverHelper.waitAndGetElementAttribute(
webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel),
webCheCodeLocators.Notification.action,
'aria-disabled'
);
expect(isCommitButtonDisabled).to.equal('true');
Expand Down
10 changes: 5 additions & 5 deletions tests/e2e/specs/factory/NoSetupRepoFactory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ suite(
test('Check if the changes are displayed in the source control manager', async function (): Promise<void> {
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
await driverHelper.wait(timeToRefresh);
Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
await scmProvider.takeAction(refreshButtonLabel);
Logger.debug(`wait and click on: "${refreshButtonLabel}"`);
await driverHelper.waitAndClick(webCheCodeLocators.ScmView.actionConstructor(refreshButtonLabel));
// wait while changes counter will be refreshed
await driverHelper.wait(timeToRefresh);
const changes: number = await scmProvider.getChangeCount();
Expand All @@ -181,8 +181,8 @@ suite(
await scmProvider.commitChanges('Commit ' + changesToCommit);
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
await driverHelper.wait(timeToRefresh);
Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
await scmProvider.takeAction(refreshButtonLabel);
Logger.debug(`wait and click on: "${refreshButtonLabel}"`);
await driverHelper.waitAndClick(webCheCodeLocators.ScmView.actionConstructor(refreshButtonLabel));
// wait while changes counter will be refreshed
await driverHelper.wait(timeToRefresh);
const changes: number = await scmProvider.getChangeCount();
Expand Down Expand Up @@ -232,7 +232,7 @@ suite(
test('Check if the changes were pushed', async function (): Promise<void> {
try {
Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
await scmProvider.takeAction(refreshButtonLabel);
await driverHelper.waitAndClick(webCheCodeLocators.ScmView.actionConstructor(refreshButtonLabel));
} catch (e) {
Logger.info(
'Check you use correct credentials.' +
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/specs/factory/RefusedOAuthFactory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ suite(
test('Check if the changes are displayed in the source control manager', async function (): Promise<void> {
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
await driverHelper.wait(timeToRefresh);
Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
await scmProvider.takeAction(refreshButtonLabel);
Logger.debug(`wait and click on: "${refreshButtonLabel}"`);
await driverHelper.waitAndClick(webCheCodeLocators.ScmView.actionConstructor(refreshButtonLabel));
// wait while changes counter will be refreshed
await driverHelper.wait(timeToRefresh);
const changes: number = await scmProvider.getChangeCount();
Expand All @@ -182,8 +182,8 @@ suite(
await scmProvider.commitChanges('Commit ' + changesToCommit);
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
await driverHelper.wait(timeToRefresh);
Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
await scmProvider.takeAction(refreshButtonLabel);
Logger.debug(`wait and click on: "${refreshButtonLabel}"`);
await driverHelper.waitAndClick(webCheCodeLocators.ScmView.actionConstructor(refreshButtonLabel));
// wait while changes counter will be refreshed
await driverHelper.wait(timeToRefresh);
const changes: number = await scmProvider.getChangeCount();
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/utils/DevWorkspaceConfigurationHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ export class DevWorkspaceConfigurationHelper {
e.kind === 'DevWorkspace'
? (content.DevWorkspace = e)
: e.kind === 'DevWorkspaceTemplate'
? (content.DevWorkspaceTemplate = e)
: Logger.error(
'Problems with configuration parsing, string should be in format "DevWorkspace\\n---\\nDevWorkspaceTemplate"'
);
? (content.DevWorkspaceTemplate = e)
: Logger.error(
'Problems with configuration parsing, string should be in format "DevWorkspace\\n---\\nDevWorkspaceTemplate"'
);
});

return content;
Expand Down
Loading