Commit 83588f1b authored by Curtis Adam's avatar Curtis Adam

Rework the chimp tests

parent 27e46458
module.exports = {
//Check https://www.seleniumhq.org/download/ for the latest version numbers
seleniumStandaloneOptions: {
version: '3.11.0',
version: '3.14.0',
drivers: {
chrome: {
version: '2.36'
},
ie: {
version: '3.6.0'
version: '2.44'
},
firefox: {
version: '0.20.0'
version: '0.23.0'
}
}
},
//
// SauceLabs:
// ==========
/*/
user: "SAUCE_USER_NAME",
key: "SAUCE_USER_KEY",
browser: 'firefox',
platform: 'Linux'
// When using Sauce Connect Proxy
port: 4445,
host: "localhost",
// Without proxy:
//port: 80,
//host: "ondemand.saucelabs.com"
//*/
}
};
......@@ -80,8 +80,8 @@ build:
chimp:
stage: chimptest
only:
- staging
- /^v[0-9]+/
- /^[[:digit:]]+?(?=-)/
tags:
- nodejs
allow_failure: true
......
......@@ -8,13 +8,16 @@ export let CardsetVisuals = class CardsetVisuals {
}
}
static changeCollapseIcon (iconId) {
static changeCollapseElement (elementId) {
let iconId = elementId + "Icon";
if ($(iconId).hasClass("glyphicon-collapse-down")) {
$(iconId).removeClass("glyphicon-collapse-down");
$(iconId).addClass("glyphicon-collapse-up");
$(elementId).slideDown();
} else {
$(iconId).removeClass("glyphicon-collapse-up");
$(iconId).addClass("glyphicon-collapse-down");
$(elementId).slideUp();
}
}
};
......@@ -329,11 +329,13 @@ $padding-card-list-row: 8px;
#collapseCardsetInfoButton {
float: none;
z-index: 50;
cursor: pointer;
}
#collapseLearningPhaseInfoButton {
float: none;
z-index: 50;
cursor: pointer;
}
#collapseLearningPhaseInfo {
......
<template name="bonusInfoBox">
<a id="collapseLearningPhaseInfoButton" class="col-xs-12 card card-block collapseButton"
href="#collapseLearningPhaseInfo" data-toggle="collapse">
<div id="collapseLearningPhaseInfoButton" class="col-xs-12 card card-block collapseButton">
<strong>{{_ "set-list.learnphaseInfo"}}</strong>
<i id="collapseLearningPhaseInfoIcon" class="glyphicon glyphicon-collapse-down pull-right"></i>
</a>
</div>
<div class="collapse" id="collapseLearningPhaseInfo">
<div class="card card-block">
<table class="table table-condensed table-striped table-hover infoBoxTable">
......
......@@ -22,7 +22,8 @@ import "./bonus.html";
*/
Template.bonusInfoBox.events({
"click #collapseLearningPhaseInfoButton": function () {
CardsetVisuals.changeCollapseIcon("#collapseLearningPhaseInfoIcon");
"click #collapseLearningPhaseInfoButton": function (event) {
event.preventDefault();
CardsetVisuals.changeCollapseElement("#collapseLearningPhaseInfo");
}
});
<template name="cardsetInfoBox">
<a id="collapseCardsetInfoButton"
class="col-xs-12 card btn-default btn-raised {{getColors}} collapseButton collapsed" href="#collapseCardsetInfo"
data-toggle="collapse">
<div id="collapseCardsetInfoButton"
class="col-xs-12 card btn-default btn-raised {{getColors}} collapseButton collapsed">
<strong>{{#if this.shuffled}}{{_ "set-list.cardsetInfoRepetitorium"}}{{else}}{{_
"set-list.cardsetInfoStatic"}}{{/if}}</strong>
<i id="collapseCardsetInfoIcon" class="glyphicon glyphicon-collapse-down pull-right"></i>
</a>
</div>
<div class="collapse" id="collapseCardsetInfo">
<div class="card card-block">
<table class="table table-condensed table-striped table-hover infoBoxTable">
......
......@@ -16,6 +16,7 @@ import "./item/purchased.js";
import "./item/ratings.js";
import "./item/reviewer.js";
import "./cardset.html";
import {CardsetVisuals} from "../../../../api/cardsetVisuals";
/*
* ############################################################################
......@@ -52,3 +53,10 @@ Template.cardsetInfoBox.helpers({
return shuffled;
}
});
Template.cardsetInfoBox.events({
"click #collapseCardsetInfoButton": function () {
CardsetVisuals.changeCollapseElement("#collapseCardsetInfo");
}
});
......@@ -2,7 +2,7 @@
{{#unless isActiveRoute regex="create|learn|pool|shuffle"}}
<tr>
<td>{{_ "cardset.info.quantity"}}:</td>
<td class="cardsetCardQuantity" data-quantity="{{this.quantity}}">{{this.quantity}}</td>
<td class="cardsetCardCount" data-count="{{this.quantity}}">{{this.quantity}}</td>
</tr>
{{/unless}}
</template>
......@@ -54,9 +54,6 @@ Template.cardsetInfo.helpers({
});
Template.cardsetInfo.events({
"click #collapseManageButton": function () {
CardsetVisuals.changeCollapseIcon("#collapseMangeIcon");
},
'click a': function (evt) {
CardNavigation.linkNavigation(evt);
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -8,8 +8,7 @@
"@babel/runtime": "^7.1.2",
"chart.js": "^2.5.0",
"dompurify": "^1.0.3",
"fibers": "^2.0.0",
"gulp": "^3.9.1",
"fibers": "^2.0.2",
"ink-docstrap": "~1.3.0",
"jscs": "^3.0.7",
"meteor-node-stubs": "~0.2.0",
......@@ -22,7 +21,7 @@
"version": "1.0.0",
"main": "index.js",
"devDependencies": {
"chimp": "^0.50.2",
"chimpy": "^0.54.0",
"gulp-jscs": "^3.0.2",
"gulp-jshint": "^2.0.0",
"gulp-watch": "^4.3.5",
......
......@@ -3,8 +3,9 @@ import * as navigation from "../../features_helper/navigation.js";
module.exports = function () {
'use strict';
var countBeforeCreated = 0;
var url;
let countBeforeCreated = 0;
let countAfterCreated = 0;
let url;
/**
* ---------------------------------------------------------------------
* Background
......@@ -44,7 +45,8 @@ module.exports = function () {
navigation.compareUrl(url, browser.getUrl());
});
this.Then(/^the card should be saved$/, function () {
navigation.compareContent(".detail" + (++countBeforeCreated), "FRONTOFTHECARD", 0);
countAfterCreated = navigation.checkCardsetCardQuantity();
navigation.compareContent(++countBeforeCreated, countAfterCreated, 5, '');
});
this.Then(/^they log out$/, function () {
navigation.logout();
......
......@@ -39,8 +39,8 @@ module.exports = function () {
box4After = navigation.getContent('#boxChart', 2, 'data-box4');
box5After = navigation.getContent('#boxChart', 2, 'data-box5');
box6After = navigation.getContent('#boxChart', 2, 'data-box6');
navigation.compareContent(box1Before, box1After, 4);
navigation.compareContent(box2Before, box2After, 4);
navigation.compareContent(--box1Before, box1After, 5);
navigation.compareContent(++box2Before, box2After, 5);
navigation.compareContent(box3Before, box3After, 4);
navigation.compareContent(box4Before, box4After, 4);
navigation.compareContent(box5Before, box5After, 4);
......@@ -60,7 +60,8 @@ module.exports = function () {
this.Then(/^The algorithm should give me a new card$/, function () {
card2 = navigation.getContent('#cardCarousel > div > div', 2, 'data-id');
navigation.compareContent(card1, card2, 4, '', false);
navigation.compareContent(card1, card2, 5, '', false);
navigation.leitnerWozniakBackButton();
navigation.logout();
});
};
......@@ -18,6 +18,10 @@ module.exports = {
if (click) {
browser.click('#learnMemo');
}
browser.waitForVisible('#wozniakHelpConfirm', global.threshold);
browser.click('#wozniakHelpConfirm');
browser.waitForVisible('#startPom', global.threshold);
browser.click('#startPom');
},
learnBox: function (click = true) {
browser.waitForVisible('.learnBtn', global.threshold);
......@@ -28,6 +32,10 @@ module.exports = {
if (click) {
browser.click('#learnBox');
}
browser.waitForVisible('#leitnerHelpConfirm', global.threshold);
browser.click('#leitnerHelpConfirm');
browser.waitForVisible('#startPom', global.threshold);
browser.click('#startPom');
},
leitnerProgress: function (click = true) {
browser.waitForVisible('.learnBtn', global.threshold);
......
......@@ -12,22 +12,26 @@ function setResolution() {
module.exports = {
login: function (userLogin) {
if (browser.getUrl() === "about:blank") {
browser.url(global.baseURL);
setResolution();
agreeCookies();
browser.waitForVisible('#backToStartButton', global.threshold);
browser.click("#backToStartButton");
userLogin += "Login";
browser.waitForVisible('#TestingBackdoorUsername', global.threshold);
this.clickElement('#TestingBackdoorUsername', global.threshold);
browser.waitForVisible('#' + userLogin);
this.clickElement('#' + userLogin);
browser.waitForVisible('#BackdoorLogin', global.threshold);
this.clickElement('#BackdoorLogin');
if (browser.isVisible(".bert-alert")) {
this.clickElement(".bert-alert");
}
browser.url(global.baseURL);
setResolution();
agreeCookies();
browser.waitForVisible('#demoHelpConfirm', global.threshold);
browser.click("#demoHelpConfirm");
browser.waitForVisible('.toggleFullscreen', global.threshold);
browser.click(".toggleFullscreen");
browser.waitForVisible('.swal2-confirm', global.threshold);
browser.click(".swal2-confirm");
browser.waitForVisible('#backToStartButton', global.threshold);
browser.click("#backToStartButton");
userLogin += "Login";
browser.waitForVisible('#TestingBackdoorUsername', global.threshold);
this.clickElement('#TestingBackdoorUsername', global.threshold);
browser.waitForVisible('#' + userLogin);
this.clickElement('#' + userLogin);
browser.waitForVisible('#BackdoorLogin', global.threshold);
this.clickElement('#BackdoorLogin');
if (browser.isVisible(".bert-alert")) {
this.clickElement(".bert-alert");
}
},
logout: function () {
......@@ -60,8 +64,8 @@ module.exports = {
checkCardsetCardQuantity: function () {
browser.waitForExist("#collapseCardsetInfoButton", global.threshold);
browser.click('#collapseCardsetInfoButton');
browser.waitForExist(".cardsetCardQuantity", global.threshold);
return browser.getAttribute(".cardsetCardQuantity", "data-quantity");
browser.waitForExist(".cardsetCardCount", global.threshold);
return browser.getAttribute(".cardsetCardCount", "data-count");
},
checkUrl: function (url) {
browser.waitUntil(function () {
......@@ -87,6 +91,10 @@ module.exports = {
browser.waitForVisible('.backToCardset', global.threshold);
if (click) {
browser.click('.backToCardset');
browser.waitForVisible('.swal2-cancel', global.threshold);
browser.click('.swal2-cancel');
browser.waitForVisible('.swal2-confirm', global.threshold);
browser.click('.swal2-confirm');
}
},
back: function (click = true) {
......@@ -120,8 +128,8 @@ module.exports = {
}
},
compareContent: function (content1, content2, dataType, attribute = 0, isTrue = true) {
let errorMessage;
let receivedContent;
let errorMessage = '';
let receivedContent = '';
if (dataType < 4) {
browser.waitForVisible(content1, global.threshold);
errorMessage = 'Expected content of ' + content1 + ' to be ' + content2 + ' but got ';
......@@ -131,15 +139,19 @@ module.exports = {
browser.waitUntil(function () {
switch (dataType) {
case 0:
browser.waitForVisible(content1, global.threshold);
receivedContent = browser.getText(content1);
return (receivedContent === content2) === isTrue;
case 1:
browser.waitForVisible(content1, global.threshold);
receivedContent = browser.elements(content1).value.length;
return (receivedContent === content2) === isTrue;
case 2:
browser.waitForVisible(content1, global.threshold);
receivedContent = browser.getAttribute(content1, attribute);
return (receivedContent === content2) === isTrue;
case 3:
browser.waitForVisible(content1, global.threshold);
receivedContent = browser.getAttribute(content1, attribute);
return (parseInt(receivedContent) === parseInt(content2)) === isTrue;
case 4:
......@@ -147,6 +159,7 @@ module.exports = {
case 5:
return (parseInt(content1) === parseInt(content2)) === isTrue;
case 6:
browser.waitForVisible(content1, global.threshold);
receivedContent = browser.getText(content1);
return (parseInt(receivedContent) === parseInt(content2)) === isTrue;
}
......
......@@ -16,9 +16,9 @@ if [ -z "$CALLED_FROM_SCRIPT" ] ; then
fi
if [ -n "$DISPLAY" ] ; then
./node_modules/.bin/chimp .config/chimp.js --ddp=http://localhost:$PORT --path=$testDir $1 --browser=firefox
./node_modules/.bin/chimpy .config/chimp.js --ddp=http://localhost:$PORT --path=$testDir $1 --browser=chrome
else
xvfb-run --server-args="-ac -screen 0 1920x1080x24" chimp --ddp=http://localhost:3000 --path=$testDir $1 --browser=firefox
xvfb-run --server-args="-ac -screen 0 1920x1080x24" chimp .config/chimp.js --ddp=http://localhost:3000 --path=$testDir $1 --browser=firefox
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