0

How do I assert .containsText with case insensitive in Nightwatch.js? For example I search for 'odin sphere' on google. There are a lot of possibilities for the search result, like 'Odin Sphere' 'odin sphere' 'ODIN SPHERE' etc etc I would like to assert with just 'odin sphere'. Here's the code I wrote.

module.exports = {
    beforeEach: browser => {
        browser.url('https://www.google.com/')
    },
    after: browser => {
        browser.end()
    },
    'Search test': browser => {
        browser
            .setValue('input[name="q"]',['odin sphere',browser.Keys.ENTER])
            .waitForElementVisible('#res')
            .pause(5000)
            .verify.containsText('#res','Odin Sphere')
    }

}```

Thanks in advance!
Chetan Joshi
  • 5,582
  • 4
  • 30
  • 43
Evelyn
  • 1

1 Answers1

-1

https://nightwatchjs.org/api/#assert-containsText

Usage:

this.demoTest = function (browser) {
  browser.assert.containsText("#main", "The Night Watch");
};
Maxim
  • 16
  • 2