From 34e461c557b248d87551b7dc47f19e2c1f047372 Mon Sep 17 00:00:00 2001 From: Aleksandr Shmaraiev Date: Mon, 21 Jul 2025 14:18:51 +0300 Subject: [PATCH 1/3] Update locators in 'CheCodeLocatorLoader' --- tests/e2e/pageobjects/ide/CheCodeLocatorLoader.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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') From 6f221d349f386d173aacce49343d5f87d73a462c Mon Sep 17 00:00:00 2001 From: Aleksandr Shmaraiev Date: Mon, 21 Jul 2025 14:20:38 +0300 Subject: [PATCH 2/3] Update 'factory' E2E tests related to changes in editor --- tests/e2e/specs/factory/Factory.spec.ts | 26 ++++++++----------- .../specs/factory/NoSetupRepoFactory.spec.ts | 15 +++++++---- .../specs/factory/RefusedOAuthFactory.spec.ts | 15 +++++++---- 3 files changed, 31 insertions(+), 25 deletions(-) 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 { From 396a45e7023b50da445f1ee79d4c40909576251b Mon Sep 17 00:00:00 2001 From: Aleksandr Shmaraiev Date: Mon, 21 Jul 2025 14:22:37 +0300 Subject: [PATCH 3/3] Do formatting 'CODE_STYLE' file --- tests/e2e/CODE_STYLE.md | 5 +++++ 1 file changed, 5 insertions(+) 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