[CORD-1133] E2E GUI Tests
Change-Id: I521d0cc068a3e328f3d4f421ba4b342bea167e19
diff --git a/e2e/login/login.po.js b/e2e/login/login.po.js
new file mode 100644
index 0000000..52c2b3c
--- /dev/null
+++ b/e2e/login/login.po.js
@@ -0,0 +1,18 @@
+module.exports = new function(){
+
+ const usernameField = element(by.model('username'));
+ const passwordField = element(by.model('password'));
+ const submitBtn = element(by.css('.btn.btn-accent'));
+
+ this.sendUsername = (username) => {
+ usernameField.sendKeys(username);
+ };
+
+ this.sendPassword = (pwd) => {
+ passwordField.sendKeys(pwd);
+ };
+
+ this.submit = () => {
+ submitBtn.click();
+ }
+};
diff --git a/e2e/login/login.spec.js b/e2e/login/login.spec.js
new file mode 100644
index 0000000..cab3b15
--- /dev/null
+++ b/e2e/login/login.spec.js
@@ -0,0 +1,29 @@
+const config = require('../test_helpers/config');
+const user = require('../test_helpers/user');
+const pwd = user.pwd;
+const username = user.username;
+const loginPage = require('./login.po');
+
+describe('XOS Login page', function() {
+
+ beforeEach(() => {
+ browser.get(`${config.url}/login`);
+ });
+
+ it('should not login with a wrong password', function() {
+ loginPage.sendUsername(username);
+ loginPage.sendPassword('wrongpwd');
+ loginPage.submit();
+
+ const alert = element(by.css('.alert.alert-danger'));
+ expect(alert.isDisplayed()).toBeTruthy();
+ });
+
+ it('should login', () => {
+ loginPage.sendUsername(username);
+ loginPage.sendPassword(pwd);
+ loginPage.submit();
+
+ expect(browser.getCurrentUrl()).toEqual(`${config.url}/dashboard`);
+ });
+});
\ No newline at end of file