forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-42025 assignfeedback_editpdf: add behat tests
- Loading branch information
1 parent
3aa7190
commit 9e103d6
Showing
3 changed files
with
140 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
mod/assign/feedback/editpdf/tests/behat/annotate_pdf.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
@mod @mod_assign @assignfeedback @assignfeedback_editpdf @_only_local | ||
Feature: In an assignment, teacher can annotate PDF files during grading | ||
In order to provide visual report on a graded PDF | ||
As a teacher | ||
I need to use the PDF editor | ||
|
||
@javascript | ||
Scenario: Submit a PDF file as a student and annotate the PDF as a teacher | ||
Given ghostscript is installed | ||
And the following "courses" exists: | ||
| fullname | shortname | category | groupmode | | ||
| Course 1 | C1 | 0 | 1 | | ||
And the following "users" exists: | ||
| username | firstname | lastname | email | | ||
| teacher1 | Teacher | 1 | teacher1@asd.com | | ||
| student1 | Student | 1 | student1@asd.com | | ||
And the following "course enrolments" exists: | ||
| user | course | role | | ||
| teacher1 | C1 | editingteacher | | ||
| student1 | C1 | student | | ||
And I log in as "admin" | ||
And I expand "Site administration" node | ||
And I expand "Plugins" node | ||
And I expand "Activity modules" node | ||
And I expand "Assignment" node | ||
And I expand "Feedback plugins" node | ||
And I follow "Annotate PDF" | ||
And I upload "pix/help.png" file to "" filemanager | ||
And I upload "pix/docs.png" file to "" filemanager | ||
When I press "Save changes" | ||
Then I should see "Changes saved" | ||
And I follow "Test ghostscript path" | ||
And I should see "The ghostscript path appears to be OK" | ||
And I log out | ||
And I log in as "teacher1" | ||
And I follow "Course 1" | ||
And I turn editing mode on | ||
And I add a "Assignment" to section "1" and I fill the form with: | ||
| Assignment name | Test assignment name | | ||
| Description | Submit your PDF file | | ||
| assignsubmission_file_enabled | 1 | | ||
| Maximum number of uploaded files | 2 | | ||
And I log out | ||
And I log in as "student1" | ||
And I follow "Course 1" | ||
And I follow "Test assignment name" | ||
And I press "Add submission" | ||
And I upload "mod/assign/feedback/editpdf/tests/fixtures/submission.pdf" file to "File submissions" filemanager | ||
And I upload "mod/assign/feedback/editpdf/tests/fixtures/testgs.pdf" file to "File submissions" filemanager | ||
And I press "Save changes" | ||
And I should see "Submitted for grading" | ||
And I should see "submission.pdf" | ||
And I should see "Not graded" | ||
And I log out | ||
And I log in as "teacher1" | ||
And I follow "Course 1" | ||
And I follow "Test assignment name" | ||
And I follow "View/grade all submissions" | ||
And I click on "Grade" "link" in the "Submitted for grading" "table_row" | ||
And I follow "Launch PDF editor..." | ||
And I click on ".navigate-next-button" "css_element" | ||
And I click on ".stampbutton" "css_element" | ||
And I click on ".linebutton" "css_element" | ||
And I click on ".commentcolourbutton" "css_element" | ||
And I click on "//img[@alt=\"Blue\"]" "xpath_element" | ||
And I click on "Close" "button" | ||
And I press "Save changes" | ||
And I should see "The grade changes were saved" |
54 changes: 54 additions & 0 deletions
54
mod/assign/feedback/editpdf/tests/behat/behat_assignfeedback_editpdf.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Behat editpdf-related steps definitions. | ||
* | ||
* @package assignfeedback_editpdf | ||
* @category test | ||
* @copyright 2013 Jerome Mouneyrac | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php. | ||
|
||
require_once(__DIR__ . '/../../../../../../lib/behat/behat_base.php'); | ||
|
||
use Behat\Behat\Context\Step\Given as Given; | ||
|
||
/** | ||
* Steps definitions related with the editpdf. | ||
* | ||
* @package assignfeedback_editpdf | ||
* @category test | ||
* @copyright 2013 Jerome Mouneyrac | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class behat_assignfeedback_editpdf extends behat_base { | ||
|
||
/** | ||
* Checks that Ghostscript is installed. | ||
* | ||
* @Given /^ghostscript is installed$/ | ||
*/ | ||
public function ghostscript_is_installed() { | ||
$testpath = assignfeedback_editpdf\pdf::test_gs_path(); | ||
if (!extension_loaded('zlib') or | ||
$testpath->status !== assignfeedback_editpdf\pdf::GSPATH_OK) { | ||
throw new \Moodle\BehatExtension\Exception\SkippedException; | ||
} | ||
} | ||
} |