Skip to content
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
5 changes: 5 additions & 0 deletions tests/e2e/CODE_STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Automated lint checking and code format performs with ESLint and Prettier tools
### Preferable code style

1. Page-object and util classes

1. ✔ Class declaration using dependency injection (inversify library)

```
Expand All @@ -37,6 +38,7 @@ Automated lint checking and code format performs with ESLint and Prettier tools
```

2. Public methods

- ✔ Declare public methods without "public "keyword
- ✔ Add Logger.debug() inside method to log its name (with optional message)

Expand All @@ -49,6 +51,7 @@ Automated lint checking and code format performs with ESLint and Prettier tools
```

3. Locators

- ✔ For static locators - private static readonly fields type of By

```
Expand Down Expand Up @@ -102,6 +105,7 @@ Automated lint checking and code format performs with ESLint and Prettier tools
```

2. Mocha framework

- ✔ TDD framework (`suite()`, `test()`)
- ✔ Inject class instances, declare all test data inside test `suit()` function to avoid unnecessary code execution if test suit will not be run

Expand All @@ -118,6 +122,7 @@ Automated lint checking and code format performs with ESLint and Prettier tools
- ✔ Use test [./constants](constants) to make test flexible

3. Packages

1. Add packages as dev dependencies
2. If any changes re-create package-lock.json before push

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/pageobjects/ide/CheCodeLocatorLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ export class CheCodeLocatorLoader extends LocatorLoader {
contextView: By.className('monaco-menu-container')
},
Editor: {
inputArea: By.className('native-edit-context-textarea')
inputArea: By.className('editor-container')
},
ExtensionsViewSection: {
searchBox: By.className('native-edit-context-textarea')
searchBox: By.className('ime-text-area')
},
ExtensionsViewItem: {
author: By.className('publisher')
Expand Down
26 changes: 11 additions & 15 deletions tests/e2e/specs/factory/Factory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,7 @@
import 'reflect-metadata';

import { e2eContainer } from '../../configs/inversify.config';
import {
ActivityBar,
ContextMenu,
EditorView,
Key,
Locators,
NewScmView,
SingleScmProvider,
TextEditor,
ViewControl,
ViewSection
} from 'monaco-page-objects';
import { ActivityBar, ContextMenu, Key, Locators, NewScmView, SingleScmProvider, ViewControl, ViewSection } from 'monaco-page-objects';
import { expect } from 'chai';
import { OauthPage } from '../../pageobjects/git-providers/OauthPage';
import { StringUtil } from '../../utils/StringUtil';
Expand Down Expand Up @@ -135,10 +124,17 @@ suite(
test('Make changes to the file', async function (): Promise<void> {
Logger.debug(`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.setText: "${changesToCommit}"`);
await editor.setText(changesToCommit);
await driverHelper.getDriver().findElement(webCheCodeLocators.Editor.inputArea).click();

Logger.debug('Clearing the editor with Ctrl+A');
await driverHelper.getDriver().actions().keyDown(Key.CONTROL).sendKeys('a').keyUp(Key.CONTROL).perform();
await driverHelper.wait(500);
Logger.debug('Deleting selected text');
await driverHelper.getDriver().actions().sendKeys(Key.DELETE).perform();
await driverHelper.wait(500);
Logger.debug(`Entering text: "${changesToCommit}"`);
await driverHelper.getDriver().actions().sendKeys(changesToCommit).perform();
});

test('Open a source control manager', async function (): Promise<void> {
Expand Down
15 changes: 10 additions & 5 deletions tests/e2e/specs/factory/NoSetupRepoFactory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ import { e2eContainer } from '../../configs/inversify.config';
import {
ActivityBar,
ContextMenu,
EditorView,
InputBox,
Key,
Locators,
ModalDialog,
NewScmView,
SingleScmProvider,
TextEditor,
ViewControl,
ViewSection
} from 'monaco-page-objects';
Expand Down Expand Up @@ -132,10 +130,17 @@ suite(
test('Make changes to the file', async function (): Promise<void> {
Logger.debug(`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.setText: "${changesToCommit}"`);
await editor.setText(changesToCommit);
await driverHelper.getDriver().findElement(webCheCodeLocators.Editor.inputArea).click();

Logger.debug('Clearing the editor with Ctrl+A');
await driverHelper.getDriver().actions().keyDown(Key.CONTROL).sendKeys('a').keyUp(Key.CONTROL).perform();
await driverHelper.wait(500);
Logger.debug('Deleting selected text');
await driverHelper.getDriver().actions().sendKeys(Key.DELETE).perform();
await driverHelper.wait(500);
Logger.debug(`Entering text: "${changesToCommit}"`);
await driverHelper.getDriver().actions().sendKeys(changesToCommit).perform();
});

test('Open a source control manager', async function (): Promise<void> {
Expand Down
15 changes: 10 additions & 5 deletions tests/e2e/specs/factory/RefusedOAuthFactory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ import { e2eContainer } from '../../configs/inversify.config';
import {
ActivityBar,
ContextMenu,
EditorView,
InputBox,
Key,
Locators,
NewScmView,
SingleScmProvider,
TextEditor,
ViewControl,
ViewSection
} from 'monaco-page-objects';
Expand Down Expand Up @@ -138,10 +136,17 @@ suite(
test('Make changes to the file', async function (): Promise<void> {
Logger.debug(`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.setText: "${changesToCommit}"`);
await editor.setText(changesToCommit);
await driverHelper.getDriver().findElement(webCheCodeLocators.Editor.inputArea).click();

Logger.debug('Clearing the editor with Ctrl+A');
await driverHelper.getDriver().actions().keyDown(Key.CONTROL).sendKeys('a').keyUp(Key.CONTROL).perform();
await driverHelper.wait(500);
Logger.debug('Deleting selected text');
await driverHelper.getDriver().actions().sendKeys(Key.DELETE).perform();
await driverHelper.wait(500);
Logger.debug(`Entering text: "${changesToCommit}"`);
await driverHelper.getDriver().actions().sendKeys(changesToCommit).perform();
});

test('Open a source control manager', async function (): Promise<void> {
Expand Down