- Selectors in WebdriverIO
- Building and testing selectors via Chrome Dev Tools
- WebdriverIO Command API Page
Add a new test case for validating that the 'See our Vast Robot Selection' button works
it('should have a product page call-to-action', function () {
})
Use `click` to click the button and navigate to the product page
it('should have a product page call-to-action', function () {
browser.click('a=See our Vast Robot Selection');
})
Assert that you're now on the product page
var url = browser.getUrl();
expect(url).to.contain('product-page.html');
Create a new file to validate the product page, including the proper `describe` and `beforeEach` functions.
var expect = require('chai').expect;
describe('Product Page', function () {
beforeEach(function () {
browser.url('product-page.html');
})
})
Create a new test case for purchasing a robot
it('should allow you to purchase a robot', function () {
})
Use `setValue` and `click` to buy a robot
it('should allow you to purchase a robot', function () {
browser.setValue('#qty', '5');
browser.click('#buyNowButton');
})
Confirm the button text changes using `getText`
var buttonText = browser.getText('#buyNowButton');
expect(buttonText).to.equal('Purchasing...');