Skip to content

Commit

Permalink
feat: add bstack demo example (#3405)
Browse files Browse the repository at this point in the history
  • Loading branch information
vaibhavsingh97 committed Apr 12, 2023
1 parent 3901dca commit 2bb54d3
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
23 changes: 23 additions & 0 deletions examples/tests/bstackdemo/auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
describe('Authentication Tests', function () {
beforeEach((browser) => browser.navigateTo('https://www.bstackdemo.com'));

it('Login test', function () {
browser
.click('#signin')
.setValue('#username input', ['demouser', browser.Keys.ENTER])
.setValue('#password input', ['testingisfun99', browser.Keys.ENTER])
.click('#login-btn')
.assert.textEquals('.username', 'demouser', 'demouser had logged in successfuly.');
});

it('Locked account test', function () {
browser
.click('#signin')
.setValue('#username input', ['locked_user', browser.Keys.ENTER])
.setValue('#password input', ['testingisfun99', browser.Keys.ENTER])
.click('#login-btn')
.assert.textContains('.api-error', 'Your account has been locked.');
});

afterEach((browser) => browser.end());
});
33 changes: 33 additions & 0 deletions examples/tests/bstackdemo/checkout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
describe('Checkout Test', function () {
before((browser) => browser.navigateTo('https://www.bstackdemo.com/'));

it('checkout products on bstackdemo.com', function (browser) {
browser
.waitForElementVisible('body')
.assert.titleContains('StackDemo')
// Filter Google from the avaialble filters
.click('input[value=\'Google\'] + span')
.assert.selected('input[value=\'Google\']')
// Add different phones to cart
.click('[id="17"] .shelf-item__buy-btn')
.click('[id="18"] .shelf-item__buy-btn')
.assert.elementsCount('.float-cart__shelf-container .shelf-item', 2)
// Click checkout
.click('.buy-btn')
// Loging with given credentials
.setValue('#username input', ['demouser', browser.Keys.ENTER])
.setValue('#password input', ['testingisfun99', browser.Keys.ENTER])
.click('#login-btn')
// Fill shipping details
.setValue('#firstNameInput', 'John')
.setValue('#lastNameInput', 'Doe')
.setValue('#addressLine1Input', 'localhost')
.setValue('#provinceInput', 'local')
.setValue('#postCodeInput', '127001')
.click('#checkout-shipping-continue')
// Check order successfully placed
.assert.textEquals('#confirmation-message', 'Your Order has been successfully placed.');
});

after((browser) => browser.end());
});

0 comments on commit 2bb54d3

Please sign in to comment.