Exemplo n.º 1
0
 public function grabValueFrom($field)
 {
     $el = $this->findField($field);
     // value of multiple select is the value of the first selected option
     if ($el->getTagName() == 'select') {
         $select = new \WebDriverSelect($el);
         return $select->getFirstSelectedOption()->getAttribute('value');
     }
     return $el->getAttribute('value');
 }
 /**
  * Assert that the password has a specific permission for a target user
  * @param $password
  * @param $username
  * @param $permissionType
  * @param $options
  */
 public function assertPermission($password, $username, $permissionType, $options = array())
 {
     $this->gotoSharePassword($password['id']);
     // I can see the user has a direct permission
     $this->assertElementContainsText($this->findByCss('#js_permissions_list'), $username);
     // Find the permission row element
     $rowElement = $this->findByXpath('//*[@id="js_permissions_list"]//*[.="' . $username . '"]//ancestor::li[1]');
     // I can see the permission is as expected
     $select = new WebDriverSelect($rowElement->findElement(WebDriverBy::cssSelector('.js_share_rs_perm_type')));
     $this->assertEquals($permissionType, $select->getFirstSelectedOption()->getText());
     // Close the dialog
     if (!isset($options['closeDialog']) || $options['closeDialog'] == true) {
         $this->find('.dialog .dialog-close')->click();
     }
 }
Exemplo n.º 3
0
 /**
 * Modifies a field on either the user account or my preferences page
 * and checks that the modification was recorded in the database.
 *
 * @param string $page      either 'user_accounts' or
                            'user_accounts/my_preferences'.
 * @param string $userId    ID of the user to modify.
 * @param string $fieldName name of the field (on the HTML page) that should
 *                          be modified.
 * @param string $newValue  new field value.
 *
 * @return void
 */
 function _verifyUserModification($page, $userId, $fieldName, $newValue)
 {
     $this->_accessUser($page, $userId);
     $field = $this->safeFindElement(WebDriverBy::Name($fieldName));
     if ($field->getTagName() == 'input') {
         $field->clear();
         $field->sendKeys($newValue);
     } else {
         $selectField = new WebDriverSelect($field);
         $selectField->selectByVisibleText($newValue);
     }
     $this->safeClick(WebDriverBy::Name('fire_away'));
     $this->_accessUser($page, $userId);
     $field = $this->safeFindElement(WebDriverBy::Name($fieldName));
     if ($field->getTagName() == 'input') {
         $this->assertEquals($field->getAttribute('value'), $newValue);
     } else {
         $selectField = new WebDriverSelect($field);
         $this->assertEquals($selectField->getFirstSelectedOption()->getText(), $newValue);
     }
 }
Exemplo n.º 4
0
 /**
  * Tests that,in the not resolved menu, change the Resolution status of the first row.
  * Save it and check it. 
  *
  * @return void
  */
 function testNotResolvedSaveButton()
 {
     $this->safeGet($this->url . "/mri_violations/");
     $resolutionElement = $this->safeFindElement(WebDriverBy::Name("resolvable[c57b919a921eaa1a43bb5e0c44cd4226]"));
     $resolution = new WebDriverSelect($resolutionElement);
     $resolution->selectByVisibleText("Inserted");
     $this->safeClick(WebDriverBy::Name("fire_away"));
     $resolutionElement = $this->safeFindElement(WebDriverBy::Name("resolvable[c57b919a921eaa1a43bb5e0c44cd4226]"));
     $resolution = new WebDriverSelect($resolutionElement);
     $value = $resolution->getFirstSelectedOption()->getAttribute('value');
     $this->assertEquals("inserted", $value);
 }
Exemplo n.º 5
0
 /**
  * Tests clear button in the form
  * The form should refreash and the data should be gone.
  * @return void
  */
 function testdicomArchivFilterClearBtn()
 {
     $this->markTestSkipped("This method isn't working properly on travis.");
     //testing the Patient Name
     $this->safeGet($this->url . "/dicom_archive/");
     $nameElement = $this->safeFindElement(WebDriverBy::Name("PatientName"));
     $nameElement->sendKeys("TestPatientName");
     $this->safeClick(WebDriverBy::Name("reset"));
     $name = $this->safeFindElement(WebDriverBy::Name("PatientName"))->getAttribute('value');
     $this->assertEquals('', $name);
     //testing the Archive Location
     $locationElement = $this->safeFindElement(WebDriverBy::Name("Location"));
     $locationElement->sendKeys("TestLocation");
     $this->safeClick(WebDriverBy::Name("reset"));
     $location = $this->safeFindElement(WebDriverBy::Name("Location"))->getAttribute('value');
     $this->assertEquals('', $location);
     //testing the Patient ID
     $idElement = $this->safeFindElement(WebDriverBy::Name("PatientID"));
     $idElement->sendKeys("TestID");
     $this->safeClick(WebDriverBy::Name("reset"));
     $idText = $this->safeFindElement(WebDriverBy::Name("PatientID"))->getAttribute('value');
     $this->assertEquals('', $idText);
     //testing the Gender
     $genderElement = $this->safeFindElement(WebDriverBy::Name("Gender"));
     $gender = new WebDriverSelect($genderElement);
     $gender->selectByVisibleText("Male");
     $this->safeClick(WebDriverBy::Name("reset"));
     $genderElement = $this->safeFindElement(WebDriverBy::Name("Gender"));
     $gender = new WebDriverSelect($genderElement);
     $value = $gender->getFirstSelectedOption()->getAttribute('value');
     $this->assertEquals("", $value);
 }
Exemplo n.º 6
0
 /**
  * Tests that, input some data and click click clear button, check the results.
  * The form should refreash and the data should be gone.
  * @return void
  */
 function testReliabilityClearFormButton()
 {
     //testing search by PSCID
     $this->safeGet($this->url . "/reliability/");
     $this->webDriver->findElement(WebDriverBy::Name("PSCID"))->sendKeys("8888");
     $this->webDriver->findElement(WebDriverBy::Name("reset"))->click();
     $bodyText = $this->webDriver->findElement(WebDriverBy::Name("PSCID"))->getText();
     $this->assertEquals("", $bodyText);
     //testing search by DCCID
     $this->safeGet($this->url . "/reliability/");
     $this->webDriver->findElement(WebDriverBy::Name("DCCID"))->sendKeys("8888");
     $this->webDriver->findElement(WebDriverBy::Name("reset"))->click();
     $bodyText = $this->webDriver->findElement(WebDriverBy::Name("PSCID"))->getText();
     $this->assertEquals("", $bodyText);
     //testing search by Gender
     $this->safeGet($this->url . "/reliability/");
     $genderElement = $this->safeFindElement(WebDriverBy::Name("Gender"));
     $gender = new WebDriverSelect($genderElement);
     $gender->selectByVisibleText("Male");
     $this->webDriver->findElement(WebDriverBy::Name("reset"))->click();
     $genderElement = $this->safeFindElement(WebDriverBy::Name("Gender"));
     $gender = new WebDriverSelect($genderElement);
     $value = $gender->getFirstSelectedOption()->getAttribute('value');
     $this->assertEquals("", $value);
 }