Skip to content

Instantly share code, notes, and snippets.

@trovster
Created April 14, 2019 10:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trovster/d34af7213904bc91c370e71a6d0d4003 to your computer and use it in GitHub Desktop.
Save trovster/d34af7213904bc91c370e71a6d0d4003 to your computer and use it in GitHub Desktop.
Mocha test for clients.
const assert = require('assert');
const page = require('../../pages/Website/Clients.js');
describe('website clients (as admin)', () => {
before(() => {
page.login();
browser.url(page.url + '/client');
});
it('should see the clients listing screen', () => {
assert.equal(browser.getTitle(), 'Clients — DMW iSite');
assert.equal($('.hero-unit h1 strong').getText(), 'Clients');
});
it('should have an "add client" button', () => {
assert.strictEqual($('a[href$="/client/create"]').isExisting(), true);
assert.equal($('a[href$="/client/create"]').getText(), 'Add Client');
});
});
describe('website clients (as user)', () => {
before(() => {
page.logout();
page.login('user');
browser.url(page.url + '/client');
});
it('should NOT have an "add client" button', () => {
assert.strictEqual($('a[href$="/client/create"]').isExisting(), false);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment