/** * @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); }
/** * @test */ public function changeContactState_ChangeEnabledUsingToolbar_EnabledChanged() { $salt = rand(); $contactName = 'Contact' . $salt; $this->contactManagerPage->addContact($contactName, false); $state = $this->contactManagerPage->getState($contactName); $this->assertEquals('published', $state, 'Initial state should be published'); $this->contactManagerPage->changeContactState($contactName, 'unpublished'); $state = $this->contactManagerPage->getState($contactName); $this->assertEquals('unpublished', $state, 'State should be unpublished'); $this->contactManagerPage->trashAndDelete($contactName); }