You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm new with chai, and I was following a tutorial; now of course all the tutorials does not work fine with v5, but I managed to let my super-base test work, using expect:
import { Builder, By, Key } from 'selenium-webdriver'
import { assert, expect, should } from 'chai'
async function example() {
// launch the browser
let driver = await new Builder().forBrowser('chrome').build()
// navigate to app
await driver.get('https://lambdatest.github.io/sample-todo-app/')
// add a todo
await driver.findElement(By.id('sampletodotext')).sendKeys('learn selenium', Key.RETURN)
// assert
let todoText = await driver.findElement(By.xpath('//li[last()]')).getText() // contains 'learn selenium'
assert.strictEqual(todoText, 'learn selenium') // works
todoText.should.equal('learn selenium') // DOES NOT WORK
// close the browser
await driver.quit()
}
example()
Now the should keyword in import is grayed out (value declared but never read), and the expression with should throws an error
TypeError: Cannot read properties of undefined (reading 'equal')
So, how can I manage to work this?
And more generally, is there a place with the new documentation for v5? nothing seems to work from the old one for a beginner...
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm new with chai, and I was following a tutorial; now of course all the tutorials does not work fine with v5, but I managed to let my super-base test work, using expect:
package.json
testfile.js
Now the
should
keyword in import is grayed out (value declared but never read), and the expression with should throws an errorSo, how can I manage to work this?
And more generally, is there a place with the new documentation for v5? nothing seems to work from the old one for a beginner...
Maybe because I'm just a beginner, ok, but...
Beta Was this translation helpful? Give feedback.
All reactions