diff --git a/classes/jobesandbox.php b/classes/jobesandbox.php index ca880fa5..d410b41e 100644 --- a/classes/jobesandbox.php +++ b/classes/jobesandbox.php @@ -75,12 +75,27 @@ public function __construct() { qtype_coderunner_sandbox::__construct(); // Hack to force use of a local jobe host when behat testing. - if ($CFG->prefix == "bht_") { - $this->jobeserver = "localhost"; - } else { - $this->jobeserver = get_config('qtype_coderunner', 'jobe_host'); + // if ($CFG->prefix == "bht_") { + // $this->jobeserver = "localhost"; // Should it be :4000 ? + // } else if ($CFG->prefix == "b_") { + // $this->jobeserver = "172.17.0.1:4000"; // For local moodle-docker usage. + // } else { + // $this->jobeserver = get_config('qtype_coderunner', 'jobe_host'); + // } + + // use Given the CodeRunner jobe sandbox is enabled + // or Given the CodeRunner jobe scratchpad is enabled + // in each feature to make sure the right jobe_host string is used + // adjust behat_coderunner.php to set the appropriate server + // eg, in a local docker we usually have 172.17.0.1:4000 + + $jobefromconfig = get_config('qtype_coderunner', 'jobe_host'); + $this->jobeserver = $jobefromconfig; + $keyenabled = get_config('qtype_coderunner', 'jobe_apikey_enabled'); + // $this->jobeserver = $jobefromconfig; + if ($jobefromconfig != "172.17.0.1:4000") { + $banana = 'what?'; } - $this->apikey = get_config('qtype_coderunner', 'jobe_apikey'); $this->languages = null; } @@ -220,10 +235,10 @@ public function execute($sourcecode, $language, $input, $files = null, $params = // But, remember that the server is chosen at random from the pool! $key = hash("md5", serialize($runspec)); - // echo '
' . serialize($runspec) . '
'; - $runresult = $cache->get($key); // unersializes the returned value :) false if not found. + // Debugger: echo '
' . serialize($runspec) . '
';. + $runresult = $cache->get($key); // Unserializes the returned value :) false if not found. if ($runresult) { - // echo $key . '-----------> FOUND' . '
'; + // echo $key . '-----------> FOUND' . '
'; . } } @@ -277,10 +292,10 @@ public function execute($sourcecode, $language, $input, $files = null, $params = $runresult['cmpinfo'] = $this->response->cmpinfo; $runresult['output'] = $this->filter_file_path($this->response->stdout); - // Got a useable result from Jobe server so cache it if required + // Got a useable result from Jobe server so cache it if required. if (WRITE_TO_CACHE) { $key = hash("md5", serialize($runspec)); - $cache->set($key, $runresult); // set serializes the result, get will unserialize + $cache->set($key, $runresult); // set serializes the result, get will unserialize. // echo 'CACHE WRITE for ---> ' . $key . '
'; } } @@ -292,58 +307,61 @@ public function execute($sourcecode, $language, $input, $files = null, $params = // such class found. Removes comments, strings and nested code and then // uses a regexp to find a public class. private function get_main_class($prog) { - // filter out comments and strings + // Filter out comments and strings. $prog = $prog . ' '; - $filteredProg = array(); - $skipTo = -1; + $filteredprog = []; + $skipto = -1; for ($i = 0; $i < strlen($prog) - 1; $i++) { - if ($skipTo == false) break; // an unclosed comment/string - bail out - if ($i < $skipTo) continue; - - // skip "//" comments - if ($prog[$i].$prog[$i+1] == '//') { - $skipTo = strpos($prog, "\n", $i + 2); + if ($skipto == false) { + break; // An unclosed comment/string - bail out. } - - // skip "/**/" comments - else if ($prog[$i].$prog[$i+1] == '/*') { - $skipTo = strpos($prog, '*/', $i + 2) + 2; - $filteredProg[] = ' '; // '/**/' is a token delimiter + if ($i < $skipto) { + continue; } - - // skip strings - else if ($prog[$i] == '"') { - // matches the whole string + // Skip "//" comments. + if ($prog[$i] . $prog[$i + 1] == '//') { + $skipto = strpos($prog, "\n", $i + 2); + // Skip "/**/" comments. + } else if ($prog[$i] . $prog[$i + 1] == '/*') { + $skipto = strpos($prog, '*/', $i + 2) + 2; + $filteredprog[] = ' '; // The string '/**/' is a token delimiter. + // Skip strings. + } else if ($prog[$i] == '"') { + // Matches the whole string. if (preg_match('/"((\\.)|[^\\"])*"/', $prog, $matches, 0, $i)) { - $skipTo = $i + strlen($matches[0]); + $skipto = $i + strlen($matches[0]); + } else { + $skipto = false; } - else $skipTo = false; + // Copy everything else. + } else { + $filteredprog[] = $prog[$i]; } - - // copy everything else - else $filteredProg[] = $prog[$i]; } - // remove nested code + // Remove nested code. $depth = 0; - for ($i = 0; $i < count($filteredProg); $i++) { - if ($filteredProg[$i] == '{') $depth++; - if ($filteredProg[$i] == '}') $depth--; - if ($filteredProg[$i] != "\n" && $depth > 0 && !($depth == 1 && $filteredProg[$i] == '{')) { - $filteredProg[$i] = ' '; + for ($i = 0; $i < count($filteredprog); $i++) { + if ($filteredprog[$i] == '{') { + $depth++; + } + if ($filteredprog[$i] == '}') { + $depth--; + } + if ($filteredprog[$i] != "\n" && $depth > 0 && !($depth == 1 && $filteredprog[$i] == '{')) { + $filteredprog[$i] = ' '; } } - // search for a public class - if (preg_match('/public\s(\w*\s)*class\s*(\w+)[^\w]/', implode('', $filteredProg), $matches) !== 1) { + // Search for a public class. + if (preg_match('/public\s(\w*\s)*class\s*(\w+)[^\w]/', implode('', $filteredprog), $matches) !== 1) { return false; } else { return $matches[2]; } } - // Return the sandbox error code corresponding to the given httpcode. private function get_error_code($httpcode) { diff --git a/question.php b/question.php index 3e97469b..623c6d23 100644 --- a/question.php +++ b/question.php @@ -843,8 +843,6 @@ public function display_feedback() { * the history of prior submissions. * @param bool $isprecheck true iff this grading is occurring because the * student clicked the precheck button - * @param bool $usecache If true (and the coderunner cachegradingresults setting is also true) then - * cache results in coderunner cache and use results from the coderunner grading cache. * @return 3-element array of the mark (0 - 1), the question_state ( * gradedright, gradedwrong, gradedpartial, invalid) and the full * qtype_coderunner_testing_outcome object to be cached. The invalid diff --git a/tests/behat/ace_scratchpad_compatibility.feature b/tests/behat/ace_scratchpad_compatibility.feature index d2980553..8e407537 100644 --- a/tests/behat/ace_scratchpad_compatibility.feature +++ b/tests/behat/ace_scratchpad_compatibility.feature @@ -5,7 +5,8 @@ Feature: Ace UI convert to Scratchpad UI questions with one click I should be able to change a question from using Ace to Scratchpad in one click Background: - Given the following "users" exist: + Given the CodeRunner scratchpad is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: @@ -20,7 +21,6 @@ Feature: Ace UI convert to Scratchpad UI questions with one click And the following "questions" exist: | questioncategory | qtype | name | | Test questions | coderunner | Square function | - And the CodeRunner sandbox is enabled When I am on the "Square function" "core_question > edit" page logged in as teacher1 And I set the following fields to these values: diff --git a/tests/behat/attachmentimportexport.feature b/tests/behat/attachmentimportexport.feature index 10e88dce..1b96a9f9 100644 --- a/tests/behat/attachmentimportexport.feature +++ b/tests/behat/attachmentimportexport.feature @@ -5,7 +5,8 @@ Feature: Test importing and exporting of question with attachments I need to be able to import and export them Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | | teacher | And the following "courses" exist: @@ -20,7 +21,6 @@ Feature: Test importing and exporting of question with attachments And the following "questions" exist: | questioncategory | qtype | name | | Test questions | coderunner | Square function | - And the CodeRunner sandbox is enabled And I am on the "Square function" "core_question > edit" page logged in as teacher And I click on "a[aria-controls='id_attachmentoptionscontainer']" "css_element" And I set the field "Answer" to "from sqrmodule import sqr" diff --git a/tests/behat/attachments.feature b/tests/behat/attachments.feature index 2403b336..3a25de6c 100644 --- a/tests/behat/attachments.feature +++ b/tests/behat/attachments.feature @@ -5,7 +5,8 @@ Feature: Test editing and using attachments to a CodeRunner question I need to enable and configure them, then preview them. Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: diff --git a/tests/behat/backup_and_restore.feature b/tests/behat/backup_and_restore.feature index 87065833..6b183b60 100644 --- a/tests/behat/backup_and_restore.feature +++ b/tests/behat/backup_and_restore.feature @@ -5,6 +5,7 @@ Feature: Duplicate a course containing a CodeRunner question I need to be able to back them up and restore them Background: + Given the CodeRunner jobe sandbox is enabled And the following "courses" exist: | fullname | shortname | category | | Course 1 | C1 | 0 | diff --git a/tests/behat/behat_coderunner.php b/tests/behat/behat_coderunner.php index 2ecaa8c2..4cb75696 100644 --- a/tests/behat/behat_coderunner.php +++ b/tests/behat/behat_coderunner.php @@ -30,14 +30,38 @@ class behat_coderunner extends behat_base { /** * Sets the webserver sandbox to enabled for testing purposes. * - * @Given /^the CodeRunner sandbox is enabled/ + * @Given /^the CodeRunner jobe sandbox is enabled/ */ public function the_coderunner_sandbox_is_enabled() { + set_config('jobesandbox_enabled', 1, 'qtype_coderunner'); + set_config('jobe_host', '172.17.0.1:4000', 'qtype_coderunner'); + } + + + /** + * Sets the webserver scratchpad to enabled for testing purposes. + * + * @Given /^the CodeRunner scratchpad is enabled/ + */ + public function the_coderunner_scratchpad_is_enabled() { set_config('wsenabled', 1, 'qtype_coderunner'); set_config('jobesandbox_enabled', 1, 'qtype_coderunner'); set_config('jobe_host', '172.17.0.1:4000', 'qtype_coderunner'); } + + /** + * Sets the webserver scratchpad to disabled for testing purposes. + * + * @Given /^the CodeRunner scratchpad is disabled/ + */ + public function the_coderunner_scratchpad_is_disabled() { + set_config('wsenabled', 0, 'qtype_coderunner'); + set_config('jobesandbox_enabled', 1, 'qtype_coderunner'); + set_config('jobe_host', '172.17.0.1:4000', 'qtype_coderunner'); + } + + /** * Checks that a given string appears within answer textarea. * Intended for checking UI serialization diff --git a/tests/behat/check_graph_question_types.feature b/tests/behat/check_graph_question_types.feature index 8b65a60a..e20065e5 100644 --- a/tests/behat/check_graph_question_types.feature +++ b/tests/behat/check_graph_question_types.feature @@ -5,7 +5,8 @@ Feature: Check that the directed and undirected graph question types work. I should be able to write simple graph questions and have them work correctly Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: diff --git a/tests/behat/check_python_template_params.feature b/tests/behat/check_python_template_params.feature index 14955b0c..e52ed874 100644 --- a/tests/behat/check_python_template_params.feature +++ b/tests/behat/check_python_template_params.feature @@ -5,7 +5,8 @@ Feature: Check that Python and other languages can be used instead of Twig as a I should be able to write a function that prints the seed and my username it should be marked right Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | Last | teacher1@asd.com | | student1 | Student First | O'Connell | student@asd.com | diff --git a/tests/behat/check_stepinfo.feature b/tests/behat/check_stepinfo.feature index 69ebbc82..125712c3 100644 --- a/tests/behat/check_stepinfo.feature +++ b/tests/behat/check_stepinfo.feature @@ -5,7 +5,8 @@ Feature: Check that the QUESTION.stepinfo record is working. I should be able to write a question that gives different feedback for different submissions. Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | | student1 | Student | 1 | student@asd.com | diff --git a/tests/behat/check_twig_student_variable.feature b/tests/behat/check_twig_student_variable.feature index 7d011155..74c5b974 100644 --- a/tests/behat/check_twig_student_variable.feature +++ b/tests/behat/check_twig_student_variable.feature @@ -5,7 +5,8 @@ Feature: Check the STUDENT Twig variable allows access to current username in Co I should be able to write a function that prints my username it should be marked right Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | | student1 | Student | 1 | student@asd.com | diff --git a/tests/behat/create_python3_sqr_function.feature b/tests/behat/create_python3_sqr_function.feature index e459fc9e..4a938710 100644 --- a/tests/behat/create_python3_sqr_function.feature +++ b/tests/behat/create_python3_sqr_function.feature @@ -5,7 +5,8 @@ Feature: Create a CodeRunner question (the sqr function example) I need to create a new CodeRunner question Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: diff --git a/tests/behat/duplicate_prototype.feature b/tests/behat/duplicate_prototype.feature index 7ff68ced..fa32eedc 100644 --- a/tests/behat/duplicate_prototype.feature +++ b/tests/behat/duplicate_prototype.feature @@ -5,7 +5,8 @@ Feature: duplicate_prototypes I should see an informative error message and be able to fix by editing the duplicates Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: diff --git a/tests/behat/edit.feature b/tests/behat/edit.feature index db79a174..41a34a7d 100644 --- a/tests/behat/edit.feature +++ b/tests/behat/edit.feature @@ -5,7 +5,8 @@ Feature: Test editing a CodeRunner question I need to edit them Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: diff --git a/tests/behat/edit_question_precheck.feature b/tests/behat/edit_question_precheck.feature index 29ee74e7..9ae276c5 100644 --- a/tests/behat/edit_question_precheck.feature +++ b/tests/behat/edit_question_precheck.feature @@ -5,7 +5,8 @@ Feature: edit_question_precheck I should get informative error messages if saving was unsuccessful Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: diff --git a/tests/behat/edit_table.feature b/tests/behat/edit_table.feature index 51371477..153150e6 100644 --- a/tests/behat/edit_table.feature +++ b/tests/behat/edit_table.feature @@ -5,7 +5,8 @@ Feature: Test editing a CodeRunner question using the Table UI I should be able to set the table headers and see the table in the edit form. Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: diff --git a/tests/behat/export.feature b/tests/behat/export.feature index 2180f485..92c7a0fa 100644 --- a/tests/behat/export.feature +++ b/tests/behat/export.feature @@ -5,7 +5,8 @@ Feature: Export CodeRunner questions I need to export them Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | | teacher | And the following "courses" exist: diff --git a/tests/behat/gapfiller_ui.feature b/tests/behat/gapfiller_ui.feature index 58e6c783..537838eb 100644 --- a/tests/behat/gapfiller_ui.feature +++ b/tests/behat/gapfiller_ui.feature @@ -5,7 +5,8 @@ Feature: Test the GapFiller_UI I should be able specify the required gaps in the global extra or test0 fields Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: diff --git a/tests/behat/grading_scenarios.feature b/tests/behat/grading_scenarios.feature index cb7602a3..183f6209 100644 --- a/tests/behat/grading_scenarios.feature +++ b/tests/behat/grading_scenarios.feature @@ -5,7 +5,8 @@ Feature: Check grading with the Python 3 sqr function CodeRunner question I must be able to preview them Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: diff --git a/tests/behat/html_ui.feature b/tests/behat/html_ui.feature index b235bbcd..3af90167 100644 --- a/tests/behat/html_ui.feature +++ b/tests/behat/html_ui.feature @@ -5,7 +5,8 @@ Feature: Test the HTML_UI I should be able specify the required html in either globalextra or prototypeextra Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: diff --git a/tests/behat/import.feature b/tests/behat/import.feature index 01062935..f760a2e0 100644 --- a/tests/behat/import.feature +++ b/tests/behat/import.feature @@ -5,7 +5,8 @@ Feature: Import CodeRunner questions I need to import them Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | | teacher | And the following "courses" exist: diff --git a/tests/behat/make_combinator_prototype.feature b/tests/behat/make_combinator_prototype.feature index bfbc2d6b..da68fe77 100644 --- a/tests/behat/make_combinator_prototype.feature +++ b/tests/behat/make_combinator_prototype.feature @@ -5,7 +5,8 @@ Feature: make_combinator_prototype I must be able to create new combinator templates Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: diff --git a/tests/behat/make_prototype.feature b/tests/behat/make_prototype.feature index b1b1617f..386bef98 100644 --- a/tests/behat/make_prototype.feature +++ b/tests/behat/make_prototype.feature @@ -5,7 +5,8 @@ Feature: make_prototype I must be able to create new question templates Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: diff --git a/tests/behat/missing_prototype.feature b/tests/behat/missing_prototype.feature index 9eb2687b..d9d109c9 100644 --- a/tests/behat/missing_prototype.feature +++ b/tests/behat/missing_prototype.feature @@ -5,7 +5,8 @@ Feature: missing_prototype I should see an informative error message and be able to fix by editing Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: diff --git a/tests/behat/reset_button.feature b/tests/behat/reset_button.feature index fc215c1d..c8da49a3 100644 --- a/tests/behat/reset_button.feature +++ b/tests/behat/reset_button.feature @@ -5,7 +5,8 @@ Feature: Preview the Python 3 sqr function CodeRunner question with a preload I should see a Reset answer button that resets the preload, Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: diff --git a/tests/behat/run_python3_sqr_function.feature b/tests/behat/run_python3_sqr_function.feature index 47c424af..e2c45fff 100644 --- a/tests/behat/run_python3_sqr_function.feature +++ b/tests/behat/run_python3_sqr_function.feature @@ -5,7 +5,8 @@ Feature: Preview the Python 3 sqr function CodeRunner question I must be able to preview them Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: diff --git a/tests/behat/run_python3_sqr_function_templated.feature b/tests/behat/run_python3_sqr_function_templated.feature index b4092269..82025d9c 100644 --- a/tests/behat/run_python3_sqr_function_templated.feature +++ b/tests/behat/run_python3_sqr_function_templated.feature @@ -5,7 +5,8 @@ Feature: Combinator template is called test-by-test if a runtime error occurs wh I need the combinator template to be used test-by-test if my answer gives a runtime error Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: diff --git a/tests/behat/sandbox_webservice.feature b/tests/behat/sandbox_webservice.feature index f013dd35..aa072a8c 100644 --- a/tests/behat/sandbox_webservice.feature +++ b/tests/behat/sandbox_webservice.feature @@ -4,7 +4,7 @@ Feature: Test sandbox web service server (Jobe) via Ajax. Background: - Given the following "users" exist: + And the following "users" exist: | username | firstname | lastname | email | | teacher | Teacher | 1 | teacher@asd.com | | student | Student | 1 | student@asd.com | @@ -30,19 +30,22 @@ Feature: Test sandbox web service @javascript Scenario: As a student if I try to initiate a WS request I get an error if the service is disabled. - When I am on the "Quiz 1" "mod_quiz > View" page logged in as student + Given the CodeRunner scratchpad is disabled + And I am on the "Quiz 1" "mod_quiz > View" page logged in as student And I press "Attempt quiz" And I press "Click me" - Then I should see "ERROR: qtype_coderunner/Sandbox web service disabled." + #Then I should see "ERROR: qtype_coderunner/Sandbox web service disabled." + Then I should see "ERROR: qtype_coderunner/Sandbox web service disabled. Talk to a sysadmin" @javascript Scenario: As a student I can initiate a WS request and see the outcome if the service is enabled. - When I log in as "admin" - And I navigate to "Plugins > CodeRunner" in site administration - And I set the following fields to these values: - | Enable sandbox web service | Yes | - And I press "Save changes" - And I log out +# When I log in as "admin" +# And I navigate to "Plugins > CodeRunner" in site administration +# And I set the following fields to these values: +# | Enable sandbox web service | Yes | +# And I press "Save changes" +# And I log out + Given the CodeRunner scratchpad is enabled When I am on the "Quiz 1" "mod_quiz > View" page logged in as student And I press "Attempt quiz" And I press "Click me" diff --git a/tests/behat/scratchpad_ui.feature b/tests/behat/scratchpad_ui.feature index 9397521a..54e55701 100644 --- a/tests/behat/scratchpad_ui.feature +++ b/tests/behat/scratchpad_ui.feature @@ -5,7 +5,8 @@ Feature: Test the Scratchpad UI I should be able specify the required html in either globalextra or prototypeextra Background: - Given the following "users" exist: + Given the CodeRunner scratchpad is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: @@ -20,7 +21,6 @@ Feature: Test the Scratchpad UI And the following "questions" exist: | questioncategory | qtype | name | template | | Test questions | coderunner | Print answer | printans | - And the CodeRunner sandbox is enabled Scenario: Edit a CodeRunner question into a Scratchpad UI question When I am on the "Print answer" "core_question > edit" page logged in as teacher1 diff --git a/tests/behat/scratchpad_ui_params.feature b/tests/behat/scratchpad_ui_params.feature index 2dd3d811..57332da9 100644 --- a/tests/behat/scratchpad_ui_params.feature +++ b/tests/behat/scratchpad_ui_params.feature @@ -20,7 +20,7 @@ Feature: Test the Scratchpad UI, UI Params And the following "questions" exist: | questioncategory | qtype | name | template | | Test questions | coderunner | Print answer | printans | - And the CodeRunner sandbox is enabled + And the CodeRunner scratchpad is enabled And I am on the "Print answer" "core_question > edit" page logged in as teacher1 And I set the field "id_validateonsave" to "" diff --git a/tests/behat/set_uiplugin.feature b/tests/behat/set_uiplugin.feature index 53f60b1d..a39d11b3 100644 --- a/tests/behat/set_uiplugin.feature +++ b/tests/behat/set_uiplugin.feature @@ -5,7 +5,8 @@ Feature: Check that a selected UI plugin is saved I should be able to select a UI plugin and save the form Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: diff --git a/tests/behat/showdifferences_button.feature b/tests/behat/showdifferences_button.feature index c244167e..c63b496c 100644 --- a/tests/behat/showdifferences_button.feature +++ b/tests/behat/showdifferences_button.feature @@ -5,7 +5,8 @@ Feature: Show differences in CodeRunner questions clicked. Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: diff --git a/tests/behat/template_params_error.feature b/tests/behat/template_params_error.feature index bce67654..543c6d94 100644 --- a/tests/behat/template_params_error.feature +++ b/tests/behat/template_params_error.feature @@ -5,7 +5,8 @@ Feature: template_params_error I should get informative template parameter error messages Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: diff --git a/tests/behat/twigprefix.feature b/tests/behat/twigprefix.feature index 86eb7563..4df50925 100644 --- a/tests/behat/twigprefix.feature +++ b/tests/behat/twigprefix.feature @@ -5,7 +5,8 @@ Feature: twigprefix I must be able to use the Twig prefix data in a question. Background: - Given the following "users" exist: + Given the CodeRunner jobe sandbox is enabled + And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | And the following "courses" exist: