Commit 5d6bc3ca authored by Curtis Adam's avatar Curtis Adam

Refactor tests: agreeCookies and setResolution functions

parent 55d2ac28
import {login, agreeCookies, logoutAdmin} from "../helper_functions";
import {login, logoutAdmin} from "../helper_functions";
module.exports = function () {
'use strict';
......@@ -11,7 +11,6 @@ module.exports = function () {
this.Given(/^user is logged in$/, function () {
login("testuser");
agreeCookies();
});
this.Given(/^user is in the back end$/, function () {
......
import {login, agreeCookies, logoutAdmin} from "../helper_functions";
import {login, logoutAdmin} from "../helper_functions";
module.exports = function () {
'use strict';
......@@ -8,7 +9,6 @@ module.exports = function () {
this.Given(/^user is logged in$/, function () {
login("testuser");
agreeCookies();
});
this.Given(/^user is in the back end$/, function () {
......
import {login, logout, agreeCookies, setResolution} from "../helper_functions";
import {login, logout} from "../helper_functions";
module.exports = function () {
'use strict';
......@@ -10,10 +10,7 @@ module.exports = function () {
this.Given(/^He loges in$/, function () {
// Write code here that turns the phrase above into concrete actions
browser.pause(1000);
login("testuser");
agreeCookies();
setResolution();
});
this.Given(/^change to cardset$/, function () {
......
import {login, logout, setResolution, agreeCookies} from "../helper_functions.js";
import {login, logout} from "../helper_functions.js";
module.exports = function () {
'use strict';
......@@ -19,9 +19,6 @@ module.exports = function () {
this.Given(/^User is logged in$/, function () {
login("testuser");
agreeCookies();
setResolution();
browser.windowHandleSize();
});
this.Given(/^User is on the my cardset view$/, function () {
......
import {login, setResolution, agreeCookies} from "../helper_functions";
import {login} from "../helper_functions";
module.exports = function () {
'use strict';
var countBeforeCreated = 0;
......@@ -13,9 +13,6 @@ module.exports = function () {
browser.url('http://localhost:3000');
}
login(arg1);
setResolution();
agreeCookies();
browser.windowHandleSize();
});
this.Given(/^he is on the view of a cardset$/, function () {
browser.waitForVisible('#cardsets',5000);
......
import {login, logout, setResolution, agreeCookies} from "../helper_functions.js";
import {login, logout} from "../helper_functions.js";
module.exports = function () {
'use strict';
......@@ -8,9 +8,6 @@ module.exports = function () {
});
this.Given(/^User is logged in$/, function () {
login("testuser");
agreeCookies();
setResolution();
browser.windowHandleSize();
});
this.Given(/^User is on the my cardset view$/, function () {
browser.waitForVisible('#cardsets',5000);
......
import {login, logout, setResolution, agreeCookies} from "../helper_functions";
import {login, logout} from "../helper_functions";
module.exports = function () {
'use strict';
var sFront,sBack;
......@@ -10,9 +10,6 @@ module.exports = function () {
this.Given(/^User is on the poolview with username "([^"]*)" \(EaC\)$/, function (arg1) {
browser.url('http://localhost:3000');
login(arg1);
setResolution();
agreeCookies();
browser.windowHandleSize();
});
this.Given(/^he is on the view of a cardset \(EaC\)$/, function () {
browser.waitForVisible('#cardsets',5000);
......
import {login, logout, setResolution, agreeCookies} from "../helper_functions.js";
import {login, logout} from "../helper_functions.js";
module.exports = function () {
'use strict';
......@@ -17,9 +17,6 @@ module.exports = function () {
this.Given(/^User is logged in$/, function () {
login("testuser");
agreeCookies();
setResolution();
browser.windowHandleSize();
});
this.Given(/^User is on the my cardset view$/, function () {
......
function agreeCookies() {
browser.waitForExist('a.cc_btn.cc_btn_accept_all', 15000);
browser.setCookie({name: 'cookieconsent_dismissed', value: 'yes'});
browser.click('a.cc_btn.cc_btn_accept_all');
}
function setResolution() {
browser.setViewportSize({
width: 1920,
height: 1080
});
browser.windowHandleSize();
}
/* exported login */
export function login(username) {
browser.waitForExist('#TestingBackdoorUsername',15000);
'use strict';
agreeCookies();
setResolution();
browser.waitForExist('#TestingBackdoorUsername', 15000);
var SetUsername = function (name) {
$('#TestingBackdoorUsername').val(name);
};
browser.execute(SetUsername, username);
browser.waitForExist('#BackdoorLogin',15000);
browser.waitForExist('#BackdoorLogin', 15000);
browser.click('#BackdoorLogin');
}
......@@ -15,13 +32,6 @@ export function logout() {
browser.click('#logout');
}
/* exported agreeCookies */
export function agreeCookies() {
browser.waitForExist('a.cc_btn.cc_btn_accept_all',15000);
browser.setCookie({name: 'cookieconsent_dismissed', value: 'yes'});
browser.click('a.cc_btn.cc_btn_accept_all');
}
/* exported firstLogin */
export function firstLogin(username) {
login(username);
......@@ -30,15 +40,6 @@ export function firstLogin(username) {
browser.click('button[id="accept_button"]');
}
/* exported setResolution */
export function setResolution() {
browser.setViewportSize({
width: 1920,
height: 1080
});
browser.windowHandleSize();
}
/* exported logoutAdmin */
export function logoutAdmin() {
browser.waitForExist('#logout_admin', 15000);
......
import {login, setResolution, agreeCookies} from "../helper_functions.js";
import {login} from "../helper_functions.js";
module.exports = function () {
'use strict';
......@@ -9,9 +9,6 @@ module.exports = function () {
this.Given(/^User is logged in$/, function () {
login("testuser");
agreeCookies();
setResolution();
browser.windowHandleSize();
});
......
import {login, logout, setResolution, agreeCookies} from "../helper_functions.js";
import {login, logout} from "../helper_functions.js";
module.exports = function () {
'use strict';
......@@ -9,9 +9,6 @@ module.exports = function () {
this.Given(/^User is logged in$/, function () {
login("testuser");
agreeCookies();
setResolution();
browser.windowHandleSize();
});
this.Given(/^User is on the pool view$/, function () {
......
import {login, logout, setResolution, agreeCookies} from "../helper_functions";
import {login, logout} from "../helper_functions";
module.exports = function () {
'use strict';
......@@ -17,9 +17,6 @@ module.exports = function () {
browser.url('http://localhost:3000');
if (!isLoggedIn) {
login(username);
agreeCookies();
setResolution();
browser.windowHandleSize();
isLoggedIn = true;
}
});
......
......@@ -57,9 +57,9 @@ for testDir in $searchDir; do
# Run chimp
echo -e $GREEN"Running chimp ..." $NC
if [ $DISPLAY -n ] ; then
xvfb-run --server-args="-screen 0 1920x1080x16" chimp --ddp=http://localhost:3000 --path=$testDir --browser=firefox $1
xvfb-run --server-args="-screen 0 1920x1080x16" chimp --ddp=http://localhost:3000 --path=$testDir $1
else
chimp --ddp=http://localhost:$PORT --path=$testDir --browser=firefox $1
chimp --ddp=http://localhost:$PORT --path=$testDir $1
fi
if [ $? -ne 0 ]; then
failedTests=$((failedTests+1))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment