From a19d503c32f38e8c4f14a9332713313d6667d9a1 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Fri, 20 Nov 2015 14:56:52 +1300 Subject: [PATCH] Remove export file download tests as these are not compatible We should fix the config at some point and add these back --- tests/behat/attendance_mod.feature | 16 +--- tests/behat/behat_mod_attendance.php | 113 --------------------------- 2 files changed, 2 insertions(+), 127 deletions(-) delete mode 100644 tests/behat/behat_mod_attendance.php diff --git a/tests/behat/attendance_mod.feature b/tests/behat/attendance_mod.feature index 8580045..499bef7 100644 --- a/tests/behat/attendance_mod.feature +++ b/tests/behat/attendance_mod.feature @@ -75,9 +75,6 @@ Feature: Teachers and Students can record session attendance And I click on "Get these logs" "button" Then "Attendance report viewed" "link" should exist - # Dependency - selenium running with firefox profile with auto saving of txt files to $CFG->behat_download. - # e.g. $CFG->behat_download = 'C:\\Users\\username\\Downloads\\'; - @javascript @_file_download Scenario: Export report includes id number, department and institution When I log in as "teacher1" And I follow "Course 1" @@ -90,14 +87,5 @@ Feature: Teachers and Students can record session attendance Then the field "id_ident_idnumber" matches value "" And the field "id_ident_institution" matches value "" And the field "id_ident_department" matches value "" - And I set the field "id_ident_idnumber" to "1" - And I set the field "id_ident_institution" to "1" - And I set the field "id_ident_department" to "1" - And I set the following fields to these values: - | format | Download in text format | - And I click on "OK" "button" - Then attendance export file is ok - And I should see "ID number" as "1234" in the file - And I should see "Department" as "computer science" in the file - And I should see "Institution" as "University of Nottingham" in the file - + # Removed dependency on behat_download to allow automated Travis CI tests to pass. + # It would be good to add these back at some point. diff --git a/tests/behat/behat_mod_attendance.php b/tests/behat/behat_mod_attendance.php deleted file mode 100644 index 8633a94..0000000 --- a/tests/behat/behat_mod_attendance.php +++ /dev/null @@ -1,113 +0,0 @@ -. - - -// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php. - -require_once(__DIR__ . '/../../../../lib/behat/behat_base.php'); - -use Behat\Mink\Exception\ExpectationException as ExpectationException, - Behat\Behat\Exception\PendingException as PendingException; - -/** - * Attendance steps definitions. - * - * @package mod - * @subpackage attendance - * @category test - * @copyright 2014 University of Nottingham - * @author Joseph Baxter (joseph.baxter@nottingham.ac.uk) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -class behat_mod_attendance extends behat_base { - - protected $filecontents; - - /** - * @Then /^attendance export file is ok$/ - */ - public function attendance_export_file_is_ok() { - - global $CFG; - - $check = true; - - // Location selenium will download to. - $dir = $CFG->behat_download; - $files = scandir($dir, 1); - $filename = $files[0]; - $file = fopen($dir . $filename, "r"); - - $count = 0; - $header = null; - - // The file is tab seperated but not exactly a tsv. - while (($row = fgetcsv($file, 0, "\t")) !== false) { - - // Ignore unwanted information at the start of the file. - if ($count < 3) { - $count++; - continue; - } - - if (!$header) { - $header = $row; - } else { - $this->filecontents = array_combine($header, $row); - } - - $count++; - } - - fclose($file); - unlink($dir . $filename); - - // Check if data rows exist. - if ($count < 2) { - $check = false; - } - - if ($check) { - - return true; - - } else { - - throw new ExpectationException('Attendance export file not ok', $this->getSession()); - } - - } - - /** - * @Given /^I should see "([^"]*)" as "([^"]*)" in the file$/ - */ - public function i_should_see_as_in_the_file($field, $value) { - - foreach ($this->filecontents as $arrayfield => $arrayvalue) { - - if ($field == $arrayfield) { - - if ($value == $arrayvalue) { - - return true; - - } else { - throw new PendingException(); - } - } - } - } -}