diff --git a/res/test/e2e/stfAppE2E-spec.js b/res/test/e2e/stfAppE2E-spec.js index 1e600ac8..00147b64 100644 --- a/res/test/e2e/stfAppE2E-spec.js +++ b/res/test/e2e/stfAppE2E-spec.js @@ -1,71 +1,39 @@ describe('STF App', function () { - var LoginPage = function () { - this.get = function () { - return browser.get('http://localhost:7120/') - } - this.name = element(by.model('name')) - this.email = element(by.model('email')) - this.setName = function (name) { - return this.name.sendKeys(name) - } - this.setEmail = function (email) { - return this.email.sendKeys(email) - } - this.setPassword = function (password) { - return this.password.sendKeys(password) - } - this.submit = function () { - return this.name.submit() - } - this.login = function () { - this.get() - this.setName('test_user') - this.setEmail('test_user@login.local') - return this.submit() - } + var config = { + baseUrl: 'http://localhost:7100/#!', + loginBaseUrl: 'http://localhost:7120' } - var Common = { - login: function () { - - } - } - - describe('Device List', function () { - var DeviceListPage = function () { + describe('Login Page', function () { + var LoginPage = function () { this.get = function () { - // TODO: Let's get rid off the login first - browser.get('http://localhost:7100/devices') + return browser.get(config.loginBaseUrl) + } + this.name = element(by.model('name')) + this.email = element(by.model('email')) + this.setName = function (name) { + return this.name.sendKeys(name) + } + this.setEmail = function (email) { + return this.email.sendKeys(email) + } + this.setPassword = function (password) { + return this.password.sendKeys(password) + } + this.submit = function () { + return this.name.submit() + } + this.login = function () { + this.get() + this.setName('test_user') + this.setEmail('test_user@login.local') + return this.submit() } - this.rootClass = $$('.stf-device-list') - this.devices = element(by.model('tracker.devices')) - this.devicesRepeated = element.all(by.repeater('device in tracker.devices')) } - var deviceListPage = new DeviceListPage() - - it('should show a list of devices', function () { - var loginPage = new LoginPage() - loginPage.login() - - deviceListPage.get() - - //console.log(deviceListPage.rootClass.isPresent()) - - - expect(true).toEqual(true) - }) - - it('should filter out all the devices', function () { - - - }) - }) - - describe('Login', function () { var loginPage = new LoginPage() - it('should login', function () { + it('should login with auth-mock', function () { loginPage.get() loginPage.setName('test_user') @@ -73,37 +41,58 @@ describe('STF App', function () { loginPage.submit().then(function () { browser.getLocationAbsUrl().then(function (newUrl) { - expect(newUrl).toBe('http://localhost:7100/#!/') + expect(newUrl).toBe(config.baseUrl + '/devices') }) }) }) - it('should show the login page', function () { + }) + + describe('Device List Page', function () { + var DeviceListPage = function () { + this.get = function () { + // TODO: Let's get rid off the login first + browser.get(config.baseUrl + '/devices') + } + this.rootClass = $$('.stf-device-list') + this.devices = element(by.model('tracker.devices')) + this.devicesRepeated = element.all( + by.repeater('device in tracker.devices')) + } + + var deviceListPage = new DeviceListPage() + + it('should show a list of devices', function () { +// console.log(deviceListPage.devices) +// expect(deviceListPage.devices.isPresent()).toBe(true) + }) + + it('should filter out all the devices', function () { }) }) - describe('Control', function () { + describe('Control Page', function () { var DeviceListPage = function () { this.get = function () { - browser.get('http://localhost:7100/') + browser.get(config.baseUrl + '/control') } } }) - describe('Settings', function () { + describe('Settings Page', function () { var SettingsPage = function () { this.get = function () { - browser.get('http://localhost:7100/#!/settings') + browser.get(config.baseUrl + '/settings') } } }) - describe('Help', function () { + describe('Help Page', function () { var HelpPage = function () { this.get = function () { - browser.get('http://localhost:7100/#!/help') + browser.get(config.baseUrl + '/help') } }