I have a list of string values in a array.
I have to validate above array strings with the present titles are present in the application.
I have tried to validate multiple_Columns
with headerTitlesPresent
but my test case is failing.
can someone please suggest which assertion I should use.
const multiple_Columns = ["apple","banana","pine"]
const headerTitlesPresent = await homePage.header_Titles
expect(await headerTitlesPresent.allTextContents()).toContain(multiple_Columns)
await expect(headerTitlesPresent).toHaveText(multiple_Columns)
You can try my code:
const multiple_Columns = ['apple', 'banana', 'pine']
const headerTitlesPresent: string =
await homePage.header_Titles.innerText()
let matches = 0
multiple_Columns.forEach(function (value) {
if (headerTitlesPresent.includes(value)) {
matches++
}
})
if (matches == multiple_Columns.length) {
// full match
} else {
// not a full match
}