Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions jasmine.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/// <reference types="expect-webdriverio/types/expect-webdriverio"/>
/// <reference types="./types/expect-webdriverio.d.ts"/>

declare namespace jasmine {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface AsyncMatchers<T, U> extends ExpectWebdriverIO.Matchers<Promise<void>, T> {}
interface AsyncMatchers<T, _U> extends ExpectWebdriverIO.Matchers<Promise<void>, T> {}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@
"clean:build": "rimraf ./lib",
"clean:tests": "rimraf test-types/**/node_modules && rimraf test-types/**/dist",
"compile": "tsc --build tsconfig.build.json",
"tsc:root-types": "tsc jasmine.d.ts jest.d.ts",
"test": "run-s test:*",
"test:lint": "eslint .",
"test:unit": "vitest --run",
"test:types": "node test-types/copy && npm run ts && npm run clean:tests",
"test:types": "node test-types/copy && npm run ts && npm run clean:tests && npm run tsc:root-types",
"ts": "run-s ts:*",
"ts:default": "cd test-types/default && tsc -p ./tsconfig.json --incremental",
"ts:jest": "cd test-types/jest && tsc -p ./tsconfig.json --incremental",
Expand Down
6 changes: 3 additions & 3 deletions src/matchers/element/toHaveAttribute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async function conditionAttrAndValue(el: WebdriverIO.Element, attribute: string,
return compareText(attr, value, options)
}

export async function toHaveAttributeAndValue(received: ChainablePromiseElement, attribute: string, value: string | RegExp | ExpectWebdriverIO.PartialMatcher, options: ExpectWebdriverIO.StringOptions = DEFAULT_OPTIONS) {
export async function toHaveAttributeAndValue(received: WdioElementMaybePromise, attribute: string, value: string | RegExp | ExpectWebdriverIO.PartialMatcher, options: ExpectWebdriverIO.StringOptions = DEFAULT_OPTIONS) {
const isNot = this.isNot
const { expectation = 'attribute', verb = 'have' } = this

Expand All @@ -49,11 +49,11 @@ export async function toHaveAttributeAndValue(received: ChainablePromiseElement,
} as ExpectWebdriverIO.AssertionResult
}

async function toHaveAttributeFn(received: ChainablePromiseElement | WebdriverIO.Element, attribute: string) {
async function toHaveAttributeFn(received: WdioElementMaybePromise, attribute: string) {
const isNot = this.isNot
const { expectation = 'attribute', verb = 'have' } = this

let el = await received
let el = await received?.getElement()

const pass = await waitUntil(async () => {
const result = await executeCommand.call(this, el, conditionAttr, {}, [attribute])
Expand Down
4 changes: 2 additions & 2 deletions types/standalone.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// <reference types="./expect-webdriverio.js"/>

type ChainablePromiseElement = import('webdriverio').ChainablePromiseElement<WebdriverIO.Element>
type ChainablePromiseArray = import('webdriverio').ChainablePromiseArray<WebdriverIO.Element>
type ChainablePromiseElement = import('webdriverio').ChainablePromiseElement
type ChainablePromiseArray = import('webdriverio').ChainablePromiseArray

declare namespace ExpectWebdriverIO {
interface Matchers<R extends void | Promise<void>, T> extends Readonly<import('expect').Matchers<R>> {
Expand Down