コード例 #1
0
 /**
  * @test
  */
 public function setFilter_TestFilters_ShouldFilterContacts()
 {
     $contactName_1 = 'Test Filter 1';
     $contactName_2 = 'Test Filter 2';
     $this->contactManagerPage->addContact($contactName_1, false);
     $message = $this->contactManagerPage->getAlertMessage();
     $this->assertTrue(strpos($message, 'Contact successfully saved') >= 0, 'Contact save should return success');
     $state = $this->contactManagerPage->getState($contactName_1);
     $this->assertEquals('published', $state, 'Initial state should be published');
     $this->contactManagerPage->addContact($contactName_2, false);
     $message = $this->contactManagerPage->getAlertMessage();
     $this->assertTrue(strpos($message, 'Contact successfully saved') >= 0, 'Contact save should return success');
     $state = $this->contactManagerPage->getState($contactName_2);
     $this->assertEquals('published', $state, 'Initial state should be published');
     $this->contactManagerPage->changeContactState($contactName_2, 'unpublished');
     $test = $this->contactManagerPage->setFilter('filter_published', 'Unpublished');
     $this->assertFalse($this->contactManagerPage->getRowNumber($contactName_1), 'Contact should not show');
     $this->assertEquals(1, $this->contactManagerPage->getRowNumber($contactName_2), 'Contact should be in row 1');
     $test = $this->contactManagerPage->setFilter('filter_published', 'Published');
     $this->assertFalse($this->contactManagerPage->getRowNumber($contactName_2), 'Contact should not show');
     $this->assertEquals(8, $this->contactManagerPage->getRowNumber($contactName_1), 'Contact should be in row 8');
     $this->contactManagerPage->setFilter('Select Status', 'Select Status');
     $this->contactManagerPage->trashAndDelete($contactName_1);
     $this->contactManagerPage->trashAndDelete($contactName_2);
 }
コード例 #2
0
 /**
  * @test
  */
 public function addContact_WithGivenFields_ContactAdded()
 {
     $salt = rand();
     $contactName = 'Contact' . $salt;
     $address = '10 Downing Street';
     $city = 'London';
     $country = 'England';
     $this->assertFalse($this->contactManagerPage->getRowNumber($contactName), 'Test contact should not be present');
     $this->contactManagerPage->addContact($contactName, array('Country' => $country, 'Address' => $address, 'City or Suburb' => $city));
     $message = $this->contactManagerPage->getAlertMessage();
     $this->assertTrue(strpos($message, 'Contact successfully saved') >= 0, 'Contact save should return success');
     $this->assertEquals(5, $this->contactManagerPage->getRowNumber($contactName), 'Test test contact should be in row 5');
     $values = $this->contactManagerPage->getFieldValues('ContactEditPage', $contactName, array('Name', 'Address', 'City or Suburb', 'Country'));
     $this->assertEquals(array($contactName, $address, $city, $country), $values, 'Actual name, address, city and country should match expected');
     $this->contactManagerPage->trashAndDelete($contactName);
     $this->assertFalse($this->contactManagerPage->getRowNumber($contactName), 'Test contact should not be present');
 }