Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
9d140cf
MOBILE-2133 tests: Karma tests removed
magician03 May 29, 2017
5f2fb7c
MOBILE-2124 e2e: sauce config files added, travis configured
magician03 May 30, 2017
b5d5551
MOBILE-2124 e2e: PO lib files updated
magician03 Jun 1, 2017
f7a6762
MOBILE-2126 e2e: Fixed mod_assign.spec.js TestSuite
magician03 Jun 7, 2017
4b05d72
MOBILE-2126 e2e: Fixed mod_book.spec.js
magician03 Jun 7, 2017
a89d9c8
MOBILE-2126 e2e: Fixed mod_chat.spec.js
magician03 Jun 7, 2017
7b0a19b
MOBILE-2126 e2e: Fixed mod_choice.spec.js
magician03 Jun 8, 2017
6859c1e
MOBILE-2126 e2e: Fixed mod_folder.spec.js
magician03 Jun 9, 2017
a10c511
MOBILE-2126 e2e: Fixed mod_forum.spec.js
magician03 Jun 9, 2017
4058ff2
MOBILE-2126 e2e: Fixed mod_glossary.spec.js
magician03 Jun 9, 2017
0c943d7
MOBILE-2126 e2e: Fixed mod_label.spec.js
magician03 Jun 9, 2017
8aff3e0
MOBILE-2126 e2e: Fixed mod_resource.spec.js
magician03 Jun 9, 2017
d6becab
MOBILE-2126 e2e: Fixed mod_survey.spec.js
magician03 Jun 10, 2017
9611482
MOBILE-2126 e2e: Fixed mod_wiki.spec.js
magician03 Jun 10, 2017
286b828
MOBILE-2126 e2e: Fixed files.spec.js
magician03 Jun 11, 2017
89336ca
MOBILE-2126 e2e: Fixed notes.spec.js
magician03 Jun 11, 2017
5be2fe0
MOBILE-2126 e2e: Fixed participants.spec.js
magician03 Jun 11, 2017
ef092b7
MOBILE-2126 e2e: Fixed coursecompletion.spec.js
magician03 Jun 11, 2017
51580bb
MOBILE-2126 e2e: Fixed teacher_participants.spec.js
magician03 Jun 11, 2017
7edef51
MOBILE-2126 e2e: Fixed login.spec.js
magician03 Jun 11, 2017
64bf01f
MOBILE-2126 e2e: Fixed teacher_course.spec.js
magician03 Jun 12, 2017
0f76b4a
MOBILE-2126 e2e: Fixed course_contents.spec.js
magician03 Jun 12, 2017
c0f1c96
MOBILE-2126 e2e: Fixed teacher_new_staff_induction_course.spec.js
magician03 Jun 12, 2017
29854c8
MOBILE-2126 e2e: Fixed courses.spec.js
magician03 Jun 12, 2017
9ea0e0a
MOBILE-2126 e2e: Fixed course_filtering.spec.js
magician03 Jun 12, 2017
062df96
MOBILE-2126 e2e: Fixed grades.spec.js
magician03 Jun 12, 2017
f5a70c2
MOBILE-2124 travis: optimise Travis for E2E testing
magician03 Jun 21, 2017
e6d8be7
MOBILE-2126 e2e: Fixed teacher_grades.spec.js
magician03 Jun 22, 2017
2057ff3
MOBILE-2128 e2e: Added mod_page.spec.js
magician03 Jun 22, 2017
3ad3d2c
MOBILE-2128 e2e: Added mod_url.spec.js
magician03 Jun 22, 2017
09a4ab4
MOBILE-2126 e2e: Fixed messages.spec.js
magician03 Jun 22, 2017
c20c7d1
MOBILE-2126 e2e: Fixed settings.spec.js
magician03 Jun 30, 2017
f8eabf5
MOBILE-2126 Fixed and updated mod_quiz.spec.js
magician03 Jul 5, 2017
ec3645f
MOBILE-2128 e2e: Added user_profile.spec.js
magician03 Jul 5, 2017
892e97f
MOBILE-2128 e2e: Added overview.spec.js
magician03 Jul 5, 2017
ccf0a13
MOBILE-2128 e2e: Added mod_feedback.spec.js
magician03 Jul 5, 2017
d5af8ff
MOBILE-2128 e2e: Added mod_lesson.spec.js
magician03 Jul 5, 2017
d1d3391
MOBILE-2128 e2e: Added mod_data.spec.js
magician03 Jul 13, 2017
618af43
MOBILE-2128 e2e: updated calendar.spec.js
magician03 Jul 15, 2017
b61e1ec
MOBILE-2124 e2e: sauce config files for ios, android updated
magician03 Jul 25, 2017
a56e94f
MOBILE-2128 e2e: updated messages.spec.js and added contacts.spec.js
magician03 Jul 25, 2017
8e16ebe
MOBILE-2128 e2e: Added mod_feedback_teacher.js
magician03 Jul 31, 2017
51a48db
MOBILE-2128 e2e: Added mod_assign_teacher.spec.js
magician03 Jul 31, 2017
c403bf1
MOBILE-2128 e2e: Added mod_forum_teacher.spec.js
magician03 Aug 1, 2017
bf1479d
MOBILE-2128 e2e: Updated mod_wiki.spec.js
magician03 Aug 3, 2017
ad5f46b
MOBILE-2128 e2e: Updated mod_glossary.spec.js
magician03 Aug 3, 2017
039750f
MOBILE-2128 e2e: updated mod_data.spec.js
magician03 Aug 8, 2017
a22f894
MOBILE-2128 e2e: Updated settings.spec.js
magician03 Aug 9, 2017
fe9e073
MOBILE-2128 e2e: Added module_prefetch.spec.js
magician03 Aug 9, 2017
5ab2ddc
MOBILE-2128 e2e: Updated mod_wiki.spec.js
magician03 Aug 15, 2017
440b088
MOBILE-2130 e2e: code quality improved, minor corrections
magician03 Aug 17, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 36 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ sudo: true

dist: trusty

group: edge

addons:
apt:
sources:
Expand All @@ -15,24 +17,48 @@ language: node_js
node_js:
- '6.9.1'

cache:
directories:
- $HOME/www/lib
- $HOME/node_modules

before_install:
- npm cache clean
- npm install -g cordova ionic
- npm install -g cordova ionic@2.2.3
- npm install
- npm install -g bower
- npm install -g gulp
- bower install
- ./node_modules/protractor/bin/webdriver-manager update

addons:
sauce_connect: true

before_script:
- "export DISPLAY=:99.0"
- sh -e /etc/init.d/xvfb start
- sleep 5 # Wait so xvfb can start properly.
- gulp
- gulp e2e-build --target browser
- screen -dm ionic serve -b -a -d --nogulp --address localhost --port 8100 # We use screen here because nohup does not work with ionic serve.
- nohup bash -c "./node_modules/protractor/bin/webdriver-manager start 2>&1 &"
- sleep 5 # Wait a lot here, selenium and ionic must be running.
- sleep 15 # Wait a lot here, selenium and gulp:before task and ionic must be running.

matrix:
fast_finish: false

include:
- script:
- ./node_modules/protractor/bin/protractor e2e/sauce/browser/protractor-sauce-browser-activities-1.js

- script:
- ./node_modules/protractor/bin/protractor e2e/sauce/browser/protractor-sauce-browser-activities-2.js

- script:
- ./node_modules/protractor/bin/protractor e2e/sauce/browser/protractor-sauce-browser-config.js

- script:
- ./node_modules/protractor/bin/protractor e2e/sauce/browser/protractor-sauce-browser-course.js

- script:
- ./node_modules/protractor/bin/protractor e2e/sauce/browser/protractor-sauce-browser-resource.js

- script:
- ./node_modules/protractor/bin/protractor e2e/sauce/browser/protractor-sauce-browser-user.js

script:
- ./node_modules/protractor/bin/protractor e2e/build/protractor.conf.js
- script:
- ./node_modules/protractor/bin/protractor e2e/sauce/browser/protractor-sauce-browser-activities-3.js
2 changes: 1 addition & 1 deletion e2e/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ beforeEach(function() {
return browser.driver.isElementPresent(by.id('mm-login-site')).then(function(e) {
return e === true;
});
}, 50000);
}, 100000);
});
113 changes: 84 additions & 29 deletions e2e/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

var waitForCondition = require('./plugins/wait_for_transitions.js').waitForCondition;
var MM = {},
currentNavBar = '.nav-bar-block[nav-bar="active"]',
currentView = 'ion-view[nav-view="active"]';
Expand All @@ -25,13 +26,18 @@ var MM = {},
* @param {Element} container The container in which the node should be found.
* @return {Promise}
*/
MM.clickOn = function(text, container) {
MM.clickOn = function (text, container) {
waitForCondition();
var locator = by.xpath('(//a | //button | //*[contains(concat(" ",normalize-space(@class)," ")," item ")])[contains(.,"' + text + '") or contains(@aria-label,"' + text + '")]');

if (container) {
waitForCondition();
browser.wait(EC.presenceOf(container), 5000);
node = container.element(locator);
} else {
node = element(locator);
}
waitForCondition();
return MM.clickOnElement(node);
};

Expand All @@ -43,20 +49,49 @@ MM.clickOn = function(text, container) {
* @param {Element} el
* @return {Promise}
*/
MM.clickOnElement = function(el) {
MM.clickOnElement = function (el) {
waitForCondition();
browser.sleep(2000);
browser.wait(EC.presenceOf(el), 50000);
browser.executeScript('arguments[0].scrollIntoView(true)', el.getWebElement());
browser.wait(EC.elementToBeClickable(el), 13000);
return el.click();
};

/**
* Go to bottom of page and Click on a element.
*
* This will scroll the view if required.
*
* @param {Element} text
* @return {Promise}
*/
MM.goToBottomAndClick = function (text) {
waitForCondition();
browser.sleep(2000); // This is must, due to slow page rendering issues.
var locator = by.xpath('(//a | //button | //*[contains(concat(" ",normalize-space(@class)," ")," item ")])[contains(.,"' + text + '") or contains(@aria-label,"' + text + '")]');
browser.wait(EC.presenceOf(element(locator)), 5000);
node = element(locator);

waitForCondition();
browser.sleep(2000);
browser.executeScript('arguments[0].scrollIntoView(false)', node.getWebElement());
browser.wait(EC.elementToBeClickable(node), 15000);
return node.click();
}

/**
* Click on a link in the side menu.
*
* @param {String} text The link name
* @return {Promise}
*/
MM.clickOnInSideMenu = function(text) {
return MM.openSideMenu().then(function() {
MM.clickOnInSideMenu = function (text) {
return MM.openSideMenu().then(function () {
waitForCondition();
var menu = $('ion-side-menu[side="left"]');
browser.wait(EC.visibilityOf(menu), 7000);
browser.wait(EC.elementToBeClickable(menu), 5000);
return MM.clickOn(text, menu);
});
};
Expand All @@ -66,7 +101,10 @@ MM.clickOnInSideMenu = function(text) {
*
* @return {Element}
*/
MM.getNavBar = function() {
MM.getNavBar = function () {
waitForCondition();
browser.wait(EC.visibilityOf($(currentNavBar)), 10000);
browser.sleep(7000); // Wait for contents to render.
return $(currentNavBar);
};

Expand All @@ -75,7 +113,10 @@ MM.getNavBar = function() {
*
* @return {Element}
*/
MM.getView = function() {
MM.getView = function () {
waitForCondition();
browser.wait(EC.visibilityOf($(currentView)), 50000);
browser.sleep(7000); // Wait for contents to render.
return $(currentView);
};

Expand All @@ -84,15 +125,17 @@ MM.getView = function() {
*
* @return {Promise}
*/
MM.goBack = function() {
MM.goBack = function () {
var backBtn = $(currentNavBar + ' .back-button');
return backBtn.isPresent().then(function(present) {
waitForCondition();
browser.wait(EC.visibilityOf(backBtn), 15000);
return backBtn.isPresent().then(function (present) {
if (present) {
return backBtn.isDisplayed().then(function(displayed) {
return backBtn.isDisplayed().then(function (displayed) {
if (displayed) {
return backBtn.click();
}
throw new Error('Could not find the back button.');
throw new Error('Could not find back button.');
});
}
throw new Error('Could not find the back button.');
Expand All @@ -106,27 +149,34 @@ MM.goBack = function() {
* @param {String} password The password
* @return {Promise}
*/
MM.loginAs = function(username, password) {
MM.loginAs = function (username, password) {

browser.ignoreSynchronization = true;
browser.waitForAngular();
browser.wait(EC.visibilityOf(element(by.model('siteurl'))), 15000);

element(by.model('siteurl'))
.sendKeys(SITEURL);

browser.wait(EC.elementToBeClickable($('[ng-click="connect(siteurl)"]')), 15000);
return $('[ng-click="connect(siteurl)"]').click()
.then(function() {
element(by.model('credentials.username'))
.sendKeys(username);
element(by.model('credentials.password'))
.sendKeys(password);

return $('[ng-click="login()"]').click();
});
.then(function () {
waitForCondition();
browser.wait(EC.visibilityOf($('[ng-click="login()"]')), 15000);
element(by.model('credentials.username'))
.sendKeys(username);
element(by.model('credentials.password'))
.sendKeys(password);
browser.wait(EC.elementToBeClickable($('[ng-click="login()"]')), 15000);
return $('[ng-click="login()"]').click();
});
};

/**
* Login as admin.
*
* @return {Promise}
*/
MM.loginAsAdmin = function() {
MM.loginAsAdmin = function () {
return MM.loginAs(USERS.ADMIN.LOGIN, USERS.ADMIN.PASSWORD);
};

Expand All @@ -135,7 +185,7 @@ MM.loginAsAdmin = function() {
*
* @return {Promise}
*/
MM.loginAsStudent = function() {
MM.loginAsStudent = function () {
return MM.loginAs(USERS.STUDENT.LOGIN, USERS.STUDENT.PASSWORD);
};

Expand All @@ -145,7 +195,7 @@ MM.loginAsStudent = function() {
*
* @return {Promise}
*/
MM.loginAsTeacher = function() {
MM.loginAsTeacher = function () {
return MM.loginAs(USERS.TEACHER.LOGIN, USERS.TEACHER.PASSWORD);
};

Expand All @@ -154,7 +204,7 @@ MM.loginAsTeacher = function() {
*
* @return {Promise}
*/
MM.logout = function() {
MM.logout = function () {
return MM.clickOnInSideMenu('Change site');
};

Expand All @@ -163,17 +213,22 @@ MM.logout = function() {
*
* @return {Promise}
*/
MM.openSideMenu = function() {
MM.openSideMenu = function () {
var menuBtn = $(currentNavBar + ' [menu-toggle="left"]:not(.hide)');
waitForCondition();
browser.wait(EC.visibilityOf(menuBtn), 10000);
browser.wait(EC.elementToBeClickable(menuBtn), 50000);

function navigateBack() {
return MM.goBack().then(function() {
return MM.goBack().then(function () {
return openMenu();
});
}

function openMenu() {
return menuBtn.isPresent().then(function(present) {
return menuBtn.isPresent().then(function (present) {
if (present) {
return menuBtn.isDisplayed().then(function(displayed) {
return menuBtn.isDisplayed().then(function (displayed) {
if (displayed) {
return menuBtn.click();
}
Expand All @@ -186,4 +241,4 @@ MM.openSideMenu = function() {
return openMenu();
};

global.MM = global.MM || MM;
global.MM = global.MM || MM;
3 changes: 1 addition & 2 deletions e2e/plugins/wait_for_transitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,4 @@ exports.waitForCondition = function() {
}).then(function(inTransition) {
return inTransition;
});
};

};
78 changes: 78 additions & 0 deletions e2e/sauce/browser/protractor-sauce-browser-activities-1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
exports.config = {
framework: "jasmine2",
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 100000,
realtimeFailure: true,
showTiming: true,
includeStackTrace: true,
isVerbose: true,
onComplete: null
},
specs: [
"../../../e2e/*.js",
"../../../www/**/e2e/mod_chat.spec.js",
"../../../www/**/e2e/mod_quiz.spec.js",
"../../../www/**/e2e/mod_choice.spec.js",
"../../../www/**/e2e/mod_assign.spec.js",
"../../../www/**/e2e/mod_assign_teacher.spec.js"
],
baseUrl: 'http://localhost:8100/',
seleniumAddress: "http://" + process.env.SAUCE_USERNAME + ":" + process.env.SAUCE_ACCESS_KEY + "@ondemand.saucelabs.com:80/wd/hub",
multiCapabilities: [{
"name": 'chrome',
"browserName": "chrome",
"chromeOptions": {
args: [
"--allow-file-access",
"--allow-file-access-from-files",
"--enable-local-file-accesses",
"--unlimited-storage"
]
},
"platform": "Windows 10",
"version": "56.0",
"username": process.env.SAUCE_USERNAME,
"accessKey": process.env.SAUCE_ACCESS_KEY,
"tunnel-identifier": process.env.TRAVIS_JOB_NUMBER,
"build": process.env.TRAVIS_BUILD_NUMBER
}],
restartBrowserBetweenTests: true,
onPrepare: function () {
var wd = require('wd'),
protractor = require('protractor'),
wdBridge = require('wd-bridge')(protractor, wd);
wdBridge.initFromProtractor(exports.config);
global.EC = protractor.ExpectedConditions;


// Define global variables for our tests.
global.ISANDROID = false;
global.ISBROWSER = true;
global.ISIOS = false;
global.ISTABLET = false;
global.DEVICEURL = 'http://localhost:8100/';
global.DEVICEVERSION = undefined;
global.SITEURL = 'http://school.demo.moodle.net';
global.SITEVERSION = 3.3;
global.SITEHASLM = false;
global.USERS = {
"STUDENT": {
"LOGIN": "student",
"PASSWORD": "moodle"
},
"TEACHER": {
"LOGIN": "teacher",
"PASSWORD": "moodle"
},
"ADMIN": {
"LOGIN": "admin",
"PASSWORD": "test"
}
};
},
getPageTimeout: 15000,
plugins: [{
"path": "../../../e2e/plugins/wait_for_transitions.js"
}]
};
Loading