Private GIT

Skip to content
Snippets Groups Projects
Commit f3aa8835 authored by Matthieu Mandoula's avatar Matthieu Mandoula Committed by Kev
Browse files

Virtual metric (#5469)

* put clipboard on app head and remove old lib tool.js

* behat.yml updated

* Virtuals Metrics acceptance test

* background has been updated in VirtualMetricHandle.feature and first scenario ok in the context

* scenario updated in VirtualMetricHandle.feature, acceptance test updated

* unused "use statement" deleted

* acceptance test last update

* acceptance test last update $functionRPN attribute changed

* Update VirtualMetricHandle.feature
parent edd19420
Branches
Tags
No related merge requests found
...@@ -263,3 +263,8 @@ default: ...@@ -263,3 +263,8 @@ default:
paths: [ %paths.base%/features/MassiveChangeServices.feature ] paths: [ %paths.base%/features/MassiveChangeServices.feature ]
contexts: contexts:
- MassiveChangeServicesContext - MassiveChangeServicesContext
virtual_metric_handle:
paths: [ %paths.base%/features/VirtualMetricHandle.feature ]
contexts:
- VirtualMetricHandleContext
Feature: Virtual Metric Handle
As a Centreon user
I want to use virtual metric
To calculate specific values I need to check
Background:
Given I am logged in a Centreon server with configured metrics
Scenario: Create a virtual metric
When I add a virtual metric
Then all properties are saved
Scenario: Duplicate a virtual metric
Given an existing virtual metric
When I duplicate a virtual metric
Then all properties are copied except the name
Scenario: Delete a virtual metric
Given an existing virtual metric
When I delete a virtual metric
Then the virtual metric disappears from the Virtual metrics list
<?php
use Centreon\Test\Behat\CentreonContext;
use Centreon\Test\Behat\Monitoring\MetricsConfigurationListingPage;
use Centreon\Test\Behat\Monitoring\MetricsConfigurationPage;
class VirtualMetricHandleContext extends CentreonContext
{
protected $page;
protected $vmName = 'vmtestname';
protected $host = 'MetricTestHostname';
protected $functionRPN ='test10';
protected $hostService = 'MetricTestService';
protected $duplicatedVmName = 'vmtestname_1';
/**
* @When I add a virtual metric
*/
public function iAddAVirtualMetric()
{
$this->page = new MetricsConfigurationListingPage($this);
$this->assertFind('css', 'a[class="btc bt_success"]')->click();
$this->page = new MetricsConfigurationPage($this);
$this->page->setProperties(array(
'name' => $this->vmName,
'linked-host_services' => $this->host . ' - ' . $this->hostService
));
$this->page->setProperties(array('function' => $this->functionRPN));
$this->page->save();
}
/**
* @Then all properties are saved
*/
public function allPropertiesAreSaved()
{
$this->page = new MetricsConfigurationListingPage($this);
$data = $this->page->getEntry($this->vmName);
if ($data['name'] != $this->vmName || $data['function'] != $this->functionRPN) {
throw new \Exception('Some properties have not been saved');
}
}
/**
* @Given an existing virtual metric
*/
public function anExistingVirtualMetric()
{
$this->iAddAVirtualMetric();
}
/**
* @When I duplicate a virtual metric
*/
public function iDuplicateAVirtualMetric()
{
$this->page = new MetricsConfigurationListingPage($this);
$object = $this->page->getEntry($this->vmName);
$this->page->selectMoreAction($object, 'Duplicate');
}
/**
* @Then all properties are copied except the name
*/
public function allPropertiesAreCopiedExceptTheName()
{
$objects = $this->page->getEntries();
if (key_exists($this->duplicatedVmName, $objects)) {
if ($objects[$this->duplicatedVmName]['function'] != $objects[$this->vmName]['function']
|| $objects[$this->duplicatedVmName]['def_type'] != $objects[$this->vmName]['def_type']) {
throw new \Exception( 'Some properties of ' . $this->duplicatedVmName . ' virtual Metric have not '
. 'been duplicated');
}
} else {
throw new \Exception($this->vmName . ' virtual Metric has not been duplicated');
}
}
/**
* @When I delete a virtual metric
*/
public function iDeleteAVirtualMetric()
{
$this->page = new MetricsConfigurationListingPage($this);
$object = $this->page->getEntry($this->vmName);
$this->page->selectMoreAction($object, 'Delete');
}
/**
* @Then the virtual metric disappears from the Virtual metrics list
*/
public function theVirtualMetricDisappearsFromTheVirtualMetricsList()
{
$objects = $this->page->getEntries();
if (key_exists($this->vmName, $objects)) {
throw new \Exception($this->vmName . ' virtual Metric is still existing');
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment