diff --git a/Gruntfile.js b/Gruntfile.js index c1e854b505..f018329bed 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -197,9 +197,6 @@ module.exports = function(grunt) { tasks: ['merge-json'] } }, - casperjs: { - files: ['./test_frontend/*.js', '!./test_frontend/login.js'] - }, mochaTest: { src: ['test/*.js'], options: { @@ -350,6 +347,6 @@ module.exports = function(grunt) { } }); - grunt.registerTask('test', ['mochaTest'/*, 'casperjs'*/]); + grunt.registerTask('test', ['mochaTest']); grunt.registerTask('default', ['merge-json', 'requireBundle', 'less:dev', 'handlebars', 'watch']); }; diff --git a/package.json b/package.json index a93a902ab6..c3ef6051c5 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,6 @@ "fs-extra": "^0.16.3", "grunt": "~0.4.1", "grunt-bower-requirejs": "~0.7.1", - "grunt-casperjs": "2.x", "grunt-concurrent": "~0.3.0", "grunt-contrib-connect": "~0.11.2", "grunt-contrib-copy": "~0.4.1", diff --git a/test_frontend/Data/adaptlearning.jpeg b/test_frontend/Data/adaptlearning.jpeg deleted file mode 100644 index 918f3d8a3a..0000000000 Binary files a/test_frontend/Data/adaptlearning.jpeg and /dev/null differ diff --git a/test_frontend/asset.js b/test_frontend/asset.js deleted file mode 100644 index c0cfbfd637..0000000000 --- a/test_frontend/asset.js +++ /dev/null @@ -1,145 +0,0 @@ -// asset.js -var loginModule = require("./login"); -//tests the asset manager -casper.test.begin('Test Asset Manager', 7, function suite(test) { - loginModule.login(); - - casper.then(function() { - this.wait(500, function() {}); - test.assertExists("a[class='project-layout-list']", "Menu is there"); - }); - - - //checks if menu exists and opens it - casper.then(function() { - test.assertExists("a[class='navigation-item navigation-global-menu']", "Menu button at top left exists "); - }); - casper.then(function() { - this.click("a[class='navigation-item navigation-global-menu']"); - }); - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/asset/01-submenu open.png"); - }); - }); - - //clicks on the asset manager button - casper.then(function() { - this.click("div.global-menu-item:nth-child(2) > a:nth-child(1)"); - }); - - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/asset/02-opened asset page.png"); - }); - }); - - casper.then(function() { - casper.test.comment("Filter with no results"); - }); - //enters a value into the search box that doesn't match any of the files - casper.then(function() { - casper.evaluate(function() { - document.querySelector('input[name="search"]').setAttribute("value","no results"); - }); - - }); - casper.then(function() { - this.click("button[type=submit]"); - }); - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/asset/03-no results in filter.png"); - }); - }); - - //checks for an error message being displayed on the page - casper.then(function() { - this.wait(1000, function() { - test.assertSelectorHasText('.unit-40', 'No assets found'); - }); - }); - - casper.then(function() { - casper.test.comment("Adding an asset"); - }); - - casper.then(function() { - casper.test.comment("Testing uploading"); - test.assertExists(".asset-nav-tabs > ul:nth-child(1) > li:nth-child(2) > a:nth-child(1)", "Able to upload a new file"); - }); - - //clicks on the "Upload new asset" tab - casper.then(function() { - this.click(".asset-nav-tabs > ul:nth-child(1) > li:nth-child(2) > a:nth-child(1)"); - }); - - casper.then(function() { - this.wait(2000); - }); - - //fill in the form - casper.then(function() { - this.fill("form.asset-form", { - 'file' : config.assetPath - }); - }); - - casper.then(function() { - this.fill("form.asset-form", { - 'title' : 'testing', - 'description' : 'description' - }, true); - }); - - casper.then(function() { - this.capture("./test_frontend/img/asset/04-uploading an image.png"); - }); - - //submits the image - casper.then(function() { - this.click("button[type=submit]"); - }); - - //clicks the "Filters" tab - casper.then(function() { - this.click(".asset-nav-tabs > ul:nth-child(1) > li:nth-child(1) > a:nth-child(1)") - }); - - casper.then(function() { - this.capture("./test_frontend/img/asset/05-back to filter tab.png"); - }); - - casper.then(function() { - casper.test.comment("Filter with results"); - }); - - //inputs a name that should match one of the files - casper.then(function() { - casper.evaluate(function() { - document.querySelector('input[name="search"]').setAttribute("value", "testing"); - }); - - }); - - casper.then(function() { - this.wait(1000, function() { - this.click("button[type=submit]"); - }); - }); - - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/asset/06-filter showing result.png"); - }); - }); - - //checks to make sure the error text isn't on the page - casper.then(function() { - test.assertSelectorDoesntHaveText('.unit-40', 'No assets found'); - }); - - casper.run(function() { - test.done(); - }); -}); diff --git a/test_frontend/buttons.js b/test_frontend/buttons.js deleted file mode 100644 index fb1dc15461..0000000000 --- a/test_frontend/buttons.js +++ /dev/null @@ -1,57 +0,0 @@ -// buttons.js -var loginModule = require("./login"); -casper.test.begin('Testing the buttons on the main page', 2, function suite(test) { - loginModule.login(); - - /* - Clicks all the buttons that rearrange the projects to ensure they work - */ - casper.then(function() { - casper.test.comment("Testing the buttons"); - }); - - casper.then(function() { - this.click(".project-layout-list"); - }); - - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/buttons/list.png"); - }); - }); - - casper.then(function() { - this.click(".project-layout-grid"); - }); - - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/buttons/grid.png"); - }); - }); - - casper.then(function() { - this.click(".project-sort-asc"); - }); - - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/buttons/ascending.png"); - }); - }); - - casper.then(function() { - this.click(".project-sort-desc"); - }); - - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/buttons/descending.png"); - }); - }); - - casper.run(function() { - test.done(); - }); -}); - diff --git a/test_frontend/config.json b/test_frontend/config.json deleted file mode 100644 index 748b8a5384..0000000000 --- a/test_frontend/config.json +++ /dev/null @@ -1,7 +0,0 @@ -{"serverPort":"3000", -"username":"email@email.com", -"password":"password", -"createCourseName" : "Name", -"createCourseDescription" : "This is a description", -"assetPath" : "./test_frontend/Data/adaptlearning.jpeg" -} diff --git a/test_frontend/copy.js b/test_frontend/copy.js deleted file mode 100644 index 39517c29b4..0000000000 --- a/test_frontend/copy.js +++ /dev/null @@ -1,63 +0,0 @@ - -// copy.js -var loginModule = require("./login"); -var num; -//tests the course editor -casper.test.begin('Testing copying a course', 5, function suite(test) { - loginModule.login(); - casper.then(function() { - this.wait(500, function() {}); - - }); - - casper.then(function() { - casper.test.comment("Testing copy"); - }); - - casper.then(function() { - casper.capture("./test_frontend/img/copy/01-on home page.png"); - }); - - //checks if menu exists and opens it - casper.then(function() { - test.assertExists("a[class='open-context-icon open-context-course']", "Edit button exists"); - }); - casper.then(function() { - this.click("li.project-list-item:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > a:nth-child(1)"); - }); - - casper.then(function() { - casper.capture("./test_frontend/img/copy/02-submenu open.png"); - test.assertExists("div.context-menu-item:nth-child(2) > a:nth-child(1) > div:nth-child(1) > h5:nth-child(1)", "Submenu is open "); - }); - - //clicks on the "duplicate" item in the submenu - casper.then(function() { - var x = require('casper').selectXPath; - this.click(x('//h5[text()="Duplicate"]')); - }); - - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/copy/03-copy menu.png"); - test.assertExists("#projectDetailTitle", "Copy rename/description page open "); - }); - }); - - //submits the duplicate project without making any changes- name defaults to "Copy of X" - casper.then(function() { - this.wait(1000, function() { - this.click(".editor-project-edit-sidebar-save"); - }); - }); - - casper.then(function() { - this.wait(1000, function() { - casper.capture("./test_frontend/img/copy/04-copy results.png"); - }); - }); - - casper.run(function() { - test.done(); - }); -}); diff --git a/test_frontend/createProject.js b/test_frontend/createProject.js deleted file mode 100644 index 96540ca5db..0000000000 --- a/test_frontend/createProject.js +++ /dev/null @@ -1,70 +0,0 @@ -// createProject.js -var loginModule = require("./login"); -//creates a new project -casper.test.begin('Create Course', 5, function suite(test) { - loginModule.login(); - casper.then(function() { - this.wait(500, function() {}); - casper.test.comment("Creating the course"); - }); - - //checks that the add course button exists, then clicks it - casper.then(function() { - test.assertExists("button[class='btn dashboard-sidebar-add-course']", "Add new course button exists"); - this.wait(1000, function() { - this.capture("./test_frontend/img/create/01-on home page.png"); - }); - }); - casper.then(function() { - this.click("button[class='btn dashboard-sidebar-add-course']"); - }); - - - casper.then(function() { - test.assertExists('input[id="projectDetailTitle"]', "Found the add project page"); - this.wait(1000, function() { - this.capture("./test_frontend/img/create/02-create project page.png"); - }); - }); - - //testing to see if error message appears when no title is entered - casper.then(function() { - this.click(".editor-project-edit-sidebar-save"); - casper.test.comment("Testing error message when no title is entered"); - }); - casper.then(function() { - this.test.assertEval(function() { - return __utils__.findOne('#titleErrorMessage').textContent !== ''; - }, "Error message appeared properly - no title given"); - //this.test.assertSelectorHasText("#titleErrorMessage", "Please", "Error message appeared properly - no title given"); - this.wait(1000, function() { - this.capture("./test_frontend/img/create/03-error report working.png"); - }); - }); - - //fills in the form with valid information and submits it - casper.then(function() { - this.fillSelectors("form.forms", { - 'input[id=projectDetailTitle]' : config.createCourseName, - 'textarea[id=projectDetailDescription]' : config.createCourseDescription - }); - }); - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/create/04-values filled in.png"); - }); - }); - casper.then(function() { - this.click(".editor-project-edit-sidebar-save"); - }); - - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/create/05-project was created.png"); - }); - }); - - casper.run(function() { - test.done(); - }); -}); diff --git a/test_frontend/delete.js b/test_frontend/delete.js deleted file mode 100644 index 752bd9d08f..0000000000 --- a/test_frontend/delete.js +++ /dev/null @@ -1,54 +0,0 @@ -// delete.js -var loginModule = require("./login"); -var num; -//tests the course editor -casper.test.begin('Testing deleting a course', 4, function suite(test) { - loginModule.login(); - casper.then(function() { - this.wait(500, function() {}); - - }); - - casper.then(function() { - casper.test.comment("Testing delete on the last project"); - //stores the number of projects in a variable to be used later - num = this.evaluate(function() { - return __utils__.findAll("li.project-list-item").length; - }); - }); - - casper.then(function() { - this.capture("./test_frontend/img/delete/01-on home page.png"); - }); - - casper.then(function() { - test.assertExists("a[class='open-context-icon open-context-course']", "Edit button exists"); - }); - //click on the submenu button on the project numbered "num", which is the last project - casper.then(function() { - this.click("li.project-list-item:nth-child("+num+") > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > a:nth-child(1) > i:nth-child(1)"); - }); - - casper.then(function() { - this.capture("./test_frontend/img/delete/02-submenu open.png"); - this.wait(1000, function() { - test.assertExists("div.context-menu-item:nth-child(3) > a:nth-child(1) > div:nth-child(1) > h5:nth-child(1)", "Submenu is open"); - }); - }); - //clicks the delete option - casper.then(function() { - this.click("div.context-menu-item:nth-child(3) > a:nth-child(1) > div:nth-child(1) > h5:nth-child(1)"); - }); - - casper.then(function() { - this.capture("./test_frontend/img/delete/03-project was deleted.png"); - }); - //confirms the delete because it uses a confirm box - casper.setFilter("page.confirm", function(msg) { - return true; - }); - - casper.run(function() { - test.done(); - }); -}); \ No newline at end of file diff --git a/test_frontend/editConfig.js b/test_frontend/editConfig.js deleted file mode 100644 index 989d4d85b7..0000000000 --- a/test_frontend/editConfig.js +++ /dev/null @@ -1,92 +0,0 @@ -// editConfig.js -var loginModule = require("./login"); -var num; -var sections; -//tests the course editor -casper.test.begin('Test Course Editor - Configuration', 5, function suite(test) { - loginModule.login(); - casper.then(function() { - //stores the number of projects in a variable to be used later - num = this.evaluate(function() { - return __utils__.findAll("li.project-list-item").length; - }); - this.wait(500, function() {}); - casper.test.comment("Project settings"); - }); - - //checks if menu exists and opens it, then clicks the "Edit" option - casper.then(function() { - test.assertExists("a[class='open-context-icon open-context-course']", "Edit button exists"); - }); - casper.then(function() { - this.capture("./test_frontend/img/editConfig/01-on home page.png"); - }); - casper.then(function() { - this.click("li.project-list-item:nth-child("+num+") > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > a:nth-child(1)"); - }); - casper.then(function() { - this.capture("./test_frontend/img/editConfig/02-submenu open.png"); - }); - casper.then(function() { - var x = require('casper').selectXPath; - this.click(x('//h5[text()="Edit"]')); - this.wait(1000); - }); - - casper.then(function() { - test.assertExists("div[class='editor-menu-layer-controls units-row']", "Got into the edit window"); - }); - - casper.then(function() { - this.capture("./test_frontend/img/editConfig/03-on main editor page.png"); - }); - - casper.then(function() { - this.click(".editor-common-sidebar-config"); - }); - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/editConfig/04-configuration page opened.png"); - }); - }); - - casper.then(function() { - this.test.assertExists("#config-defaultLanguage", "On configuration page"); - }); - - - //changes values on the configuration page and saves them - casper.then(function() { - this.fillSelectors("form.forms", { - 'input[id=config-defaultLanguage]' : 'fr', - 'input[id=config-questionWeight]' : '3', - 'input[id=config-drawerduration]' : '600' - }); - }); - casper.then(function() { - casper.evaluate(function() { - document.querySelector('#config-accessibilityenabled').selectedIndex = 1; - document.querySelector('#config-accessibilitylegacy').selectedIndex = 1; - document.querySelector('#config-drawershoweasing').selectedIndex = 3; - document.querySelector('#config-drawerhideeasing').selectedIndex = 4; - }); - }); - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/editConfig/05-configuration values edited.png"); - }); - }); - casper.then(function() { - this.click("button[class='btn editor-config-edit-sidebar-save']"); - }); - - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/editConfig/06-configuration saved and back to main page.png"); - }); - }); - - casper.run(function() { - test.done(); - }); -}); diff --git a/test_frontend/editCourse.js b/test_frontend/editCourse.js deleted file mode 100644 index 6f8603ba26..0000000000 --- a/test_frontend/editCourse.js +++ /dev/null @@ -1,159 +0,0 @@ -// editCourse.js -var loginModule = require("./login"); -var num; -var sections; -//tests the course editor -casper.test.begin('Test Course Editor', 11, function suite(test) { - loginModule.login(); - casper.then(function() { - //stores the number of projects in a variable to be used later - num = this.evaluate(function() { - return __utils__.findAll("li.project-list-item").length; - }); - this.wait(500, function() {}); - casper.test.comment("Project settings"); - }); - - //checks if menu exists and opens it, then clicks the "Edit" option - casper.then(function() { - test.assertExists("a[class='open-context-icon open-context-course']", "Edit button exists"); - }); - casper.then(function() { - this.capture("./test_frontend/img/edit/01-on home page.png"); - }); - casper.then(function() { - this.click("li.project-list-item:nth-child("+num+") > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > a:nth-child(1)"); - }); - casper.then(function() { - this.capture("./test_frontend/img/edit/02-submenu open.png"); - }); - casper.then(function() { - var x = require('casper').selectXPath; - this.click(x('//h5[text()="Edit"]')); - this.wait(1000); - }); - - casper.then(function() { - test.assertExists("div[class='editor-menu-layer-controls units-row']", "Got into the edit window"); - }); - - casper.then(function() { - this.capture("./test_frontend/img/edit/03-main editor page open.png"); - }); - - //clicks the button to add a section - casper.then(function() { - this.click(".editor-menu-layer-add-menu"); - }); - casper.then(function() { - this.wait(1000, function() { - sections = this.evaluate(function() { - return __utils__.findAll("div.editor-menu-item").length; - }); - }); - }); - casper.then(function() { - this.wait(2000, function() { - test.assertExists("div.editor-menu-item:nth-child("+(sections+2)+") > div:nth-child(1) > div:nth-child(3) > span:nth-child(1)", "Added a section"); - this.capture("./test_frontend/img/edit/04-section was added.png"); - }); - }); - - //clicks the section to open it, then adds a page to that section - casper.then(function() { - this.wait(1000, function() { - this.click("div.editor-menu-item:nth-child("+(sections+2)+") > div:nth-child(1) > div:nth-child(3) > span:nth-child(1)"); - }); - }); - casper.then(function() { - this.wait(1000, function() { - test.assertExists("div.editor-menu-layer:nth-child(2) > div:nth-child(1) > div:nth-child(1) > button:nth-child(1)", "Opened the section"); - this.capture("./test_frontend/img/edit/05-section opened.png"); - }); - }); - casper.then(function() { - this.wait(1000, function() { - this.click("div.editor-menu-layer:nth-child(2) > div:nth-child(1) > div:nth-child(1) > button:nth-child(1)"); - }); - }); - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/edit/06-page was added to section.png"); - test.assertExists("div.content-type-page:nth-child(3) > div:nth-child(1)", "Added a page"); - }); - }); - - //opens the page - casper.then(function() { - this.wait(1000, function() { - this.mouse.doubleclick("div.content-type-page:nth-child(3) > div:nth-child(1)"); - }); - }); - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/edit/07-page opened.png"); - test.assertExists("a.btn", "Opened project page"); - }); - }); - - //adds an article to the page, then a block to the article, then a component to the block - casper.then(function() { - this.click("a.btn"); - }); - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/edit/08-article added to page.png"); - test.assertExists("div.page-article:nth-child(2) > div:nth-child(2) > div:nth-child(5) > a:nth-child(1)", "Added an article"); - }); - }); - casper.then(function() { - this.click("div.page-article:nth-child(2) > div:nth-child(2) > div:nth-child(5) > a:nth-child(1)"); - }); - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/edit/09-block added to article.png"); - test.assertExists("div.block:nth-child(2) > div:nth-child(2) > div:nth-child(5) > a:nth-child(1)", "Added a block"); - }); - }); - casper.then(function() { - this.click("div.block:nth-child(2) > div:nth-child(2) > div:nth-child(5) > a:nth-child(1)"); - }); - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/edit/10-component menu.png"); - test.assertExists("div.notify-popup-component-option:nth-child(6)", "Adding a component"); - }); - }); - - //chooses which component to add: a blank, full width one - casper.then(function() { - this.wait(1000, function() { - this.click("div.notify-popup-component-option:nth-child(6)"); - }); - }); - casper.then(function() { - this.wait(1000, function() { - this.click("div.notify-popup-layout-option:nth-child(2)"); - }); - }); - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/edit/11-components are chosen.png"); - }); - }); - casper.then(function() { - this.wait(1000, function() { - this.click("a.notify-popup-button:nth-child(1)"); - }); - }); - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/edit/12-component added to block.png"); - }); - }); - - casper.run(function() { - test.done(); - }); -}); - diff --git a/test_frontend/editDetails.js b/test_frontend/editDetails.js deleted file mode 100644 index 9a78049290..0000000000 --- a/test_frontend/editDetails.js +++ /dev/null @@ -1,83 +0,0 @@ - -// edit.js -var loginModule = require("./login"); -var num; -//tests the course editor -casper.test.begin('Testing editing a course', 5, function suite(test) { - loginModule.login(); - - casper.then(function() { - casper.capture("./test_frontend/img/editInfo/01-on main page.png"); - //returns the amount of courses, is used to decide which one to edit- the last one - num = this.evaluate(function() { - return __utils__.findAll("li.project-list-item").length; - }); - }); - //checks if menu exists and opens it - casper.then(function() { - test.assertExists("a[class='open-context-icon open-context-course']", "Edit button exists"); - }); - casper.then(function() { - this.click("li.project-list-item:nth-child("+num+") > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > a:nth-child(1)"); - }); - - casper.then(function() { - test.assertExists("div.context-menu-item:nth-child(2) > a:nth-child(1) > div:nth-child(1) > h5:nth-child(1)","Submenu is open"); - casper.capture("./test_frontend/img/editInfo/02-submenu open.png"); - }); - - casper.then(function() { - var x = require('casper').selectXPath; - this.click(x('//h5[text()="Edit"]')); - }); - - casper.then(function() { - this.wait(2000, function() { - test.assertExists(".editor-common-sidebar-project","Project page is open"); - }); - }); - - casper.then(function() { - this.wait(2000, function() { - casper.capture("./test_frontend/img/editInfo/03-editor page open.png"); - this.click(".editor-common-sidebar-project"); - }); - }); - - casper.then(function() { - this.wait(2000, function() { - casper.capture("./test_frontend/img/editInfo/04-project settings page open.png"); - }); - }); - - casper.then(function() { - this.fillSelectors("form.forms", { - 'input[id=projectDetailTitle]' : 'Edited', - 'textArea[id=projectDetailDescription]' : 'EditedImage' - }); - }); - - casper.then(function() { - casper.capture("./test_frontend/img/editInfo/05-values edited.png"); - }); - - casper.then(function() { - this.click(".editor-project-edit-sidebar-save"); - }); - - casper.then(function() { - this.wait(1000, function() { - this.click(".sidebar-breadcrumb-inner > a:nth-child(1)"); - }); - }); - - casper.then(function() { - casper.wait(1000, function() { - this.capture("./test_frontend/img/editInfo/06-values saved.png"); - }); - }); - - casper.run(function() { - test.done(); - }); -}); \ No newline at end of file diff --git a/test_frontend/editExtensions.js b/test_frontend/editExtensions.js deleted file mode 100644 index 151b8e0f59..0000000000 --- a/test_frontend/editExtensions.js +++ /dev/null @@ -1,121 +0,0 @@ -// editCourse.js -var loginModule = require("./login"); -var num; -var sections; -//tests the course editor -casper.test.begin('Test Course Editor', 6, function suite(test) { - loginModule.login(); - casper.then(function() { - //stores the number of projects in a variable to be used later - num = this.evaluate(function() { - return __utils__.findAll("li.project-list-item").length; - }); - this.wait(500, function() {}); - casper.test.comment("Project settings"); - }); - - //checks if menu exists and opens it, then clicks the "Edit" option - casper.then(function() { - test.assertExists("a[class='open-context-icon open-context-course']", "Edit button exists"); - }); - casper.then(function() { - this.capture("./test_frontend/img/editEx/01-on home page.png"); - }); - casper.then(function() { - this.click("li.project-list-item:nth-child("+num+") > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > a:nth-child(1)"); - }); - casper.then(function() { - this.capture("./test_frontend/img/editEx/02-submenu open.png"); - }); - casper.then(function() { - var x = require('casper').selectXPath; - this.click(x('//h5[text()="Edit"]')); - this.wait(1000); - }); - - casper.then(function() { - test.assertExists("div[class='editor-menu-layer-controls units-row']", "Got into the edit window"); - }); - - casper.then(function() { - this.capture("./test_frontend/img/editEx/03-on editor page.png"); - }); - - casper.then(function() { - this.click("button[class='editor-common-sidebar-extensions btn']"); - }); - - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/editEx/04-opened extensions page.png"); - }); - }); - - casper.then(function() { - this.click("#checkbox-1"); - }); - - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/editEx/05-chose one extension to add.png"); - }); - }); - - casper.then(function() { - test.assertExists(".editor-extensions-edit-sidebar-save", "At the manage extensions page"); - }) - - casper.then(function() { - this.click(".editor-extensions-edit-sidebar-save"); - }); - - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/editEx/06-confirmation message for extensions.png"); - }); - }); - - casper.then(function() { - this.click("a.notify-popup-button:nth-child(1)"); - }); - - casper.then(function() { - this.wait(1000, function() { - this.click("button[class='editor-common-sidebar-extensions btn']"); - }); - }); - - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/editEx/07-shows enabled extension.png"); - }); - }); - - casper.then(function() { - test.assertExists(".btn-red", "An extension has been added"); - }) - - casper.then(function() { - this.click(".btn-red"); - }); - - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/editEx/08-confirmation message for removing extension.png"); - }); - }); - - casper.then(function() { - this.click("a.notify-popup-button:nth-child(1)"); - }); - - casper.then(function() { - this.wait(1000, function() { - this.capture("./test_frontend/img/editEx/09-extension removed.png"); - }); - }); - - casper.run(function() { - test.done(); - }); -}); \ No newline at end of file diff --git a/test_frontend/failedLogin.js b/test_frontend/failedLogin.js deleted file mode 100644 index fadd988bec..0000000000 --- a/test_frontend/failedLogin.js +++ /dev/null @@ -1,89 +0,0 @@ -//opens page -casper.test.begin('Failing login test (no values)', 2, function suite(test) { - casper.start("http://localhost:3000", function() { - this.evaluate(function() { - document.querySelector('body').style.backgroundColor = "white"; - }); - this.wait(1000, function(){}); - this.test.assertTitle("Adapt Origin", "Adapt login page title is the one expected"); - }).viewport(1366,768); - - //screenshot of the homepage before anything is entered - casper.then(function() { - this.capture("./test_frontend/img/failLogin/failNoInfo1.png"); - }); - - //clicks login button without filling in any values - casper.then(function() { - this.wait(1000, function(){}); - this.click("button[type=submit]"); - casper.test.comment("Pressed the submit button without entering any values"); - }); - - //takes a screenshot of the error message when submit is pressed - casper.then(function() { - this.capture("./test_frontend/img/failLogin/failNoInfo2.png"); - }); - - //test output if the error message is there - casper.then(function() { - //this.test.assertSelectorDoesntHaveText("#loginErrorMessage", ""); - this.test.assertEval(function() { - return __utils__.findOne('#loginErrorMessage').textContent !== ''; - }, "Error message appeared properly - no information provided"); - }); - - casper.run(function() { - test.done(); - }); -}); - -casper.test.begin('Failing login test (wrong values)', 2, function suite(test) { - casper.start("http://localhost:3000", function() { - this.evaluate(function() { - document.querySelector('body').style.backgroundColor = "white"; - }); - this.wait(1000, function(){}); - this.test.assertTitle("Adapt Origin", "Adapt login page title is the one expected"); - }).viewport(1366,768); - - //screenshot of the homepage before anything is entered - casper.then(function() { - this.capture("./test_frontend/img/failLogin/failWrongInfo1.png"); - }); - - //fill in the form with incorrect information - casper.then(function() { - this.fillSelectors("form.forms", { - 'input[id=login-input-username]' : 'this is incorrect information', - 'input[id=login-input-password]' : 'pass' - }); - }); - - //clicks login button with incorrect values - casper.then(function() { - this.click("button[type=submit]"); - casper.test.comment("Entered incorrect values and pressed submit"); - }); - - //test output if the error message is there - //commented out because of bug - casper.then(function() { - //this.test.assertExists("loginErrorMessage", "Error message appeared properly - wrong information"); - this.wait(1000, function() { - this.test.assertEval(function() { - return __utils__.findOne('#loginErrorMessage').textContent !== ''; - }, "Error message appeared properly - wrong information"); - }); - }); - - casper.then(function() { - this.wait(2000, function() { - this.capture("./test_frontend/img/failLogin/failWrongInfo2.png"); - }); - }); - - casper.run(function() { - test.done(); - }); -}); diff --git a/test_frontend/login.js b/test_frontend/login.js deleted file mode 100644 index af110556c2..0000000000 --- a/test_frontend/login.js +++ /dev/null @@ -1,49 +0,0 @@ -// login.js - -//opens page -exports.login = function() { - var fs = require('fs'); - configFile = fs.read('./test_frontend/config.json'); - config = JSON.parse(configFile); - - casper.start("http://localhost:"+config.serverPort, function() { - this.evaluate(function() { - document.querySelector('body').style.backgroundColor = "white"; - }); - this.wait(1000, function(){}); - casper.test.comment("Login"); - this.test.assertTitle("Adapt Origin", "Adapt homepage title is the one expected"); - }).viewport(1366,768); - - casper.then(function() { - this.capture("./test_frontend/img/login/01-login page.png"); - }); - - //fills in fields and clicks button - casper.then(function() { - this.fillSelectors("form.forms", { - 'input[id=login-input-username]' : config.username, - 'input[id=login-input-password]' : config.password - }); - }); - casper.then(function() { - this.wait(1000, function(){ - this.capture("./test_frontend/img/login/02-correct information entered.png"); - }); - }); - casper.then(function() { - this.wait(1000, function(){ - this.click("button[type=submit]"); - }); - - }); - - casper.then(function() { - this.wait(1000, function(){ - this.capture("./test_frontend/img/login/03-proceeded to main page.png"); - }); - this.test.assertExists("div[class=location-title-inner]", "Logged in"); - }); - - return casper.then(function() {}); -}; diff --git a/test_frontend/logout.js b/test_frontend/logout.js deleted file mode 100644 index 06a5cc52ec..0000000000 --- a/test_frontend/logout.js +++ /dev/null @@ -1,42 +0,0 @@ -// logout.js -var loginModule = require("./login"); -//creates a new project -casper.test.begin('Logging Out', 4, function suite(test) { - //runs the login module - loginModule.login(); - - casper.then(function() { - this.wait(500, function() {}); - casper.test.comment("Logging out"); - }); - - //click the logout button - casper.then(function() { - this.click("a[class='navigation-item navigation-user-logout']"); - }); - - //check if the logout link exists - casper.then(function() { - test.assertExists('a[id="linkLogout"]', "Clicked the logout button, confirm screen exists"); - }); - - casper.then(function() { - this.capture("./test_frontend/img/logout/01-logout confirmation.png"); - }); - - //click the logout button, then confirm you want to log out - casper.then(function() { - this.click("a[id='linkLogout']"); - }); - casper.then(function() { - test.assertExists('input[id="login-input-username"]', - "Clicked the confirm link, back at the login screen"); - }); - casper.then(function() { - this.capture("./test_frontend/img/logout/02-back to login page.png"); - }); - - casper.run(function() { - test.done(); - }); -}); \ No newline at end of file