diff --git a/tests/behat/ace_scratchpad_compatibility.feature b/tests/behat/ace_scratchpad_compatibility.feature old mode 100644 new mode 100755 index 9c10e433..097012d1 --- a/tests/behat/ace_scratchpad_compatibility.feature +++ b/tests/behat/ace_scratchpad_compatibility.feature @@ -29,6 +29,7 @@ Feature: Ace UI convert to Scratchpad UI questions with one click | id_answer | def sqr(n): return n * n | Scenario: Edit a CodeRunner Ace UI question, changing it to be a Scratchpad UI question. + Given the Jobe server supports "python3" When I set the field "id_uiplugin" to "Scratchpad" Then I should see "def sqr(n): return n * n" And I click on "Scratchpad" "button" diff --git a/tests/behat/attachmentimportexport.feature b/tests/behat/attachmentimportexport.feature old mode 100644 new mode 100755 index 43eb7308..5f7ef91d --- a/tests/behat/attachmentimportexport.feature +++ b/tests/behat/attachmentimportexport.feature @@ -6,6 +6,7 @@ Feature: Test importing and exporting of question with attachments Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the CodeRunner webservice is enabled And the following "users" exist: | username | diff --git a/tests/behat/attachments.feature b/tests/behat/attachments.feature old mode 100644 new mode 100755 index 95d52505..fd2e9d9b --- a/tests/behat/attachments.feature +++ b/tests/behat/attachments.feature @@ -6,6 +6,7 @@ Feature: Test editing and using attachments to a CodeRunner question Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | diff --git a/tests/behat/backup_and_restore.feature b/tests/behat/backup_and_restore.feature old mode 100644 new mode 100755 diff --git a/tests/behat/behat_coderunner.php b/tests/behat/behat_coderunner.php old mode 100644 new mode 100755 index c1ae32e8..ea73fabf --- a/tests/behat/behat_coderunner.php +++ b/tests/behat/behat_coderunner.php @@ -24,7 +24,7 @@ use Behat\Mink\Exception\ExpectationException; use Facebook\WebDriver\Exception\NoSuchAlertException; - +use Moodle\BehatExtension\Exception\SkippedException; class behat_coderunner extends behat_base { @@ -312,7 +312,17 @@ public function i_set_the_field_and_dismiss_the_alert($field, $value) { } } - + /** + * Skips scenario if the given language is not installed on the Jobe server + * + * @Given /^the Jobe server supports "(?P[^"]+)"$/ + */ + public function jobe_supports_lanugage(string $lang): void { + if (qtype_coderunner_sandbox::get_best_sandbox($lang, true) === null) { + $msg = "$lang is not installed on your server. Scenario skipped."; + throw new SkippedException($msg); + } + } /** * Presses a named button. Checks if there is a specified error text displayed. diff --git a/tests/behat/check_graph_question_types.feature b/tests/behat/check_graph_question_types.feature old mode 100644 new mode 100755 index f7807101..44b3b24a --- a/tests/behat/check_graph_question_types.feature +++ b/tests/behat/check_graph_question_types.feature @@ -6,6 +6,7 @@ Feature: Check that the directed and undirected graph question types work. Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | diff --git a/tests/behat/check_python_template_params.feature b/tests/behat/check_python_template_params.feature old mode 100644 new mode 100755 index f50c3d76..7e53be41 --- a/tests/behat/check_python_template_params.feature +++ b/tests/behat/check_python_template_params.feature @@ -7,6 +7,7 @@ Feature: Check that Python and other languages can be used instead of Twig as a Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | Last | teacher1@asd.com | diff --git a/tests/behat/check_stepinfo.feature b/tests/behat/check_stepinfo.feature old mode 100644 new mode 100755 index 36c91e91..1d7c95f1 --- a/tests/behat/check_stepinfo.feature +++ b/tests/behat/check_stepinfo.feature @@ -6,6 +6,7 @@ Feature: Check that the QUESTION.stepinfo record is working. Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | diff --git a/tests/behat/check_twig_student_variable.feature b/tests/behat/check_twig_student_variable.feature old mode 100644 new mode 100755 index c2cefa7b..ee3bc1d6 --- a/tests/behat/check_twig_student_variable.feature +++ b/tests/behat/check_twig_student_variable.feature @@ -6,6 +6,7 @@ Feature: Check the STUDENT Twig variable allows access to current username in Co Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | diff --git a/tests/behat/create_python3_sqr_function.feature b/tests/behat/create_python3_sqr_function.feature old mode 100644 new mode 100755 index b6d0d9df..f2f66495 --- a/tests/behat/create_python3_sqr_function.feature +++ b/tests/behat/create_python3_sqr_function.feature @@ -6,6 +6,7 @@ Feature: Create a CodeRunner question (the sqr function example) Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | diff --git a/tests/behat/duplicate_prototype.feature b/tests/behat/duplicate_prototype.feature old mode 100644 new mode 100755 diff --git a/tests/behat/edit.feature b/tests/behat/edit.feature old mode 100644 new mode 100755 diff --git a/tests/behat/edit_question_precheck.feature b/tests/behat/edit_question_precheck.feature old mode 100644 new mode 100755 diff --git a/tests/behat/edit_table.feature b/tests/behat/edit_table.feature old mode 100644 new mode 100755 index 71ce0260..f3af948c --- a/tests/behat/edit_table.feature +++ b/tests/behat/edit_table.feature @@ -6,6 +6,7 @@ Feature: Test editing a CodeRunner question using the Table UI Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | diff --git a/tests/behat/export.feature b/tests/behat/export.feature old mode 100644 new mode 100755 diff --git a/tests/behat/gapfiller_ui.feature b/tests/behat/gapfiller_ui.feature old mode 100644 new mode 100755 index f036aa40..96e7b415 --- a/tests/behat/gapfiller_ui.feature +++ b/tests/behat/gapfiller_ui.feature @@ -6,6 +6,7 @@ Feature: Test the GapFiller_UI Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | diff --git a/tests/behat/grading_scenarios.feature b/tests/behat/grading_scenarios.feature old mode 100644 new mode 100755 index f3306fa5..40ae7bcf --- a/tests/behat/grading_scenarios.feature +++ b/tests/behat/grading_scenarios.feature @@ -6,6 +6,7 @@ Feature: Check grading with the Python 3 sqr function CodeRunner question Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | diff --git a/tests/behat/html_ui.feature b/tests/behat/html_ui.feature old mode 100644 new mode 100755 index 56de0933..9778df33 --- a/tests/behat/html_ui.feature +++ b/tests/behat/html_ui.feature @@ -6,6 +6,7 @@ Feature: Test the HTML_UI Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | diff --git a/tests/behat/import.feature b/tests/behat/import.feature old mode 100644 new mode 100755 diff --git a/tests/behat/make_combinator_prototype.feature b/tests/behat/make_combinator_prototype.feature old mode 100644 new mode 100755 index 4c195b8a..028773ca --- a/tests/behat/make_combinator_prototype.feature +++ b/tests/behat/make_combinator_prototype.feature @@ -6,6 +6,7 @@ Feature: make_combinator_prototype Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | diff --git a/tests/behat/make_prototype.feature b/tests/behat/make_prototype.feature old mode 100644 new mode 100755 index 8d5cbcd3..fced132a --- a/tests/behat/make_prototype.feature +++ b/tests/behat/make_prototype.feature @@ -6,6 +6,7 @@ Feature: make_prototype Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | diff --git a/tests/behat/missing_prototype.feature b/tests/behat/missing_prototype.feature old mode 100644 new mode 100755 index db01f4ff..aea496e4 --- a/tests/behat/missing_prototype.feature +++ b/tests/behat/missing_prototype.feature @@ -67,6 +67,7 @@ Feature: missing_prototype Then I should see "Broken question (missing or duplicate prototype 'python3_test_prototype'). Cannot be run." Scenario: As a teacher, I should be able to re-parent the question and have it work correctly + Given the Jobe server supports "python3" And I am on the "Prototype tester" "core_question > edit" page Then I should see "This question was defined to be of type 'python3_test_prototype' but the prototype does not exist, or is unavailable in this context" And I set the field "id_coderunnertype" to "python3" diff --git a/tests/behat/reset_button.feature b/tests/behat/reset_button.feature old mode 100644 new mode 100755 index 3945795a..9e76fc9f --- a/tests/behat/reset_button.feature +++ b/tests/behat/reset_button.feature @@ -6,6 +6,7 @@ Feature: Preview the Python 3 sqr function CodeRunner question with a preload Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | diff --git a/tests/behat/run_python3_sqr_function.feature b/tests/behat/run_python3_sqr_function.feature old mode 100644 new mode 100755 index 34448259..00498aee --- a/tests/behat/run_python3_sqr_function.feature +++ b/tests/behat/run_python3_sqr_function.feature @@ -6,6 +6,7 @@ Feature: Preview the Python 3 sqr function CodeRunner question Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | diff --git a/tests/behat/run_python3_sqr_function_templated.feature b/tests/behat/run_python3_sqr_function_templated.feature old mode 100644 new mode 100755 index f7755100..c5a02310 --- a/tests/behat/run_python3_sqr_function_templated.feature +++ b/tests/behat/run_python3_sqr_function_templated.feature @@ -6,6 +6,7 @@ Feature: Combinator template is called test-by-test if a runtime error occurs wh Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | diff --git a/tests/behat/sandbox_webservice.feature b/tests/behat/sandbox_webservice.feature old mode 100644 new mode 100755 index 6eb3c85c..05117b35 --- a/tests/behat/sandbox_webservice.feature +++ b/tests/behat/sandbox_webservice.feature @@ -5,6 +5,7 @@ Feature: Test sandbox web service Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the following "users" exist: | username | firstname | lastname | email | | teacher | Teacher | 1 | teacher@asd.com | diff --git a/tests/behat/scratchpad_ui.feature b/tests/behat/scratchpad_ui.feature old mode 100644 new mode 100755 index 42ff8a8c..4d9c38fc --- a/tests/behat/scratchpad_ui.feature +++ b/tests/behat/scratchpad_ui.feature @@ -6,6 +6,7 @@ Feature: Test the Scratchpad UI Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the CodeRunner webservice is enabled And the following "users" exist: | username | firstname | lastname | email | diff --git a/tests/behat/scratchpad_ui_params.feature b/tests/behat/scratchpad_ui_params.feature old mode 100644 new mode 100755 index 891d8304..6cc52eb2 --- a/tests/behat/scratchpad_ui_params.feature +++ b/tests/behat/scratchpad_ui_params.feature @@ -6,6 +6,7 @@ Feature: Test the Scratchpad UI, UI Params Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the CodeRunner webservice is enabled And the following "users" exist: | username | firstname | lastname | email | diff --git a/tests/behat/set_uiplugin.feature b/tests/behat/set_uiplugin.feature old mode 100644 new mode 100755 diff --git a/tests/behat/showdifferences_button.feature b/tests/behat/showdifferences_button.feature old mode 100644 new mode 100755 index b5d1d2ec..a73c9acd --- a/tests/behat/showdifferences_button.feature +++ b/tests/behat/showdifferences_button.feature @@ -6,6 +6,7 @@ Feature: Show differences in CodeRunner questions Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | diff --git a/tests/behat/template_params_error.feature b/tests/behat/template_params_error.feature index cfe26cc4..611d6652 100644 --- a/tests/behat/template_params_error.feature +++ b/tests/behat/template_params_error.feature @@ -28,6 +28,7 @@ Feature: template_params_error And I disable UI plugins in the CodeRunner question type Scenario: As a teacher, I should be given an informative Twig error + Given the Jobe server supports "twig" When I am on the "Dummy question" "core_question > edit" page logged in as teacher1 And I set the field "id_templateparamslang" to "twig" And I set the following fields to these values: @@ -38,6 +39,8 @@ Feature: template_params_error Then I should see "Unexpected token" Scenario: As a teacher, I should be given an informative Python error + Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" When I am on the "Dummy question" "core_question > edit" page logged in as teacher1 And I set the field "id_templateparamslang" to "python3" And I set the following fields to these values: @@ -48,6 +51,7 @@ Feature: template_params_error Then I should see "SyntaxError" Scenario: As a teacher, I should be given an informative C error + Given the Jobe server supports "c" When I am on the "Dummy question" "core_question > edit" page logged in as teacher1 And I set the field "id_templateparamslang" to "c" And I set the following fields to these values: @@ -58,6 +62,7 @@ Feature: template_params_error Then I should see "error: missing terminating > character" Scenario: As a teacher, I should be given an informative Java error + Given the Jobe server supports "java" When I am on the "Dummy question" "core_question > edit" page logged in as teacher1 And I set the field "id_templateparamslang" to "java" And I set the following fields to these values: @@ -68,6 +73,7 @@ Feature: template_params_error Then I should see "NO_PUBLIC_CLASS_FOUND.java" Scenario: As a teacher, I should be given an informative php error + Given the Jobe server supports "php" When I am on the "Dummy question" "core_question > edit" page logged in as teacher1 And I set the field "id_templateparamslang" to "php" And I set the field "id_templateparams" to: @@ -82,6 +88,7 @@ Feature: template_params_error Then I should see "PHP Parse error:" Scenario: As a teacher, I should be given an informative Octave error + Given the Jobe server supports "octave" When I am on the "Dummy question" "core_question > edit" page logged in as teacher1 And I set the field "id_templateparamslang" to "octave" And I set the following fields to these values: @@ -92,6 +99,7 @@ Feature: template_params_error Then I should see "Run error" Scenario: As a teacher, I should be given an informative Pascal error + Given the Jobe server supports "pascal" When I am on the "Dummy question" "core_question > edit" page logged in as teacher1 And I set the field "id_templateparamslang" to "pascal" And I set the following fields to these values: diff --git a/tests/behat/test_combinator_grader.feature b/tests/behat/test_combinator_grader.feature old mode 100644 new mode 100755 index c5502d64..079344b8 --- a/tests/behat/test_combinator_grader.feature +++ b/tests/behat/test_combinator_grader.feature @@ -6,6 +6,7 @@ Feature: test_combinator_grader Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com | diff --git a/tests/behat/twigprefix.feature b/tests/behat/twigprefix.feature old mode 100644 new mode 100755 index 5099d1cc..10bc65fd --- a/tests/behat/twigprefix.feature +++ b/tests/behat/twigprefix.feature @@ -6,6 +6,7 @@ Feature: twigprefix Background: Given the CodeRunner test configuration file is loaded + And the Jobe server supports "python3" And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@asd.com |