Skip to content

Commit dac7963

Browse files
authored
Merge pull request #267 from alexkeel/issue_266_fix
Adds checks on behat tests that require specific language installed
2 parents eacb460 + d006fa8 commit dac7963

33 files changed

+44
-2
lines changed

tests/behat/ace_scratchpad_compatibility.feature

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Feature: Ace UI convert to Scratchpad UI questions with one click
2929
| id_answer | def sqr(n): return n * n |
3030

3131
Scenario: Edit a CodeRunner Ace UI question, changing it to be a Scratchpad UI question.
32+
Given the Jobe server supports "python3"
3233
When I set the field "id_uiplugin" to "Scratchpad"
3334
Then I should see "def sqr(n): return n * n"
3435
And I click on "Scratchpad" "button"

tests/behat/attachmentimportexport.feature

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Feature: Test importing and exporting of question with attachments
66

77
Background:
88
Given the CodeRunner test configuration file is loaded
9+
And the Jobe server supports "python3"
910
And the CodeRunner webservice is enabled
1011
And the following "users" exist:
1112
| username |

tests/behat/attachments.feature

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Feature: Test editing and using attachments to a CodeRunner question
66

77
Background:
88
Given the CodeRunner test configuration file is loaded
9+
And the Jobe server supports "python3"
910
And the following "users" exist:
1011
| username | firstname | lastname | email |
1112
| teacher1 | Teacher | 1 | teacher1@asd.com |

tests/behat/backup_and_restore.feature

100644100755
File mode changed.

tests/behat/behat_coderunner.php

100644100755
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
use Behat\Mink\Exception\ExpectationException;
2626
use Facebook\WebDriver\Exception\NoSuchAlertException;
27-
27+
use Moodle\BehatExtension\Exception\SkippedException;
2828

2929
class behat_coderunner extends behat_base {
3030

@@ -312,7 +312,17 @@ public function i_set_the_field_and_dismiss_the_alert($field, $value) {
312312
}
313313
}
314314

315-
315+
/**
316+
* Skips scenario if the given language is not installed on the Jobe server
317+
*
318+
* @Given /^the Jobe server supports "(?P<lang>[^"]+)"$/
319+
*/
320+
public function jobe_supports_lanugage(string $lang): void {
321+
if (qtype_coderunner_sandbox::get_best_sandbox($lang, true) === null) {
322+
$msg = "$lang is not installed on your server. Scenario skipped.";
323+
throw new SkippedException($msg);
324+
}
325+
}
316326

317327
/**
318328
* Presses a named button. Checks if there is a specified error text displayed.

tests/behat/check_graph_question_types.feature

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Feature: Check that the directed and undirected graph question types work.
66

77
Background:
88
Given the CodeRunner test configuration file is loaded
9+
And the Jobe server supports "python3"
910
And the following "users" exist:
1011
| username | firstname | lastname | email |
1112
| teacher1 | Teacher | 1 | teacher1@asd.com |

tests/behat/check_python_template_params.feature

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Feature: Check that Python and other languages can be used instead of Twig as a
77

88
Background:
99
Given the CodeRunner test configuration file is loaded
10+
And the Jobe server supports "python3"
1011
And the following "users" exist:
1112
| username | firstname | lastname | email |
1213
| teacher1 | Teacher | Last | teacher1@asd.com |

tests/behat/check_stepinfo.feature

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Feature: Check that the QUESTION.stepinfo record is working.
66

77
Background:
88
Given the CodeRunner test configuration file is loaded
9+
And the Jobe server supports "python3"
910
And the following "users" exist:
1011
| username | firstname | lastname | email |
1112
| teacher1 | Teacher | 1 | teacher1@asd.com |

tests/behat/check_twig_student_variable.feature

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Feature: Check the STUDENT Twig variable allows access to current username in Co
66

77
Background:
88
Given the CodeRunner test configuration file is loaded
9+
And the Jobe server supports "python3"
910
And the following "users" exist:
1011
| username | firstname | lastname | email |
1112
| teacher1 | Teacher | 1 | teacher1@asd.com |

tests/behat/create_python3_sqr_function.feature

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Feature: Create a CodeRunner question (the sqr function example)
66

77
Background:
88
Given the CodeRunner test configuration file is loaded
9+
And the Jobe server supports "python3"
910
And the following "users" exist:
1011
| username | firstname | lastname | email |
1112
| teacher1 | Teacher | 1 | teacher1@asd.com |

0 commit comments

Comments
 (0)