This repository has been archived by the owner on Dec 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HostDuplicationCheck created (#5377)
* HostDuplicationCheck created * Every tests in one step * The 'add' were deleted * Unused line deleted * Update HostDuplicationCheck.feature
- Loading branch information
1 parent
556b868
commit d4b9313
Showing
3 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Feature: HostDuplicationCheck | ||
As a Centreon admin user | ||
I want to duplicate a host | ||
To see if the Properties have changed | ||
|
||
Background: | ||
Given I am logged in a Centreon server | ||
|
||
Scenario: Duplicate a host and check the properties | ||
Given a host is created | ||
When I duplicate a host | ||
Then the host properties are updated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
use Centreon\Test\Behat\CentreonContext; | ||
use Centreon\Test\Behat\Configuration\HostConfigurationPage; | ||
use Centreon\Test\Behat\Configuration\HostConfigurationListingPage; | ||
use Centreon\Test\Behat\External\ListingPage; | ||
|
||
class HostDuplicationCheckContext extends CentreonContext | ||
{ | ||
private $currentPage; | ||
|
||
private $initialProperties = (array( | ||
'name' => 'hostName', | ||
'alias' => 'hostAlias', | ||
'address' => 'host@localhost', | ||
'enabled' => 1 | ||
)); | ||
|
||
private $updatedProperties = (array( | ||
'name' => 'hostName_1', | ||
'alias' => 'hostAlias', | ||
'address' => 'host@localhost', | ||
'enabled' => 1 | ||
)); | ||
|
||
/** | ||
* @Given a host is created | ||
*/ | ||
public function aHostIsCreated() | ||
{ | ||
$this->currentPage = new HostConfigurationPage($this); | ||
$this->currentPage->setProperties($this->initialProperties); | ||
$this->currentPage->save(); | ||
} | ||
|
||
/** | ||
* @When I duplicate a host | ||
*/ | ||
public function whenIDuplicateAHost() | ||
{ | ||
$this->currentPage = new HostConfigurationListingPage($this); | ||
$object = $this->currentPage->getEntry($this->initialProperties['name']); | ||
$this->assertFind('css', 'input[type="checkbox"][name="select[' . $object['id'] . ']"]')->check(); | ||
$this->setConfirmBox(true); | ||
$this->selectInList('select[name="o1"]', 'Duplicate'); | ||
} | ||
|
||
/** | ||
* @Then the host properties are updated | ||
*/ | ||
public function theHostPropertiesAreUpdated() | ||
{ | ||
$this->currentPage = new HostConfigurationListingPage($this); | ||
$this->currentPage = $this->currentPage->inspect($this->updatedProperties['name']); | ||
$object = $this->currentPage->getProperties(); | ||
$tableau = array(); | ||
foreach ($this->updatedProperties as $key => $value) { | ||
if ($value != $object[$key]) { | ||
$tableau[] = $key; | ||
} | ||
} | ||
if (count($tableau) > 0) { | ||
throw new \Exception("Some properties are not being updated : " . implode(', ', $tableau)); | ||
} | ||
} | ||
} |