Commit f5fa3b42 authored by Kevin Stroeher's avatar Kevin Stroeher Committed by Curtis Adam

Implement login backdoor for automated testing.

- Implement a backdoor login
- Backdoor user has full access!
- Add sample login
- Define a new loginbutton for backdoor, to activate add:
  '"displayTestingBackdoor": true'
  to the settings.json
parent 6448a237
......@@ -9,7 +9,7 @@ chimp:
dependencies: []
script:
- npm install
- meteor --allow-superuser --no-lint --no-release-check --settings settings.json &
- meteor --allow-superuser --no-lint --no-release-check --settings settings_test.json &
- sleep 150
- chimp --ddp=http://localhost:3000 --path=tests
......
......@@ -66,3 +66,4 @@ mrt:mathjax
facebook-config-ui
google-config-ui
twitter-config-ui
mizzao:accounts-testing
......@@ -99,6 +99,7 @@ meteorspark:util@0.2.0
minifier-css@1.2.16
minifier-js@1.2.18
minimongo@1.0.21
mizzao:accounts-testing@0.1.0
mizzao:timesync@0.4.0
mizzao:user-status@0.6.6
mobile-experience@1.0.4
......
......@@ -30,6 +30,17 @@ ServiceConfiguration.configurations.insert({
Meteor.users.after.insert(function (userId, doc) {
// Setup roles for backdoor login, required for acceptance tests
if (Meteor.settings.public.displayLoginButtons.displayTestingBackdoor)
{
Roles.addUsersToRoles(doc._id, [
'standard',
'university',
'admin',
'firstLogin'
]);
}
if (doc.services.cas) {
if (doc.services.cas.id === Meteor.settings.admin.name) {
Roles.addUsersToRoles(doc._id, [
......
......@@ -39,6 +39,13 @@ Template.welcome.events({
});
},
// Backdoor for login in acceptance tests
'click #BackdoorLogin': function () {
if (Meteor.settings.public.displayLoginButtons.displayTestingBackdoor) {
Meteor.insecureUserLogin(document.getElementById("TestingBackdorUsername").value);
}
},
'click #logout': function () {
Meteor.logout(function (err) {
if (err) {
......@@ -61,4 +68,10 @@ Template.welcome.onRendered(function () {
if (Meteor.settings.public.displayLoginButtons.displayCas) {
$('.panel-footer').append('<a id="cas" href=""><img src="img/social_cas_box_white.png" alt="use CAS for login"/></a>');
}
// Backdoor for login in acceptance tests
if (Meteor.settings.public.displayLoginButtons.displayTestingBackdoor) {
$('.panel-footer').append('<a id="BackdoorLogin" href=""><img src="img/social_backdoor_box_white.png" /></a>');
$('.panel-footer').append('<input id="TestingBackdorUsername" type="text" name="username" placeholder="username"></input>');
}
});
{
"public": {
"rooturl": "http://localhost:3000",
"cas": {
"loginUrl": "https://cas.thm.de/cas/login",
"serviceParam": "service",
"popupWidth": 810,
"popupHeight": 610
},
"displayLoginButtons": {
"displayFacebook": true,
"displayTwitter": true,
"displayGoogle": true,
"displayCas": true,
"displayTestingBackdoor": true
},
"env": "Sandbox",
"BT_MERCHANT_ID": "7jspbjz7zk4vkh67",
"BT_PUBLIC_KEY": "bf7p9crbdv2359gv"
},
"private": {
"BT_PRIVATE_KEY": "b508f71a0e0b01940b0fbe75940debb9"
},
"admin": {
"name": "hg13345"
},
"facebook": {
"api": "162760697401847",
"secret": "151daa9c4bc95310e9e1fb90accd70f8"
},
"twitter": {
"api": "I8LcQC0NetusL9c5F3EFJUXMl",
"secret": "2z0kNAtYcSU5lQKk6FDRR60gxuFawB4TM7tWvnU7yKk6EHHpYh"
},
"google": {
"api": "131328643116-j00jrgjupbbfeft1a9o0p5ling05vsus.apps.googleusercontent.com",
"secret": "2-P5Vy6VI0eOrKIlOCZZq8cR"
},
"cas": {
"baseUrl": "https://cas.thm.de/cas",
"autoClose": true
}
}
Feature: Login with OAuth providers
As a visitor, I need to login into the site.
Background:
Given I am on the site
@watch
Scenario: Visitor can login
And submit the login form
Then it should see the AGB
# tests/features/login.feature
module.exports = function () {
'use strict';
this.Given(/^I am on the site$/, function () {
// Write code here that turns the phrase above into concrete actions
browser.url('http://localhost:3000');
});
this.Given(/^submit the login form$/, function () {
// Write code here that turns the phrase above into concrete actions
var SetUsername = function (name) {
$('#TestingBackdorUsername').val(name);
};
client.execute(SetUsername, "Karl Heinz2");
browser.click('a[id="BackdoorLogin"]');
browser.click('a[id="BackdoorLogin"]');
});
this.Then(/^it should see the AGB$/, function () {
// Write code here that turns the phrase above into concrete actions
browser.waitForExist('#first_login_content');
});
};
// tests/features/login_steps.js
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