diff --git a/tests/e2e/src/page-objects/components/tree-view/TreeView.ts b/tests/e2e/src/page-objects/components/tree-view/TreeView.ts index 8b7ab636..fb9c1b72 100644 --- a/tests/e2e/src/page-objects/components/tree-view/TreeView.ts +++ b/tests/e2e/src/page-objects/components/tree-view/TreeView.ts @@ -23,7 +23,9 @@ export class TreeView extends WebView { sortKeysBtn = By.xpath(`//vscode-button[@data-testid='sort-keys']`) addDatabaseBtn = By.xpath(`//a[@aria-label='Add Redis database']`) editDatabaseBtn = By.xpath(`//vscode-button[@data-testid='edit-database']`) - settingsButton = By.xpath(`//a[@aria-label='Open Redis for VS Code settings']`) + settingsButton = By.xpath( + `//a[@aria-label='Open Redis for VS Code settings']`, + ) deleteKeyInListBtn = By.xpath( `//vscode-button[starts-with(@data-testid, 'remove-key-')]`, ) @@ -53,7 +55,9 @@ export class TreeView extends WebView { treeViewVirtualTable = By.xpath(`//*[@data-testid='virtual-tree']/div`) databaseInstance = By.xpath(`//div[starts-with(@data-testid, 'database-')]`) keyInFolder = By.xpath(`//*[contains(@data-testid, "keys:")]`) - addKeyFromTreeBtn = By.xpath(`//vscode-button[@data-testid='add-key-from-tree']`) + addKeyFromTreeBtn = By.xpath( + `//vscode-button[@data-testid='add-key-from-tree']`, + ) // mask keyMask = '//*[@data-testid="key-$name"]' @@ -88,17 +92,25 @@ export class TreeView extends WebView { By.xpath( `.//div[starts-with(@data-testid, 'database-')][.//*[text()='${name}']]/div`, ) + getDatabaseContainerByName = (name: string): Locator => + By.xpath( + `.//div[starts-with(@data-testid, 'database-')][.//*[text()='${name}']]/../..`, + ) + getLogicalDatabaseContainerByIndex = (name: string, index: number): Locator => + By.xpath( + `(.//div[starts-with(@data-testid, 'database-')][.//*[text()='${name}']]/../../div[starts-with(@data-testid, 'logical-database-')])[${index - 1}]`, + ) getEditDatabaseBtnByName = (name: string): Locator => By.xpath( `.//div[starts-with(@data-testid, 'database-')][.//*[text()='${name}']]/..//vscode-button[@data-testid='edit-database']`, ) getRefreshDatabaseBtnByName = (name: string): Locator => By.xpath( - `.//div[starts-with(@data-testid, 'database-')][.//*[text()='${name}']]/..//vscode-button[@data-testid = 'refresh-keys']`, + `.//div[starts-with(@data-testid, 'database-')][.//*[text()='${name}']]/../..//button[@data-testid = 'refresh-keys-refresh-btn']`, ) getCLIDatabaseBtnByName = (name: string): Locator => By.xpath( - `.//div[starts-with(@data-testid, 'database-')][.//*[text()='${name}']]/..//vscode-button[@data-testid = 'terminal-button']`, + `.//div[starts-with(@data-testid, 'database-')][.//*[text()='${name}']]/../..//vscode-button[@data-testid = 'terminal-button']`, ) getKeySelectorByName = (name: string): Locator => By.xpath(`//*[@data-testid="key-${name}"]`)