-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARKTA-436] add new testsAT for feature implemented in 198]
- Loading branch information
1 parent
8a83a49
commit f2362b3
Showing
5 changed files
with
182 additions
and
6 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
.../test/java/com/stratio/sparta/testsAT/automated/gui/policies/AddAutoFragmentCreation.java
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,24 @@ | ||
package com.stratio.sparta.testsAT.automated.gui.policies; | ||
|
||
import org.testng.annotations.Factory; | ||
import org.testng.annotations.Test; | ||
|
||
import com.stratio.cucumber.testng.CucumberRunner; | ||
import com.stratio.data.BrowsersDataProvider; | ||
import com.stratio.sparta.testsAT.utils.BaseTest; | ||
|
||
import cucumber.api.CucumberOptions; | ||
|
||
@CucumberOptions(features = { "src/test/resources/features/automated/gui/policies/addAutoFragmentCreation.feature" }) | ||
public class AddAutoFragmentCreation extends BaseTest { | ||
|
||
@Factory(enabled = false, dataProviderClass = BrowsersDataProvider.class, dataProvider = "availableUniqueBrowsers") | ||
public AddAutoFragmentCreation(String browser) { | ||
this.browser = browser; | ||
} | ||
|
||
@Test(enabled = true, groups = {"web"}) | ||
public void checkElementsTest() throws Exception { | ||
new CucumberRunner(this.getClass()).runCukes(); | ||
} | ||
} |
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
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
98 changes: 98 additions & 0 deletions
98
testsAT/src/test/resources/features/automated/gui/policies/addAutoFragmentCreation.feature
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,98 @@ | ||
@web @rest | ||
Feature: Test adding a new policy in Sparta GUI | ||
|
||
Background: Setup Sparta GUI | ||
Given I set web base url to '${SPARTA_HOST}:${SPARTA_PORT}' | ||
Given I send requests to '${SPARTA_HOST}:${SPARTA_API_PORT}' | ||
|
||
Scenario: Add a new policy through api | ||
When I send a 'POST' request to '/policyContext' based on 'schemas/policies/policy.conf' as 'json' with: | ||
| name | UPDATE | policy1 | | ||
| fragments | DELETE | N/A | | ||
| outputs[1] | DELETE | N/A | | ||
| id | DELETE | N/A | | ||
Then the service response status must be '200'. | ||
And I save element '$.policyId' in attribute 'previousPolicyID' | ||
# Check that is listed | ||
When I send a 'GET' request to '/policy/all' | ||
Then the service response status must be '200' and its response length must be '1' | ||
# Check that input has been created | ||
When I send a 'GET' request to '/fragment/input' | ||
Then the service response status must be '200' and its response length must be '1' | ||
# Check that output has been created | ||
When I send a 'GET' request to '/fragment/output' | ||
Then the service response status must be '200' and its response length must be '1' | ||
|
||
# Browse to policies | ||
Given I browse to '/#/dashboard/policies' | ||
Then I wait '2' seconds | ||
And '1' element exists with 'css:i[data-qa^="policy-context-menu-"]' | ||
|
||
# Browse to inputs | ||
Given I browse to '/#/dashboard/inputs' | ||
Then I wait '2' seconds | ||
And '1' element exists with 'css:span[data-qa^="input-context-menu-"]' | ||
# Try to edit input | ||
Then I click on the element on index '0' | ||
And I wait '1' second | ||
Given '1' element exists with 'css:st-menu-element[data-qa$="-edit"]' | ||
When I click on the element on index '0' | ||
Then I wait '1' second | ||
And '1' element exists with 'css:aside[data-qa="fragment-details-modal"]' | ||
# Modify | ||
Given '1' element exists with 'css:button[data-qa="modal-ok-button"]' | ||
When I click on the element on index '0' | ||
|
||
# Browse to outputs | ||
Given I browse to '/#/dashboard/outputs' | ||
Then I wait '2' seconds | ||
And '1' element exists with 'css:span[data-qa^="output-context-menu-"]' | ||
# Try to edit output | ||
Then I click on the element on index '0' | ||
And I wait '1' second | ||
Given '1' element exists with 'css:st-menu-element[data-qa$="-edit"]' | ||
When I click on the element on index '0' | ||
Then I wait '1' second | ||
And '1' element exists with 'css:aside[data-qa="fragment-details-modal"]' | ||
# Modify | ||
Given '1' element exists with 'css:button[data-qa="modal-ok-button"]' | ||
When I click on the element on index '0' | ||
|
||
# Add same policy with different name, fragments should be reused | ||
When I send a 'POST' request to '/policyContext' based on 'schemas/policies/policy.conf' as 'json' with: | ||
| name | UPDATE | policy2 | | ||
| fragments | DELETE | N/A | | ||
| outputs[1] | DELETE | N/A | | ||
| id | DELETE | N/A | | ||
Then the service response status must be '200'. | ||
And I save element '$.policyId' in attribute 'previousPolicyID_2' | ||
|
||
# Browse to inputs | ||
Given I browse to '/#/dashboard/inputs' | ||
Then I wait '2' seconds | ||
And '1' element exists with 'css:span[data-qa^="input-context-menu-"]' | ||
|
||
# Browse to outputs | ||
Given I browse to '/#/dashboard/outputs' | ||
Then I wait '2' seconds | ||
And '1' element exists with 'css:span[data-qa^="output-context-menu-"]' | ||
|
||
# Delete policy | ||
When I send a 'DELETE' request to '/policy/!{previousPolicyID}' | ||
Then the service response status must be '200'. | ||
When I send a 'DELETE' request to '/policy/!{previousPolicyID_2}' | ||
Then the service response status must be '200'. | ||
When I send a 'GET' request to '/policy/all' | ||
Then the service response status must be '200' and its response must contain the text '[]' | ||
|
||
# Delete fragments | ||
When I send a 'GET' request to '/fragment/input/name/name' | ||
Then the service response status must be '200'. | ||
And I save element '$.id' in attribute 'previousFragmentID' | ||
When I send a 'DELETE' request to '/fragment/input/!{previousFragmentID}' | ||
Then the service response status must be '200'. | ||
When I send a 'GET' request to '/fragment/output/name/name' | ||
Then the service response status must be '200'. | ||
And I save element '$.id' in attribute 'previousFragmentID_2' | ||
When I send a 'DELETE' request to '/fragment/output/!{previousFragmentID_2}' | ||
Then the service response status must be '200'. |