mirror of https://github.com/status-im/consul.git
Add some low hanging intention tests, basically add intentions to others
1. There are various things tests that can just have intentions added into them, like filters and such like, add intentions to these 2. Start thinking about being able to negate steps easily, which will lead on to a cleanup of the steps
This commit is contained in:
parent
caf3bf17f0
commit
ed286585e9
|
@ -27,7 +27,7 @@
|
||||||
{{/block-slot}}
|
{{/block-slot}}
|
||||||
{{#block-slot 'row'}}
|
{{#block-slot 'row'}}
|
||||||
<td class="source" data-test-intention="{{item.ID}}">
|
<td class="source" data-test-intention="{{item.ID}}">
|
||||||
<a href={{href-to 'dc.intentions.edit' item.ID}}>
|
<a href={{href-to 'dc.intentions.edit' item.ID}} data-test-intention-source="{{item.SourceName}}">
|
||||||
{{#if (eq item.SourceName '*') }}
|
{{#if (eq item.SourceName '*') }}
|
||||||
All Services (*)
|
All Services (*)
|
||||||
{{else}}
|
{{else}}
|
||||||
|
@ -35,10 +35,10 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="intent-{{item.Action}}">
|
<td class="intent-{{item.Action}}" data-test-intention-action="{{item.Action}}">
|
||||||
<strong>{{item.Action}}</strong>
|
<strong>{{item.Action}}</strong>
|
||||||
</td>
|
</td>
|
||||||
<td class="destination">
|
<td class="destination" data-test-intention-destination="{{item.DestinationName}}">
|
||||||
{{#if (eq item.DestinationName '*') }}
|
{{#if (eq item.DestinationName '*') }}
|
||||||
All Services (*)
|
All Services (*)
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
@setupApplicationTest
|
@setupApplicationTest
|
||||||
Feature: dc / components /acl filter: Acl Filter
|
Feature: components / acl filter: Acl Filter
|
||||||
In order to find the acl token I'm looking for easier
|
In order to find the acl token I'm looking for easier
|
||||||
As a user
|
As a user
|
||||||
I should be able to filter by type and freetext search tokens by name and token
|
I should be able to filter by type and freetext search tokens by name and token
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
@setupApplicationTest
|
||||||
|
Feature: components / intention filter: Intention Filter
|
||||||
|
In order to find the intention I'm looking for easier
|
||||||
|
As a user
|
||||||
|
I should be able to filter by 'policy' (allow/deny) and freetext search tokens by source and destination
|
||||||
|
Scenario: Filtering [Model]
|
||||||
|
Given 1 datacenter model with the value "dc-1"
|
||||||
|
And 2 [Model] models
|
||||||
|
When I visit the [Page] page for yaml
|
||||||
|
---
|
||||||
|
dc: dc-1
|
||||||
|
---
|
||||||
|
Then the url should be [Url]
|
||||||
|
|
||||||
|
Then I see 2 [Model] models
|
||||||
|
And I see allIsSelected on the filter
|
||||||
|
|
||||||
|
When I click allow on the filter
|
||||||
|
Then I see allowIsSelected on the filter
|
||||||
|
And I see 1 [Model] model
|
||||||
|
And I see 1 [Model] model with the action "allow"
|
||||||
|
|
||||||
|
When I click deny on the filter
|
||||||
|
Then I see denyIsSelected on the filter
|
||||||
|
And I see 1 [Model] model
|
||||||
|
And I see 1 [Model] model with the action "deny"
|
||||||
|
|
||||||
|
When I click all on the filter
|
||||||
|
Then I see 2 [Model] models
|
||||||
|
Then I see allIsSelected on the filter
|
||||||
|
Then I fill in with yaml
|
||||||
|
---
|
||||||
|
s: alarm
|
||||||
|
---
|
||||||
|
And I see 1 [Model] model
|
||||||
|
And I see 1 [Model] model with the source "alarm"
|
||||||
|
Then I fill in with yaml
|
||||||
|
---
|
||||||
|
s: feed
|
||||||
|
---
|
||||||
|
And I see 1 [Model] model
|
||||||
|
And I see 1 [Model] model with the destination "feed"
|
||||||
|
Then I fill in with yaml
|
||||||
|
---
|
||||||
|
s: transmitter
|
||||||
|
---
|
||||||
|
And I see 2 [Model] models
|
||||||
|
And I see 1 [Model] model with the source "transmitter"
|
||||||
|
And I see 1 [Model] model with the destination "transmitter"
|
||||||
|
|
||||||
|
Where:
|
||||||
|
---------------------------------------------
|
||||||
|
| Model | Page | Url |
|
||||||
|
| intention | intentions | /dc-1/intentions |
|
||||||
|
---------------------------------------------
|
|
@ -1,5 +1,5 @@
|
||||||
@setupApplicationTest
|
@setupApplicationTest
|
||||||
Feature: Text input
|
Feature: components / text-input: Text input
|
||||||
Background:
|
Background:
|
||||||
Given 1 datacenter model with the value "dc-1"
|
Given 1 datacenter model with the value "dc-1"
|
||||||
Scenario:
|
Scenario:
|
||||||
|
|
|
@ -16,13 +16,14 @@ Feature: Page Navigation
|
||||||
When I click [Link] on the navigation
|
When I click [Link] on the navigation
|
||||||
Then the url should be [Url]
|
Then the url should be [Url]
|
||||||
Where:
|
Where:
|
||||||
--------------------------------------
|
----------------------------------------
|
||||||
| Link | Url |
|
| Link | Url |
|
||||||
| nodes | /dc-1/nodes |
|
| nodes | /dc-1/nodes |
|
||||||
| kvs | /dc-1/kv |
|
| kvs | /dc-1/kv |
|
||||||
| acls | /dc-1/acls |
|
| acls | /dc-1/acls |
|
||||||
| settings | /settings |
|
| intentions | /dc-1/intentions |
|
||||||
--------------------------------------
|
| settings | /settings |
|
||||||
|
----------------------------------------
|
||||||
Scenario: Clicking a [Item] in the [Model] listing
|
Scenario: Clicking a [Item] in the [Model] listing
|
||||||
When I visit the [Model] page for yaml
|
When I visit the [Model] page for yaml
|
||||||
---
|
---
|
||||||
|
@ -31,13 +32,14 @@ Feature: Page Navigation
|
||||||
When I click [Item] on the [Model]
|
When I click [Item] on the [Model]
|
||||||
Then the url should be [Url]
|
Then the url should be [Url]
|
||||||
Where:
|
Where:
|
||||||
--------------------------------------------------------
|
-------------------------------------------------------------------------------------
|
||||||
| Item | Model | Url |
|
| Item | Model | Url |
|
||||||
| service | services | /dc-1/services/service-0 |
|
| service | services | /dc-1/services/service-0 |
|
||||||
| node | nodes | /dc-1/nodes/node-0 |
|
| node | nodes | /dc-1/nodes/node-0 |
|
||||||
| kv | kvs | /dc-1/kv/necessitatibus-0/edit |
|
| kv | kvs | /dc-1/kv/necessitatibus-0/edit |
|
||||||
| acl | acls | /dc-1/acls/anonymous |
|
| intention | intentions | /dc-1/intentions/ee52203d-989f-4f7a-ab5a-2bef004164ca |
|
||||||
--------------------------------------------------------
|
| acl | acls | /dc-1/acls/anonymous |
|
||||||
|
-------------------------------------------------------------------------------------
|
||||||
@ignore
|
@ignore
|
||||||
Scenario: Clicking a kv in the kvs listing, without depending on the salt ^
|
Scenario: Clicking items in the listings, without depending on the salt ^
|
||||||
Then ok
|
Then ok
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
import steps from '../steps';
|
||||||
|
|
||||||
|
// step definitions that are shared between features should be moved to the
|
||||||
|
// tests/acceptance/steps/steps.js file
|
||||||
|
|
||||||
|
export default function(assert) {
|
||||||
|
return steps(assert).then('I should find a file', function() {
|
||||||
|
assert.ok(true, this.step);
|
||||||
|
});
|
||||||
|
}
|
|
@ -13,11 +13,12 @@ Feature: submit blank
|
||||||
And I submit
|
And I submit
|
||||||
Then the url should be /datacenter/[Slug]/create
|
Then the url should be /datacenter/[Slug]/create
|
||||||
Where:
|
Where:
|
||||||
------------------
|
--------------------------
|
||||||
| Model | Slug |
|
| Model | Slug |
|
||||||
| kv | kv |
|
| kv | kv |
|
||||||
| acl | acls |
|
| acl | acls |
|
||||||
------------------
|
| intention | intentions |
|
||||||
|
--------------------------
|
||||||
@ignore
|
@ignore
|
||||||
Scenario: The button is disabled
|
Scenario: The button is disabled
|
||||||
Then ok
|
Then ok
|
||||||
|
|
|
@ -9,6 +9,7 @@ import kvs from 'consul-ui/tests/pages/dc/kv/index';
|
||||||
import kv from 'consul-ui/tests/pages/dc/kv/edit';
|
import kv from 'consul-ui/tests/pages/dc/kv/edit';
|
||||||
import acls from 'consul-ui/tests/pages/dc/acls/index';
|
import acls from 'consul-ui/tests/pages/dc/acls/index';
|
||||||
import acl from 'consul-ui/tests/pages/dc/acls/edit';
|
import acl from 'consul-ui/tests/pages/dc/acls/edit';
|
||||||
|
import intentions from 'consul-ui/tests/pages/dc/intentions/index';
|
||||||
import intention from 'consul-ui/tests/pages/dc/intentions/edit';
|
import intention from 'consul-ui/tests/pages/dc/intentions/edit';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -23,5 +24,6 @@ export default {
|
||||||
kv,
|
kv,
|
||||||
acls,
|
acls,
|
||||||
acl,
|
acl,
|
||||||
|
intentions,
|
||||||
intention,
|
intention,
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
import { triggerable } from 'ember-cli-page-object';
|
||||||
|
import radiogroup from 'consul-ui/tests/lib/page-object/radiogroup';
|
||||||
|
export default {
|
||||||
|
...radiogroup('action', ['', 'allow', 'deny']),
|
||||||
|
...{
|
||||||
|
scope: '[data-test-intention-filter]',
|
||||||
|
search: triggerable('keypress', '[name="s"]'),
|
||||||
|
},
|
||||||
|
};
|
|
@ -1,6 +1,6 @@
|
||||||
import { clickable } from 'ember-cli-page-object';
|
import { clickable } from 'ember-cli-page-object';
|
||||||
export default {
|
export default {
|
||||||
navigation: ['services', 'nodes', 'kvs', 'acls', 'docs', 'settings'].reduce(
|
navigation: ['services', 'nodes', 'kvs', 'acls', 'intentions', 'docs', 'settings'].reduce(
|
||||||
function(prev, item, i, arr) {
|
function(prev, item, i, arr) {
|
||||||
const key = item;
|
const key = item;
|
||||||
return Object.assign({}, prev, {
|
return Object.assign({}, prev, {
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { create, visitable, collection, attribute, clickable } from 'ember-cli-page-object';
|
||||||
|
|
||||||
|
import filter from 'consul-ui/tests/pages/components/intention-filter';
|
||||||
|
export default create({
|
||||||
|
visit: visitable('/:dc/intentions'),
|
||||||
|
intentions: collection('[data-test-tabular-row]', {
|
||||||
|
source: attribute('data-test-intention-source', '[data-test-intention-source]'),
|
||||||
|
destination: attribute('data-test-intention-destination', '[data-test-intention-destination]'),
|
||||||
|
action: attribute('data-test-intention-action', '[data-test-intention-action]'),
|
||||||
|
intention: clickable('a'),
|
||||||
|
actions: clickable('label'),
|
||||||
|
delete: clickable('[data-test-delete]'),
|
||||||
|
confirmDelete: clickable('button.type-delete'),
|
||||||
|
}),
|
||||||
|
filter: filter,
|
||||||
|
});
|
|
@ -5,6 +5,8 @@ import getDictionary from '@hashicorp/ember-cli-api-double/dictionary';
|
||||||
import pages from 'consul-ui/tests/pages';
|
import pages from 'consul-ui/tests/pages';
|
||||||
import api from 'consul-ui/tests/helpers/api';
|
import api from 'consul-ui/tests/helpers/api';
|
||||||
|
|
||||||
|
const dont = `( don't| shouldn't| can't)?`;
|
||||||
|
|
||||||
const create = function(number, name, value) {
|
const create = function(number, name, value) {
|
||||||
// don't return a promise here as
|
// don't return a promise here as
|
||||||
// I don't need it to wait
|
// I don't need it to wait
|
||||||
|
@ -240,7 +242,9 @@ export default function(assert) {
|
||||||
|
|
||||||
assert.equal(len, num, `Expected ${num} ${model}s, saw ${len}`);
|
assert.equal(len, num, `Expected ${num} ${model}s, saw ${len}`);
|
||||||
})
|
})
|
||||||
.then(['I see $num $model model with the $property "$value"'], function(
|
// TODO: I${ dont } see
|
||||||
|
.then([`I see $num $model model[s]? with the $property "$value"`], function(
|
||||||
|
// negate,
|
||||||
num,
|
num,
|
||||||
model,
|
model,
|
||||||
property,
|
property,
|
||||||
|
|
Loading…
Reference in New Issue