| 1 | 
           efrain | 
           1 | 
           <?php
  | 
        
        
            | 
            | 
           2 | 
           // This file is part of Moodle - http://moodle.org/
  | 
        
        
            | 
            | 
           3 | 
           //
  | 
        
        
            | 
            | 
           4 | 
           // Moodle is free software: you can redistribute it and/or modify
  | 
        
        
            | 
            | 
           5 | 
           // it under the terms of the GNU General Public License as published by
  | 
        
        
            | 
            | 
           6 | 
           // the Free Software Foundation, either version 3 of the License, or
  | 
        
        
            | 
            | 
           7 | 
           // (at your option) any later version.
  | 
        
        
            | 
            | 
           8 | 
           //
  | 
        
        
            | 
            | 
           9 | 
           // Moodle is distributed in the hope that it will be useful,
  | 
        
        
            | 
            | 
           10 | 
           // but WITHOUT ANY WARRANTY; without even the implied warranty of
  | 
        
        
            | 
            | 
           11 | 
           // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  | 
        
        
            | 
            | 
           12 | 
           // GNU General Public License for more details.
  | 
        
        
            | 
            | 
           13 | 
           //
  | 
        
        
            | 
            | 
           14 | 
           // You should have received a copy of the GNU General Public License
  | 
        
        
            | 
            | 
           15 | 
           // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  | 
        
        
            | 
            | 
           16 | 
              | 
        
        
            | 
            | 
           17 | 
           /**
  | 
        
        
            | 
            | 
           18 | 
            * Behat custom steps and configuration for mod_bigbluebuttonbn.
  | 
        
        
            | 
            | 
           19 | 
            *
  | 
        
        
            | 
            | 
           20 | 
            * @package   mod_assign
  | 
        
        
            | 
            | 
           21 | 
            * @category  test
  | 
        
        
            | 
            | 
           22 | 
            * @copyright 2024 Simey Lameze <simey@moodle.com>
  | 
        
        
            | 
            | 
           23 | 
            * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  | 
        
        
            | 
            | 
           24 | 
            */
  | 
        
        
            | 
            | 
           25 | 
           require_once(__DIR__ . '/../../../../lib/behat/behat_base.php');
  | 
        
        
            | 
            | 
           26 | 
              | 
        
        
            | 
            | 
           27 | 
           use Behat\Gherkin\Node\TableNode;
  | 
        
        
            | 
            | 
           28 | 
              | 
        
        
            | 
            | 
           29 | 
           /**
  | 
        
        
            | 
            | 
           30 | 
            * Behat custom steps and configuration for mod_assign.
  | 
        
        
            | 
            | 
           31 | 
            *
  | 
        
        
            | 
            | 
           32 | 
            * @package   mod_assign
  | 
        
        
            | 
            | 
           33 | 
            * @category  test
  | 
        
        
            | 
            | 
           34 | 
            * @copyright 2024 Simey Lameze <simey@moodle.com>
  | 
        
        
            | 
            | 
           35 | 
            * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  | 
        
        
            | 
            | 
           36 | 
            */
  | 
        
        
            | 
            | 
           37 | 
           class behat_mod_assign extends behat_base {
  | 
        
        
            | 
            | 
           38 | 
              | 
        
        
            | 
            | 
           39 | 
               /**
  | 
        
        
            | 
            | 
           40 | 
                * Check that the marking guide information is displayed correctly.
  | 
        
        
            | 
            | 
           41 | 
                *
  | 
        
        
            | 
            | 
           42 | 
                * @Then /^I should see the marking guide information displayed as:$/
  | 
        
        
            | 
            | 
           43 | 
                * @param TableNode $table The table of marking guide information to check.
  | 
        
        
            | 
            | 
           44 | 
                */
  | 
        
        
            | 
            | 
           45 | 
               public function i_should_see_marking_guide_information(TableNode $table) {
  | 
        
        
            | 
            | 
           46 | 
              | 
        
        
            | 
            | 
           47 | 
                   if (!$table->getRowsHash()) {
  | 
        
        
            | 
            | 
           48 | 
                       return;
  | 
        
        
            | 
            | 
           49 | 
                   }
  | 
        
        
            | 
            | 
           50 | 
              | 
        
        
            | 
            | 
           51 | 
                   $criteriacheck = 1;
  | 
        
        
            | 
            | 
           52 | 
                   foreach ($table as $row) {
  | 
        
        
            | 
            | 
           53 | 
              | 
        
        
            | 
            | 
           54 | 
                       $locator = "//table[@id='guide0-criteria']/tbody/tr[$criteriacheck]/td";
  | 
        
        
            | 
            | 
           55 | 
              | 
        
        
            | 
            | 
           56 | 
                       $this->assertSession()->elementContains('xpath', "{$locator}[@class='descriptionreadonly']", $row['criteria']);
  | 
        
        
            | 
            | 
           57 | 
                       $this->assertSession()->elementContains('xpath', "{$locator}[@class='descriptionreadonly']", $row['description']);
  | 
        
        
            | 
            | 
           58 | 
              | 
        
        
            | 
            | 
           59 | 
                       if (!empty($row['remark'])) {
  | 
        
        
            | 
            | 
           60 | 
                           $this->assertSession()->elementContains('xpath', "{$locator}[@class='remark']", $row['remark']);
  | 
        
        
            | 
            | 
           61 | 
                       }
  | 
        
        
            | 
            | 
           62 | 
              | 
        
        
            | 
            | 
           63 | 
                       if (!empty($row['maxscore'])) {
  | 
        
        
            | 
            | 
           64 | 
                           $this->assertSession()->elementContains('xpath', "{$locator}[@class='descriptionreadonly']", $row['maxscore']);
  | 
        
        
            | 
            | 
           65 | 
                       }
  | 
        
        
            | 
            | 
           66 | 
              | 
        
        
            | 
            | 
           67 | 
                       if (!empty($row['criteriascore'])) {
  | 
        
        
            | 
            | 
           68 | 
                           $this->assertSession()->elementContains('xpath', "{$locator}[@class='score']", $row['criteriascore']);
  | 
        
        
            | 
            | 
           69 | 
                       }
  | 
        
        
            | 
            | 
           70 | 
              | 
        
        
            | 
            | 
           71 | 
                       $criteriacheck++;
  | 
        
        
            | 
            | 
           72 | 
                   }
  | 
        
        
            | 
            | 
           73 | 
               }
  | 
        
        
            | 
            | 
           74 | 
           }
  |