Commit 82adc5a7 authored by Curtis Adam's avatar Curtis Adam

Update chimp tests

parent f53bc40a
Feature: Delete a cardset in the back end
As an admin,
so that the cardset is not in the system anymore,
the users wants to delete it in the backend.
Background:
Given user is logged in
And user is in the back end
@watch
Scenario: Admin deletes cardset
When user goes to the menu item cardsets
And user clicks on the delete button
Then the cardset should not be in the list anymore
import * as global from "../../features_helper/global.js";
import * as navigation from "../../features_helper/navigation.js";
module.exports = function () {
'use strict';
let numberOfCardsets;
this.Given(/^user is logged in$/, function () {
navigation.login("editorLogin");
});
this.Given(/^user is in the back end$/, function () {
navigation.switchToBackEnd(true);
});
this.When(/^user goes to the menu item cardsets$/, function () {
navigation.backendCardset(true);
});
this.When(/^user clicks on the delete button$/, function () {
browser.waitForExist('.delete', global.threshold);
numberOfCardsets = browser.elements(".delete").value.length;
navigation.clickElement(".deleteCardsetAdmin");
navigation.clickElement("#cardetDeleteAdmin");
});
this.Then(/^the cardset should not be in the list anymore$/, function () {
browser.waitForVisible("#cardsetConfirmModalAdmin", global.threshold, true);
browser.waitForVisible('.delete');
navigation.compareContent(".delete", --numberOfCardsets, 1);
navigation.logoutAdmin();
});
};
Feature: Create college and course
As an admin,
so that a cardset can assigned to a college and course,
The user wants to create a college and course.
Background:
Given user is logged in
And user is in the back end
@watch
Scenario: Admin creates college and course
When user goes to the menu item college
And user creates a new college and course
Then user should see the college and course in list
import * as navigation from "../../features_helper/navigation.js";
module.exports = function () {
'use strict';
this.Given(/^user is logged in$/, function () {
navigation.login("editorLogin");
});
this.Given(/^user is in the back end$/, function () {
navigation.switchToBackEnd(true);
});
this.When(/^user goes to the menu item college$/, function () {
navigation.backendCollege(true);
});
this.When(/^user creates a new college and course$/, function () {
navigation.setContent('#college', 'Zulu-Universität');
navigation.setContent('#courseOfStudies', 'Z-Kurs');
navigation.clickElement('#insertButton');
});
this.Then(/^user should see the college and course in list$/, function () {
navigation.compareContent('.tblCollege-80', 'Zulu-Universität', 0);
navigation.compareContent('.tblCourse-80', 'Z-Kurs', 0);
navigation.logoutAdmin();
});
};
Feature: Change view in cardset/carslist
As a visitor, I whould change the view in cardset to cardlist and reverse.
Background:
Given user is logged in
@watch
Scenario: Visitor can view the cardset
When change to cardset
Then they change the view to cardlist
Then they change the view back to cardset
And they log out
# tests/features/login.feature
import * as cardset from "../../features_helper/cardset.js";
import * as navigation from "../../features_helper/navigation.js";
module.exports = function () {
'use strict';
this.Given(/^user is logged in$/, function () {
navigation.login("standardLogin");
});
this.When(/^change to cardset$/, function () {
navigation.selectMyCardset();
navigation.selectCardsetLink(8);
});
this.Then(/^they are on the cardset$/, function () {
cardset.collapseCardsetInfo(false);
});
this.Then(/^they change the view to cardlist$/, function () {
cardset.cardList(true);
});
this.Then(/^they change the view back to cardset$/, function () {
cardset.cardDetail(true);
});
this.Then(/^they log out$/, function () {
navigation.logout();
});
};
......@@ -14,10 +14,5 @@ Scenario: User creates a new deck of cards
Then he is redirected to the new cardset form
Then he should be able to edit the cardset title
And he should be able to edit the cardset description
And he should be able to edit the module name
And he should be able to edit the module initials
And he should be able to edit the module ID
And he should be able to choose a college
And he should be able to choose a course
And he should push the create new cardset button
And he should see the details of that cardset with the correct values
......@@ -5,11 +5,6 @@ module.exports = function () {
let title = "CardTitle";
let description = "description";
let module = "module";
let moduleInitials = "short";
let moduleID = "42";
let college = "Zulu-Universität";
let course = "Z-Studiengang";
this.Given(/^User is logged in$/, function () {
navigation.login("standardLogin");
......@@ -25,7 +20,6 @@ module.exports = function () {
this.Then(/^he is redirected to the new cardset form$/, function () {
navigation.contentVisible('#setCardsetCourseIterationFormModalTitle');
navigation.clickElement('#enableModule');
});
this.Then(/^he should be able to edit the cardset title$/, function () {
......@@ -33,29 +27,7 @@ module.exports = function () {
});
this.Then(/^he should be able to edit the cardset description$/, function () {
navigation.setContent('#setDescription', description);
});
this.Then(/^he should be able to edit the module name$/, function () {
navigation.setContent('#setModule', module);
});
this.Then(/^he should be able to edit the module initials$/, function () {
navigation.setContent('#setModuleShort', moduleInitials);
});
this.Then(/^he should be able to edit the module ID$/, function () {
navigation.setContent('#setModuleNum', moduleID);
});
this.Then(/^he should be able to choose a college$/, function () {
navigation.clickElement('#setCollege');
navigation.clickElement('li[data="' + college + '"] a');
});
this.Then(/^he should be able to choose a course$/, function () {
navigation.clickElement('#setCourse');
navigation.clickElement('li[data="' + course + '"] a');
navigation.setContent('#contentEditor', description);
});
this.Then(/^he should push the create new cardset button$/, function () {
......@@ -65,12 +37,9 @@ module.exports = function () {
this.Then(/^he should see the details of that cardset with the correct values$/, function () {
navigation.clickElement('#editCardset');
navigation.compareContent('#setName', title, 2, 'value');
navigation.compareContent('#setDescription', description, 2, 'value');
navigation.compareContent('#setModule', module, 2, 'value');
navigation.compareContent('#setModuleShort', moduleInitials, 2, 'value');
navigation.compareContent('#setModuleNum', moduleID, 2, 'value');
navigation.compareContent('#contentEditor', description, 2, 'value');
navigation.clickElement('#cardSetCancel');
navigation.contentVisible('#setName', false);
navigation.waitForModalBackdrop();
navigation.logout();
});
};
......@@ -8,14 +8,7 @@ Feature: Create a new Card
And he is redirected to the --New card-- view
And he enters a text for the subject of the card
And he enters a text for the front of the card
And he enters a text for the back of the card
And he press on the save button
Then he should be redirected to his own cardsets view back again
And the card should be saved
Scenario: Cancel card creation
When the user clicks on the --create a new card-- button
And he is redirected to the --New card-- view
Then he can press on the --Cancel-- button
Then he should be redirected back
And they log out
\ No newline at end of file
......@@ -36,10 +36,6 @@ module.exports = function () {
this.When(/^he enters a text for the front of the card$/, function () {
navigation.setContent('#contentEditor', 'FRONTOFTHECARD');
});
this.When(/^he enters a text for the back of the card$/, function () {
navigation.clickElement('#editBack');
navigation.setContent('#contentEditor', 'BACKOFTHECARD');
});
this.When(/^he press on the save button$/, function () {
cardset.saveCardReturn();
});
......@@ -51,17 +47,6 @@ module.exports = function () {
navigation.clickElement("#leftCarouselControl");
navigation.compareContent(".detailfront" + countBeforeCreated, "FRONTOFTHECARD", 0);
});
/**
* ---------------------------------------------------------------------
* Cancel card creation
* ---------------------------------------------------------------------
*/
this.Then(/^he can press on the \-\-Cancel\-\- button$/, function () {
cardset.cancelCardEdit();
});
this.Then(/^he should be redirected back$/, function () {
navigation.compareUrl(url, browser.getUrl());
});
this.Then(/^they log out$/, function () {
navigation.logout();
});
......
Feature: Delete all Cards
As a user on the site,
I want to delete all cards from a cardset
so that nothing is left
Background:
Given User is logged in
And I am on my own cardset
@watch
Scenario: User wants to delete all cards
When I press the delete all cards button
Then I get a pop-up with a warning message
And I press the "Cancel" button
Then I'm back on my cardset
And I click the delete all cards button again
Then I get a pop-up with a warning message again
And I press "Delete all cards" button
Then I've deleted all cards
import * as cardset from "../../features_helper/cardset.js";
import * as global from "../../features_helper/global.js";
import * as navigation from "../../features_helper/navigation.js";
module.exports = function () {
'use strict';
this.Given(/^User is logged in$/, function () {
navigation.login("standardLogin");
});
this.Given(/^I am on my own cardset$/, function () {
navigation.selectMyCardset();
navigation.selectCardsetLink(1);
});
this.When(/^I press the delete all cards button$/, function () {
cardset.deleteAllCards(true);
});
this.Then(/^I get a pop-up with a warning message$/, function () {
cardset.deleteAllCardsConfirm(false);
});
this.Then(/^I press the "Cancel" button$/, function () {
cardset.deleteAllCardsCancel(true);
});
this.Then(/^I'm back on my cardset$/, function () {
browser.waitForVisible(".cardNumber",global.threshold);
});
this.Then(/^I click the delete all cards button again$/, function () {
cardset.deleteAllCards(true);
});
this.Then(/^I get a pop-up with a warning message again$/, function () {
cardset.deleteAllCardsConfirm(false);
});
this.Then(/^I press "Delete all cards" button$/, function () {
cardset.deleteAllCardsConfirm(true);
});
this.Then(/^I've deleted all cards$/, function () {
browser.waitForVisible(".emptyCard",global.threshold);
navigation.logout();
});
};
Feature: Delete a deck of cards
As a user of the site,
so that I can have more room for decks of cards,
I want to delete a deck of card
Background:
Given User is logged in
And User is on the my cardset view
@watch
Scenario: User deletes a owned deck of cards
When User clicks on a cardset that he owns
Then he is shown the details of the cardset
And he should push the edit cardset button
And he should see the edit cardset form
And he should be able to press the delete cardset button
And he should be able to press the delete cardset button again to be sure
And he should be returned to the my cardset view
And he should not see the deleted cardset there
import * as global from "../../features_helper/global.js";
import * as navigation from "../../features_helper/navigation.js";
module.exports = function () {
'use strict';
let oldCardsetCount = 0;
this.Given(/^User is logged in$/, function () {
navigation.login("standardLogin");
});
this.Given(/^User is on the my cardset view$/, function () {
navigation.selectMyCardset();
oldCardsetCount = navigation.getContent('.resultItem', 1);
navigation.contentVisible('#newCardSet');
});
this.When(/^User clicks on a cardset that he owns$/, function () {
navigation.selectCardsetLink(1);
});
this.Then(/^he is shown the details of the cardset$/, function () {
navigation.contentVisible('#editCardset');
});
this.Then(/^he should push the edit cardset button$/, function () {
navigation.clickElement('#editCardset');
});
this.Then(/^he should see the edit cardset form$/, function () {
navigation.contentVisible('#setName');
});
this.Then(/^he should be able to press the delete cardset button$/, function () {
navigation.clickElement('#cardSetDelete');
});
this.Then(/^he should be able to press the delete cardset button again to be sure$/, function () {
navigation.clickElement('#cardSetConfirm');
});
this.Then(/^he should be returned to the my cardset view$/, function () {
navigation.selectMyCardset();
navigation.checkUrl(global.createRoute);
});
this.Then(/^he should not see the deleted cardset there$/, function () {
navigation.compareContent('.resultItem', --oldCardsetCount, 1);
navigation.logout();
});
};
Feature: Edit a card and delete it
A user to the site wants to be able to edit and delete a card in his cardset
Background:
Given User is logged in
And he is on the view of a cardset (EaC)
Scenario: Edit card
When the user clicks on the edit button of the first card
And he enters "EDITFRONT1" for the front of the card (EaC)
And he enters a "EDITBACK1" for the back of the card (EaC)
And he press on the save button (EaC)
And he should be redirected to his own cardsets view back again (EaC)
And the front of the card should be "EDITFRONT1"
And he wants to undo previous changes
And he should be redirected to his own cardsets view once again (EaC)
And he wants to delete the card
And he logs out
\ No newline at end of file
import * as cardset from "../../features_helper/cardset.js";
import * as navigation from "../../features_helper/navigation.js";
module.exports = function () {
'use strict';
var sFront,sBack, url;
/**
* ---------------------------------------------------------------------
* Background
* ---------------------------------------------------------------------
*/
this.Given(/^User is logged in$/, function () {
navigation.login("standardLogin");
});
this.Given(/^he is on the view of a cardset \(EaC\)$/, function () {
navigation.selectMyCardset();
navigation.selectCardsetLink(8);
navigation.contentVisible(".carousel-inner");
});
this.When(/^the user clicks on the edit button of the first card$/, function () {
url = browser.getUrl();
cardset.editCard();
});
this.Then(/^he enters "([^"]*)" for the front of the card \(EaC\)$/, function (arg1) {
navigation.contentVisible('#contentEditor');
let frontSelector = browser.element('#editor');
sFront = frontSelector.getAttribute("data-content");
navigation.setContent('#contentEditor', arg1);
});
this.Then(/^he enters a "([^"]*)" for the back of the card \(EaC\)$/, function (arg1) {
navigation.clickElement('#editBack');
let backSelector = browser.element('#editor');
sBack = backSelector.getAttribute("data-content");
navigation.setContent('#contentEditor', arg1);
});
this.Then(/^he press on the save button \(EaC\)$/, function () {
cardset.saveCardReturn();
});
this.Then(/^he should be redirected to his own cardsets view back again \(EaC\)$/, function () {
navigation.compareUrl(url, browser.getUrl());
});
this.Then(/^the front of the card should be "([^"]*)"$/, function (arg1) {
navigation.compareContent('.detailfront0', arg1, 0);
});
this.Then(/^he wants to undo previous changes$/, function () {
cardset.editCard();
navigation.setContent('#contentEditor', sFront);
navigation.clickElement('#editBack');
navigation.setContent('#contentEditor', sBack);
cardset.saveCardReturn();
});
this.Then(/^he should be redirected to his own cardsets view once again \(EaC\)$/, function () {
navigation.compareUrl(url, browser.getUrl());
});
this.Then(/^he wants to delete the card$/, function () {
cardset.editCard();
cardset.deleteCard();
cardset.deleteCardConfirm();
});
this.Then(/^he logs out$/, function () {
navigation.logout();
});
};
Feature: Edit a deck of cards
As a user of the site,
so that I can create and learn cards,
I want to edit a deck of cards that I own
Background:
Given User is logged in
And User is on the my cardset view
@watch
Scenario: User edits a owned deck of cards
When User clicks on a cardset that he owns
Then he is shown the details of the cardset
And he should push the edit cardset button
And he should see the edit cardset form
And he should be able to edit the cardset title
And he should be able to edit the cardset description
And he should be able to edit the module name
And he should be able to edit the module initials
And he should be able to edit the module ID
And he should be able to edit the college
And he should be able to edit the course
And he should press the save deck of cards button
And he should see the details of that cardset with the correct values
\ No newline at end of file
import * as cardset from "../../features_helper/cardset.js";
import * as navigation from "../../features_helper/navigation.js";
module.exports = function () {
'use strict';
var title = "new-title";
var description = "new-description";
var module = "new-module";
var moduleInitials = "new-short";
var moduleID = "43";
var college = "Zulu-Universität";
var course = "Z-Studiengang";
this.Given(/^User is logged in$/, function () {
navigation.login("standardLogin");
});
this.Given(/^User is on the my cardset view$/, function () {
navigation.selectMyCardset();
});
this.When(/^User clicks on a cardset that he owns$/, function () {
navigation.selectCardsetLink(1);
});
this.Then(/^he is shown the details of the cardset$/, function () {
cardset.collapseCardsetInfo(false);
});
this.Then(/^he should push the edit cardset button$/, function () {
navigation.clickElement('#editCardset');
});
this.Then(/^he should see the edit cardset form$/, function () {
navigation.contentVisible('#setName');
});
this.Then(/^he should be able to edit the cardset title$/, function () {
navigation.setContent('#setName', title);
navigation.compareContent('#setName', title, 2, 'value');
});
this.Then(/^he should be able to edit the cardset description$/, function () {
navigation.setContent('#setDescription', description);
navigation.compareContent('#setDescription', description, 2, 'value');
});
this.Then(/^he should be able to edit the module name$/, function () {
navigation.setContent('#setModule', module);
navigation.compareContent('#setModule', module, 2, 'value');
});
this.Then(/^he should be able to edit the module initials$/, function () {
navigation.setContent('#setModuleShort', moduleInitials);
navigation.compareContent('#setModuleShort', moduleInitials, 2, 'value');
});
this.Then(/^he should be able to edit the module ID$/, function () {
navigation.setContent('#setModuleNum', moduleID);
navigation.compareContent('#setModuleNum', moduleID, 2, 'value');
});
this.Then(/^he should be able to edit the college$/, function () {
navigation.clickElement('#setCollege');
navigation.clickElement('li[data="' + college + '"] a');
});
this.Then(/^he should be able to edit the course$/, function () {
navigation.clickElement('#setCourse');
navigation.clickElement('li[data="' + course + '"] a');
});
this.Then(/^he should press the save deck of cards button$/, function () {
navigation.clickElement('#cardSetSave');
});
this.Then(/^he should see the details of that cardset with the correct values$/, function () {
navigation.contentVisible('.modal-open',false);
navigation.clickElement('#editCardset');
navigation.compareContent('#setName', title, 2, 'value');
navigation.compareContent('#setDescription', description, 2, 'value');
navigation.compareContent('#setModule', module, 2, 'value');
navigation.compareContent('#setModuleShort', moduleInitials, 2, 'value');
navigation.compareContent('#setModuleNum', moduleID, 2, 'value');
navigation.clickElement('#cardSetCancel');
navigation.logout();
});
};
import * as navigation from "../../features_helper/navigation.js";
module.exports = function () {
'use strict';
let username = "standardLogin";
/**
* ---------------------------------------------------------------------
* Background
* ---------------------------------------------------------------------
*/
this.Given(/^User is logged in$/, function () {
navigation.login(username);
});
/**
* ---------------------------------------------------------------------
* Sort by card type scenario
* ---------------------------------------------------------------------
*/
this.When(/^user clicks on the filter by card type button$/, function () {
navigation.selectPool();
navigation.clickElement('a[class="dropdown-toggle cardTypeBtn"]');
});
this.Then(/^he should choose a card type/, function () {
navigation.clickElement('a[class="filterCardType"]');
});
this.Then(/^he should see the cardset list sorted by the choosen card type/, function () {
let cardsetListFilteredWord = navigation.getContent('.poolCardType', 1);
navigation.compareContent('.resultName', cardsetListFilteredWord, 1);
});
/**
* ---------------------------------------------------------------------
* Sort by author scenario
* ---------------------------------------------------------------------
*/
this.When(/^user clicks on the filter by author button$/, function () {
navigation.selectPool();
navigation.clickElement('a[class="dropdown-toggle authorBtn"]');
});
this.Then(/^he should choose an author$/, function () {
navigation.clickElement('a[class="filterAuthor"]');
});
this.Then(/^he should see the cardset list sorted by the choosen author$/, function () {
let cardsetListFilteredWord = navigation.getContent('.poolAuthor', 1);
navigation.compareContent('.resultName', cardsetListFilteredWord, 1);
});
/**
* ---------------------------------------------------------------------
* Sort by college scenario
* ---------------------------------------------------------------------
*/
this.When(/^user clicks on the filter by college button$/, function () {
navigation.resetPool();
navigation.clickElement('a[class="dropdown-toggle collegeBtn"]');
});
this.Then(/^he should choose a college$/, function () {
navigation.clickElement('a[class="filterCollege"]');
});
this.Then(/^he should see the cardset list sorted by the choosen college$/, function () {
let cardsetListFilteredWord = navigation.getContent('.poolCollege', 1);
navigation.compareContent('.resultName', cardsetListFilteredWord, 1);
});
/**
* ---------------------------------------------------------------------
* Sort by course scenario
* ---------------------------------------------------------------------
*/
this.When(/^user clicks on the filter by course button$/, function () {
navigation.resetPool();
navigation.clickElement('a[class="dropdown-toggle courseBtn"]');
});
this.Then(/^he should choose a course$/, function () {
navigation.clickElement('a[class="filterCourse"]');
});