Skip to content

Commit bbf1788

Browse files
committed
Keep useful changes
1 parent 32de2ca commit bbf1788

25 files changed

Lines changed: 994 additions & 231 deletions

test/__fixtures__/utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ export function matcherNameToString(matcherName: string) {
22
return matcherName.replace(/([A-Z])/g, ' $1').toLowerCase()
33
}
44

5+
export function matcherLastWordName(matcherName: string) {
6+
return matcherName.replace(/^toHave/, '').replace(/^toBe/, '')
7+
.replace(/([A-Z])/g, ' $1').trim().toLowerCase()
8+
}
9+
510
export function getExpectMessage(msg: string) {
611
return msg.split('\n')[0]
712
}

test/__mocks__/@wdio/globals.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const getElementMethods = () => ({
1515
isClickable: vi.spyOn({ isClickable: async () => true }, 'isClickable'),
1616
isFocused: vi.spyOn({ isFocused: async () => true }, 'isFocused'),
1717
isEnabled: vi.spyOn({ isEnabled: async () => true }, 'isEnabled'),
18-
getProperty: vi.spyOn({ getProperty: async (_prop: string) => undefined }, 'getProperty'),
18+
getProperty: vi.spyOn({ getProperty: async (_prop: string) => '1' }, 'getProperty'),
1919
getText: vi.spyOn({ getText: async () => ' Valid Text ' }, 'getText'),
2020
getHTML: vi.spyOn({ getHTML: async () => { return '<Html/>' } }, 'getHTML'),
2121
getComputedLabel: vi.spyOn({ getComputedLabel: async () => 'Computed Label' }, 'getComputedLabel'),
@@ -25,6 +25,7 @@ const getElementMethods = () => ({
2525
if (prop === 'height') { return 50 }
2626
return { width: 100, height: 50 } satisfies Size
2727
} }, 'getSize') as unknown as WebdriverIO.Element['getSize'],
28+
getAttribute: vi.spyOn({ getAttribute: async (_attr: string) => 'some attribute' }, 'getAttribute'),
2829
} satisfies Partial<WebdriverIO.Element>)
2930

3031
function $(_selector: string) {

0 commit comments

Comments
 (0)