Skip to content

Commit f4127b6

Browse files
committed
Add .not elements integration tests
1 parent e9505e9 commit f4127b6

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

test/matchers.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,24 @@ Received: "not displayed"`)
499499
await expectLib(elements).toBeElementsArrayOfSize(2)
500500
})
501501

502+
test('toBe matchers and toHve matchers work with .not', async () => {
503+
await expectLib(elements).not.toBeDisabled()
504+
await expectLib(elements).not.toHaveText('Some other text')
505+
await expectLib(elements).not.toHaveHTML('<SomeOtherHtml/>')
506+
await expectLib(elements).not.toHaveComputedLabel('Some Other Computed Label')
507+
await expectLib(elements).not.toHaveComputedRole('Some Other Computed Role')
508+
await expectLib(elements).not.toHaveElementProperty('someProperty', 'some other value')
509+
await expectLib(elements).not.toHaveAttribute('someAttribute', 'some other attribute')
510+
await expectLib(elements).not.toHaveAttr('someAttribute', 'some other attribute')
511+
await expectLib(elements).not.toHaveSize({ width: 200, height: 100 })
512+
await expectLib(elements).not.toHaveHeight(100)
513+
await expectLib(elements).not.toHaveWidth(200)
514+
await expectLib(elements).not.toBeElementsArrayOfSize(3)
515+
})
516+
502517
test('toHave works with stringContaining asymmetric matcher', async () => {
503518
await expectLib(elements).toHaveText([expectLib.stringContaining('Valid'), expectLib.stringContaining('Valid')])
519+
await expectLib(elements).not.toHaveText([expectLib.stringContaining('Test'), expectLib.stringContaining('Test')])
504520
})
505521

506522
// TODO to support one day?

types/expect-webdriverio.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ declare namespace ExpectWebdriverIO {
687687

688688
// Number options is the only options that also serves as a expected value container
689689
// This can caused problems with multiple expected values vs global command options
690-
// Potnetial we should have this object as a NumberExpect type and have the options separate
690+
// Potentially we should have this object as a NumberExpect type and have the options separate
691691
interface NumberOptions extends CommandOptions {
692692

693693
/**

0 commit comments

Comments
 (0)