che icon indicating copy to clipboard operation
che copied to clipboard

[WIP] Improve /find solutions for using CHE and vscode-extension-tester library

Open musienko-maxim opened this issue 2 years ago • 4 comments

Is your enhancement related to a problem? Please describe

During the use of the vscode-extension-tester library in che e2e tests, we had some problems:

  • Some web elements are not present in the library because we have some differences in UI between CHE and VSCode, for instance, the Application menu in the left top corner

  • The define/redefine waiters for some web elements is not clear (what should we do if default timeout for waiting for some specific element is not enough) * Update from @djelinek : Solution should be to use "driver.wait(...)". This way https://github.com/redhat-developer/vscode-extension-tester/blob/147c264a29d7a12abc475b37252467eb8d952c6e/tests/test-project/src/test/xsideBar/customView.test.ts#L40-L43 you should be able to dynamically wait on every element

  • Unexpected behavior methods in some specific cases (for example, expand some project items in the Project tree is hung and we need to add extra actions like this: https://github.com/eclipse/che/pull/22565/files#diff-1666e5f187dda73348a082b9d79d76c0d88f20f8ad798103fc72012829a9278bR100)

  • //TODO

Describe the solution you'd like

  • Return to the using our own pageobjects model //TODO

Describe alternatives you've considered

No response

Additional context

No response

musienko-maxim avatar Oct 02 '23 09:10 musienko-maxim

Not found but present in available: TreeItemNotFoundError: Item 'Date.txt' not found. Available items in current directory: [.gitignore,Date.txt,README.md,devfile.yaml,public-bb-repo]

nallikaea avatar Oct 02 '23 10:10 nallikaea

https://github.com/redhat-developer/vscode-extension-tester/issues/767

nallikaea avatar Oct 02 '23 10:10 nallikaea

Methods failed because before findElement() methods driver does not wait element visibility. For example:

findItem(label, maxLevel = 0) {
        return __awaiter(this, void 0, void 0, function* () {
            yield this.expand();
            // CAN FAIL
            const container = yield this.findElement(DefaultTreeSection.locators.DefaultTreeSection.rowContainer);
            yield container.sendKeys(selenium_webdriver_1.Key.HOME);
            let item = undefined;
            do {
                // CAN FAIL
                const temp = yield container.findElements(DefaultTreeSection.locators.DefaultTreeItem.ctor(label));
                if (temp.length > 0) {
                    const level = +(yield temp[0].getAttribute(DefaultTreeSection.locators.ViewSection.level));
                    if (maxLevel < 1 || level <= maxLevel) {
                        item = yield new DefaultTreeItem_1.DefaultTreeItem(temp[0], this).wait();
                    }
                }
                if (!item) {
                    // CAN FAIL
                    const lastrow = yield container.findElements(DefaultTreeSection.locators.DefaultTreeSection.lastRow);
                    if (lastrow.length > 0) {
                        break;
                    }
                    yield container.sendKeys(selenium_webdriver_1.Key.PAGE_DOWN);
                }
            } while (!item);

            return item;
        });
    }

nallikaea avatar Oct 02 '23 10:10 nallikaea

@musienko-maxim should it be spike or epic?

ibuziuk avatar Oct 03 '23 10:10 ibuziuk