Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions tests/behat/ace_scratchpad_compatibility.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions tests/behat/attachmentimportexport.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
1 change: 1 addition & 0 deletions tests/behat/attachments.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 | [email protected] |
Expand Down
Empty file modified tests/behat/backup_and_restore.feature
100644 → 100755
Empty file.
14 changes: 12 additions & 2 deletions tests/behat/behat_coderunner.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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<lang>[^"]+)"$/
*/
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.
Expand Down
1 change: 1 addition & 0 deletions tests/behat/check_graph_question_types.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 | [email protected] |
Expand Down
1 change: 1 addition & 0 deletions tests/behat/check_python_template_params.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 | [email protected] |
Expand Down
1 change: 1 addition & 0 deletions tests/behat/check_stepinfo.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 | [email protected] |
Expand Down
1 change: 1 addition & 0 deletions tests/behat/check_twig_student_variable.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 | [email protected] |
Expand Down
1 change: 1 addition & 0 deletions tests/behat/create_python3_sqr_function.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 | [email protected] |
Expand Down
Empty file modified tests/behat/duplicate_prototype.feature
100644 → 100755
Empty file.
Empty file modified tests/behat/edit.feature
100644 → 100755
Empty file.
Empty file modified tests/behat/edit_question_precheck.feature
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions tests/behat/edit_table.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 | [email protected] |
Expand Down
Empty file modified tests/behat/export.feature
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions tests/behat/gapfiller_ui.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 | [email protected] |
Expand Down
1 change: 1 addition & 0 deletions tests/behat/grading_scenarios.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 | [email protected] |
Expand Down
1 change: 1 addition & 0 deletions tests/behat/html_ui.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 | [email protected] |
Expand Down
Empty file modified tests/behat/import.feature
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions tests/behat/make_combinator_prototype.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 | [email protected] |
Expand Down
1 change: 1 addition & 0 deletions tests/behat/make_prototype.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 | [email protected] |
Expand Down
1 change: 1 addition & 0 deletions tests/behat/missing_prototype.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions tests/behat/reset_button.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 | [email protected] |
Expand Down
1 change: 1 addition & 0 deletions tests/behat/run_python3_sqr_function.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 | [email protected] |
Expand Down
1 change: 1 addition & 0 deletions tests/behat/run_python3_sqr_function_templated.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 | [email protected] |
Expand Down
1 change: 1 addition & 0 deletions tests/behat/sandbox_webservice.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 | [email protected] |
Expand Down
1 change: 1 addition & 0 deletions tests/behat/scratchpad_ui.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
1 change: 1 addition & 0 deletions tests/behat/scratchpad_ui_params.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
Empty file modified tests/behat/set_uiplugin.feature
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions tests/behat/showdifferences_button.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 | [email protected] |
Expand Down
8 changes: 8 additions & 0 deletions tests/behat/template_params_error.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions tests/behat/test_combinator_grader.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 | [email protected] |
Expand Down
1 change: 1 addition & 0 deletions tests/behat/twigprefix.feature
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 | [email protected] |
Expand Down