diff --git a/tests/e2e/CODE_STYLE.md b/tests/e2e/CODE_STYLE.md index d13fbff5d1a..96d39c98cca 100644 --- a/tests/e2e/CODE_STYLE.md +++ b/tests/e2e/CODE_STYLE.md @@ -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) ``` @@ -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) @@ -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 ``` @@ -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 @@ -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 diff --git a/tests/e2e/pageobjects/ide/CheCodeLocatorLoader.ts b/tests/e2e/pageobjects/ide/CheCodeLocatorLoader.ts index e7666a66ae7..b3e1cae0229 100644 --- a/tests/e2e/pageobjects/ide/CheCodeLocatorLoader.ts +++ b/tests/e2e/pageobjects/ide/CheCodeLocatorLoader.ts @@ -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') diff --git a/tests/e2e/specs/factory/Factory.spec.ts b/tests/e2e/specs/factory/Factory.spec.ts index 2e1edf42665..e5e255ad578 100644 --- a/tests/e2e/specs/factory/Factory.spec.ts +++ b/tests/e2e/specs/factory/Factory.spec.ts @@ -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'; @@ -135,10 +124,17 @@ suite( test('Make changes to the file', async function (): Promise { 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 { diff --git a/tests/e2e/specs/factory/NoSetupRepoFactory.spec.ts b/tests/e2e/specs/factory/NoSetupRepoFactory.spec.ts index 0c2c8560781..c2d18d04178 100644 --- a/tests/e2e/specs/factory/NoSetupRepoFactory.spec.ts +++ b/tests/e2e/specs/factory/NoSetupRepoFactory.spec.ts @@ -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'; @@ -132,10 +130,17 @@ suite( test('Make changes to the file', async function (): Promise { 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 { diff --git a/tests/e2e/specs/factory/RefusedOAuthFactory.spec.ts b/tests/e2e/specs/factory/RefusedOAuthFactory.spec.ts index f0ac8c55121..3fb3b264c04 100644 --- a/tests/e2e/specs/factory/RefusedOAuthFactory.spec.ts +++ b/tests/e2e/specs/factory/RefusedOAuthFactory.spec.ts @@ -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'; @@ -138,10 +136,17 @@ suite( test('Make changes to the file', async function (): Promise { 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 {