Ver código fonte

Add #behat test to check hide_scorm_pdf_link - #2521

Yannick Warnier 6 anos atrás
pai
commit
825ac2ca25

+ 27 - 0
tests/behat/features/bootstrap/FeatureContext.php

@@ -446,4 +446,31 @@ class FeatureContext extends MinkContext
 
         return true;
     }
+
+    /**
+     * @Then /^I should see an icon with title "([^"]*)"$/
+     */
+    public function iShouldSeeAnIconWithTitle($value)
+    {
+        $el = $this->getSession()->getPage()->find('xpath', "//img[@title='$value']");
+        if (null === $el) {
+            throw new Exception(
+                'Could not find an icon with title: '.$value
+            );
+        }
+        return true;
+    }
+    /**
+     * @Then /^I should not see an icon with title "([^"]*)"$/
+     */
+    public function iShouldNotSeeAnIconWithTitle($value)
+    {
+        $el = $this->getSession()->getPage()->find('xpath', "//img[@title='$value']");
+        if (null !== $el) {
+            throw new Exception(
+                'Found an icon with title: '.$value
+            );
+        }
+        return true;
+    }
 }

+ 14 - 1
tests/behat/features/toolLp.feature

@@ -54,9 +54,22 @@ Feature: LP tool
     And I follow "Delete"
     Then I should not see "LP category 1"
 
+  Scenario: Check the PDF export in LP list
+    Given I am on "/main/admin/settings.php?category=Course"
+    And I check the "hide_scorm_pdf_link" radio button with "false" value
+    And I press "Save settings"
+    And I am on "/main/lp/lp_controller.php?cidReq=TEMP&action=list&isStudentView=true"
+    Then I should see an icon with title "Export to PDF"
+
+  Scenario: Check the PDF export in LP list
+    Given I am on "/main/admin/settings.php?category=Course"
+    And I check the "hide_scorm_pdf_link" radio button with "true" value
+    And I press "Save settings"
+    And I am on "/main/lp/lp_controller.php?cidReq=TEMP&action=list&isStudentView=true"
+    Then I should not see an icon with title "Export to PDF"
+
   Scenario: Delete a LP
     Given I am on "/main/lp/lp_controller.php?cidReq=TEMP&action=list"
     And I follow "Delete"
     And I confirm the popup
     Then I should not see "LP 1"
-