Skip to content

Commit

Permalink
File question type Behat tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaboesch committed Feb 24, 2024
1 parent 2ed2853 commit 4487857
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
4 changes: 0 additions & 4 deletions classes/question/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ protected function question_survey_display($formdata, $descendantsdata, $blankqu
$output->render($fm) .
'</div>';

/* $html .= '<input value="' . $draftitemid . '" name="' . $elname . '" type="hidden" />';
$html .= '<input value="" id="' . $this->id . '" type="hidden" />';
*/

return $html;
}

Expand Down
7 changes: 4 additions & 3 deletions tests/behat/behat_mod_questionnaire.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ protected function get_filepicker_node($question) {
$exception = new ExpectationException('The filepicker for the question with text "' . $question .
'" can not be found', $this->getSession());

$filepickercontainer = $this->find(
$filepickercontainer = $this->find(
'xpath',
"//p[contains(.,'" . $question . "')]" .
"//parent::div[contains(concat(' ', normalize-space(@class), ' '), ' no-overflow ')]" .
Expand All @@ -514,7 +514,8 @@ protected function get_filepicker_node($question) {
* @throws DriverException
* @throws ExpectationException Thrown by behat_base::find
*/
protected function upload_file_to_question_filemanager_questionnaire($filepath, $question, TableNode $data, $overwriteaction = false) {
protected function upload_file_to_question_filemanager_questionnaire($filepath, $question, TableNode $data,
$overwriteaction = false) {
global $CFG;

if (!$this->has_tag('_file_upload')) {
Expand Down Expand Up @@ -600,7 +601,7 @@ protected function open_add_file_window($filemanagernode, $repositoryname) {
$exception = new ExpectationException('No files can be added to the specified filemanager', $this->getSession());

// We should deal with single-file and multiple-file filemanagers,
// catching the exception thrown by behat_base::find() in case is not multiple
// catching the exception thrown by behat_base::find() in case is not multiple.
$this->execute('behat_general::i_click_on_in_the', [
'div.fp-btn-add a, input.fp-btn-choose', 'css_element',
$filemanagernode, 'NodeElement'
Expand Down
Binary file added tests/fixtures/testfilequestion2.pdf
Binary file not shown.

0 comments on commit 4487857

Please sign in to comment.