diff --git a/src/webview/homescreenView.ts b/src/webview/homescreenView.ts
index 5e41dba..ede5d43 100644
--- a/src/webview/homescreenView.ts
+++ b/src/webview/homescreenView.ts
@@ -219,6 +219,7 @@ export class HomescreenViewProvider implements vscode.WebviewViewProvider {
{
@@ -38,7 +36,7 @@ describe('Search asset from side bar', () => {
await sideBarViewUtils.clickAction(SideBarViewActions.SEARCH);
- await inputBoxUtils.fillAndConfirm(assetPublicID);
+ await sideBarViewUtils.homeScreenViewPage.fillSearchInput(assetPublicID);
await sideBarViewUtils.validateContentItemsExist(['Clear Search', assetPublicID]);
await sideBarViewUtils.validateContentItemsNumber(2);
diff --git a/test/e2e/src/utils/wdioUtils.ts b/test/e2e/src/utils/wdioUtils.ts
index 5fd2fcf..5bd2d5b 100644
--- a/test/e2e/src/utils/wdioUtils.ts
+++ b/test/e2e/src/utils/wdioUtils.ts
@@ -17,7 +17,17 @@ class WdioUtils {
await element.waitForClickable();
return element.click(options);
}
-
+
+ /**
+ * Adds value to input an element.
+ */
+ public async addValue(selector: string, value: string): Promise {
+ await allureReporter.addStep(`Add value to an element '${selector}'`);
+ const element = $(selector);
+ await element.waitForExist();
+ await element.waitForEnabled();
+ return element.addValue(value);
+ }
}
export default new WdioUtils();
\ No newline at end of file
diff --git a/test/e2e/src/vscodeComponentsUtils/WebViewUtils.ts b/test/e2e/src/vscodeComponentsUtils/WebViewUtils.ts
index b1ea8a4..00c39f5 100644
--- a/test/e2e/src/vscodeComponentsUtils/WebViewUtils.ts
+++ b/test/e2e/src/vscodeComponentsUtils/WebViewUtils.ts
@@ -3,11 +3,12 @@ import { browser } from "@wdio/globals"
class WebViewUtils {
/**
- * Gets the WebView instance.
+ * Gets the WebView instance by exact title match.
*/
public async getWebView(title: string) {
const workbench = await browser.getWorkbench()
- return browser.waitUntil(() => workbench.getWebviewByTitle(title), {
+ const exactMatch = new RegExp(`^${title}$`);
+ return browser.waitUntil(() => workbench.getWebviewByTitle(exactMatch), {
timeoutMsg: `WebView with title "${title}" not found`,
})
}
diff --git a/test/e2e/src/webViewTabs/HomeScreenViewPage.ts b/test/e2e/src/webViewTabs/HomeScreenViewPage.ts
index 65313c6..ee11c2c 100644
--- a/test/e2e/src/webViewTabs/HomeScreenViewPage.ts
+++ b/test/e2e/src/webViewTabs/HomeScreenViewPage.ts
@@ -1,7 +1,11 @@
+import { $, browser } from '@wdio/globals';
import wdioUtils from '../utils/wdioUtils.js';
import { WebViewTabBase } from './WebViewTabBase.js';
import allureReporter from '@wdio/allure-reporter';
+import { Key } from 'webdriverio'
+
const HOME_SCREEN_BROWSE_LIBRARY_BUTTON_SELECTOR = '//*[@data-testid="hs-browse-library-button"]';
+const SEARCH_INPUT_SELECTOR = '//*[@data-testid="hs-search-input-selector"]';
/**
* Page object for the Home Screen View.
@@ -26,5 +30,20 @@ export class HomeScreenViewPage extends WebViewTabBase {
await this.switchBack();
}
}
-
+
+ /**
+ * Fills the search input with a value and submits the search.
+ * Waits for the input to be displayed (handles view transitions where
+ * the homescreen webview needs time to load and reveal the search field).
+ */
+ public async fillSearchInput(value: string) {
+ await allureReporter.addStep(`Fill search input with value '${value}'`);
+ await this.switchTo();
+ try {
+ await wdioUtils.addValue(SEARCH_INPUT_SELECTOR, value);
+ await browser.keys(Key.Enter);
+ } finally {
+ await this.switchBack();
+ }
+ }
}