Skip to content

Commit

Permalink
test(e2e): use chainable promises in settings.spec.ts
Browse files Browse the repository at this point in the history
Signed-off-by: Zacharias Fragkiadakis <zacfragkiadakis@gmail.com>
  • Loading branch information
QZera committed Dec 28, 2024
1 parent db62e8e commit 0cecdcf
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions test/e2e/specs/settings.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { browser } from '@wdio/globals'
import type { Setting, SettingsEditor, Workbench } from 'wdio-vscode-service'
import isEqual from 'lodash/isEqual'
import { Key } from 'webdriverio'
import { type ChainablePromiseElement, Key } from 'webdriverio'
import { $ } from 'zx'
import { getFirstWelcomeViewText } from '../helpers/queries'
import { expectCliCommandsAndPatchesToBeVisible } from '../helpers/assertions'
Expand Down Expand Up @@ -106,16 +106,16 @@ async function expectRadBinaryNotFoundToBeVisible(workbench: Workbench) {
)
}

async function getTextSettingInput(setting: Setting) {
return (await setting.textSetting$) as WebdriverIO.Element
function getTextSettingInput(setting: Setting) {
return setting.textSetting$ as ChainablePromiseElement
}

/**
* Workaround to get the value of a `TextSetting`.
* The `getValue` method of a `TextSetting` seems to be wrongly implemented and returns null.
*/
async function getTextSettingValue(setting: Setting) {
return await (await getTextSettingInput(setting)).getValue()
return await getTextSettingInput(setting).getValue()
}

async function setTextSettingValue(setting: Setting, value: string) {
Expand All @@ -135,8 +135,7 @@ async function clearTextSetting(setting: Setting) {
return
}

const input = await getTextSettingInput(setting)
await input.click()
await getTextSettingInput(setting).click()
await browser.keys([Key.Ctrl, 'a'])
await browser.keys(Key.Backspace)
}

0 comments on commit 0cecdcf

Please sign in to comment.