Add some navigation testing for back buttons and create buttons

pull/4341/head
John Cowen 2018-07-04 17:23:33 +01:00
parent 649d777714
commit f85369c375
14 changed files with 67 additions and 34 deletions

View File

@ -1,7 +1,7 @@
{{#app-view class="acl edit" loading=isLoading}} {{#app-view class="acl edit" loading=isLoading}}
{{#block-slot 'breadcrumbs'}} {{#block-slot 'breadcrumbs'}}
<ol> <ol>
<li><a href={{href-to 'dc.acls'}}>All Tokens</a></li> <li><a data-test-back href={{href-to 'dc.acls'}}>All Tokens</a></li>
</ol> </ol>
{{/block-slot}} {{/block-slot}}
{{#block-slot 'header'}} {{#block-slot 'header'}}

View File

@ -5,7 +5,7 @@
</h1> </h1>
{{/block-slot}} {{/block-slot}}
{{#block-slot 'actions'}} {{#block-slot 'actions'}}
<a href="{{href-to 'dc.acls.create'}}" class="type-create">Create</a> <a data-test-create href="{{href-to 'dc.acls.create'}}" class="type-create">Create</a>
{{/block-slot}} {{/block-slot}}
{{#block-slot 'toolbar'}} {{#block-slot 'toolbar'}}
{{#if (gt items.length 0) }} {{#if (gt items.length 0) }}

View File

@ -1,7 +1,7 @@
{{#app-view class="acl edit" loading=isLoading}} {{#app-view class="acl edit" loading=isLoading}}
{{#block-slot 'breadcrumbs'}} {{#block-slot 'breadcrumbs'}}
<ol> <ol>
<li><a href={{href-to 'dc.intentions'}}>All Intentions</a></li> <li><a data-test-back href={{href-to 'dc.intentions'}}>All Intentions</a></li>
</ol> </ol>
{{/block-slot}} {{/block-slot}}
{{#block-slot 'header'}} {{#block-slot 'header'}}

View File

@ -5,7 +5,7 @@
</h1> </h1>
{{/block-slot}} {{/block-slot}}
{{#block-slot 'actions'}} {{#block-slot 'actions'}}
<a href="{{href-to 'dc.intentions.create'}}" class="type-create">Create</a> <a data-test-create href="{{href-to 'dc.intentions.create'}}" class="type-create">Create</a>
{{/block-slot}} {{/block-slot}}
{{#block-slot 'toolbar'}} {{#block-slot 'toolbar'}}
{{#if (gt items.length 0) }} {{#if (gt items.length 0) }}

View File

@ -1,7 +1,7 @@
{{#app-view class="kv edit" loading=isLoading}} {{#app-view class="kv edit" loading=isLoading}}
{{#block-slot 'breadcrumbs'}} {{#block-slot 'breadcrumbs'}}
<ol> <ol>
<li><a href={{href-to 'dc.kv.index'}}>Key / Values</a></li> <li><a data-test-back href={{href-to 'dc.kv.index'}}>Key / Values</a></li>
{{#if (not-eq parent.Key '/') }} {{#if (not-eq parent.Key '/') }}
{{#each (slice 0 -1 (split parent.Key '/')) as |breadcrumb index|}} {{#each (slice 0 -1 (split parent.Key '/')) as |breadcrumb index|}}
<li><a href={{href-to 'dc.kv.folder' (join '/' (append (slice 0 (add index 1) (split parent.Key '/')) ''))}}>{{breadcrumb}}</a></li> <li><a href={{href-to 'dc.kv.folder' (join '/' (append (slice 0 (add index 1) (split parent.Key '/')) ''))}}>{{breadcrumb}}</a></li>

View File

@ -27,9 +27,9 @@
{{/block-slot}} {{/block-slot}}
{{#block-slot 'actions'}} {{#block-slot 'actions'}}
{{#if (not-eq parent.Key '/') }} {{#if (not-eq parent.Key '/') }}
<a href="{{href-to 'dc.kv.create' parent.Key}}" class="type-create">Create</a> <a data-test-create href="{{href-to 'dc.kv.create' parent.Key}}" class="type-create">Create</a>
{{else}} {{else}}
<a href="{{href-to 'dc.kv.root-create'}}" class="type-create">Create</a> <a data-test-create href="{{href-to 'dc.kv.root-create'}}" class="type-create">Create</a>
{{/if}} {{/if}}
{{/block-slot}} {{/block-slot}}
{{#block-slot 'content'}} {{#block-slot 'content'}}

View File

@ -1,7 +1,7 @@
{{#app-view class="node show"}} {{#app-view class="node show"}}
{{#block-slot 'breadcrumbs'}} {{#block-slot 'breadcrumbs'}}
<ol> <ol>
<li><a href={{href-to 'dc.nodes'}}>All Nodes</a></li> <li><a data-test-back href={{href-to 'dc.nodes'}}>All Nodes</a></li>
</ol> </ol>
{{/block-slot}} {{/block-slot}}
{{#block-slot 'header'}} {{#block-slot 'header'}}

View File

@ -1,7 +1,7 @@
{{#app-view class="service show"}} {{#app-view class="service show"}}
{{#block-slot 'breadcrumbs'}} {{#block-slot 'breadcrumbs'}}
<ol> <ol>
<li><a href={{href-to 'dc.services'}}>All Services</a></li> <li><a data-test-back href={{href-to 'dc.services'}}>All Services</a></li>
</ol> </ol>
{{/block-slot}} {{/block-slot}}
{{#block-slot 'header'}} {{#block-slot 'header'}}

View File

@ -8,38 +8,58 @@ Feature: Page Navigation
dc: dc-1 dc: dc-1
--- ---
Then the url should be /dc-1/services Then the url should be /dc-1/services
Scenario: Clicking [Link] in the navigation takes me to [Url] Scenario: Clicking [Link] in the navigation takes me to [URL]
When I visit the services page for yaml When I visit the services page for yaml
--- ---
dc: dc-1 dc: dc-1
--- ---
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 |
| intentions | /dc-1/intentions | | intentions | /dc-1/intentions |
| settings | /settings | | settings | /settings |
---------------------------------------- ----------------------------------------
Scenario: Clicking a [Item] in the [Model] listing Scenario: Clicking a [Item] in the [Model] listing and back again
When I visit the [Model] page for yaml When I visit the [Model] page for yaml
--- ---
dc: dc-1 dc: dc-1
--- ---
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]
# This should be a page object function
And I click "[data-test-back]"
Then the url should be [Back]
Where: Where:
------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------
| Item | Model | Url | | Item | Model | URL | Back |
| service | services | /dc-1/services/service-0 | | service | services | /dc-1/services/service-0 | /dc-1/services |
| node | nodes | /dc-1/nodes/node-0 | | node | nodes | /dc-1/nodes/node-0 | /dc-1/nodes |
| kv | kvs | /dc-1/kv/necessitatibus-0/edit | | kv | kvs | /dc-1/kv/necessitatibus-0/edit | /dc-1/kv |
| intention | intentions | /dc-1/intentions/ee52203d-989f-4f7a-ab5a-2bef004164ca | | acl | acls | /dc-1/acls/anonymous | /dc-1/acls |
| acl | acls | /dc-1/acls/anonymous | | intention | intentions | /dc-1/intentions/ee52203d-989f-4f7a-ab5a-2bef004164ca | /dc-1/intentions |
------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------
@ignore @ignore
Scenario: Clicking items in the listings, without depending on the salt ^ Scenario: Clicking items in the listings, without depending on the salt ^
Then ok Then ok
Scenario: Clicking create in the [Model] listing
When I visit the [Model] page for yaml
---
dc: dc-1
---
When I click create
Then the url should be [URL]
# This should be a page object function
And I click "[data-test-back]"
Then the url should be [Back]
Where:
------------------------------------------------------------------------
| Item | Model | URL | Back |
| kv | kvs | /dc-1/kv/create | /dc-1/kv |
| acl | acls | /dc-1/acls/create | /dc-1/acls |
| intention | intentions | /dc-1/intentions/create | /dc-1/intentions |
------------------------------------------------------------------------

View File

@ -0,0 +1,11 @@
export default function(clickable, is) {
return function(obj) {
return {
...obj,
...{
create: clickable('[data-test-create]'),
createIsEnabled: is(':not(:disabled)', '[data-test-create]'),
},
};
};
}

View File

@ -2,6 +2,7 @@ import { create, clickable, is, attribute, collection, text } from 'ember-cli-pa
import { visitable } from 'consul-ui/tests/lib/page-object/visitable'; import { visitable } from 'consul-ui/tests/lib/page-object/visitable';
import createDeletable from 'consul-ui/tests/lib/page-object/createDeletable'; import createDeletable from 'consul-ui/tests/lib/page-object/createDeletable';
import createSubmitable from 'consul-ui/tests/lib/page-object/createSubmitable'; import createSubmitable from 'consul-ui/tests/lib/page-object/createSubmitable';
import createCreatable from 'consul-ui/tests/lib/page-object/createCreatable';
import page from 'consul-ui/tests/pages/components/page'; import page from 'consul-ui/tests/pages/components/page';
import radiogroup from 'consul-ui/tests/lib/page-object/radiogroup'; import radiogroup from 'consul-ui/tests/lib/page-object/radiogroup';
@ -25,6 +26,7 @@ import intention from 'consul-ui/tests/pages/dc/intentions/edit';
const deletable = createDeletable(clickable); const deletable = createDeletable(clickable);
const submitable = createSubmitable(clickable, is); const submitable = createSubmitable(clickable, is);
const creatable = createCreatable(clickable, is);
export default { export default {
index: create(index(visitable, collection)), index: create(index(visitable, collection)),
dcs: create(dcs(visitable, clickable, attribute, collection)), dcs: create(dcs(visitable, clickable, attribute, collection)),
@ -32,12 +34,12 @@ export default {
service: create(service(visitable, attribute, collection, text, catalogFilter)), service: create(service(visitable, attribute, collection, text, catalogFilter)),
nodes: create(nodes(visitable, clickable, attribute, collection, catalogFilter)), nodes: create(nodes(visitable, clickable, attribute, collection, catalogFilter)),
node: create(node(visitable, deletable, clickable, attribute, collection, radiogroup)), node: create(node(visitable, deletable, clickable, attribute, collection, radiogroup)),
kvs: create(kvs(visitable, deletable, clickable, attribute, collection)), kvs: create(kvs(visitable, deletable, creatable, clickable, attribute, collection)),
kv: create(kv(visitable, submitable, deletable)), kv: create(kv(visitable, submitable, deletable)),
acls: create(acls(visitable, deletable, clickable, attribute, collection, aclFilter)), acls: create(acls(visitable, deletable, creatable, clickable, attribute, collection, aclFilter)),
acl: create(acl(visitable, submitable, deletable, clickable)), acl: create(acl(visitable, submitable, deletable, clickable)),
intentions: create( intentions: create(
intentions(visitable, deletable, clickable, attribute, collection, intentionFilter) intentions(visitable, deletable, creatable, clickable, attribute, collection, intentionFilter)
), ),
intention: create(intention(visitable, submitable, deletable)), intention: create(intention(visitable, submitable, deletable)),
settings: create(settings(visitable, submitable)), settings: create(settings(visitable, submitable)),

View File

@ -1,5 +1,5 @@
export default function(visitable, deletable, clickable, attribute, collection, filter) { export default function(visitable, deletable, creatable, clickable, attribute, collection, filter) {
return { return creatable({
visit: visitable('/:dc/acls'), visit: visitable('/:dc/acls'),
acls: collection( acls: collection(
'[data-test-tabular-row]', '[data-test-tabular-row]',
@ -12,5 +12,5 @@ export default function(visitable, deletable, clickable, attribute, collection,
}) })
), ),
filter: filter, filter: filter,
}; });
} }

View File

@ -1,5 +1,5 @@
export default function(visitable, deletable, clickable, attribute, collection, filter) { export default function(visitable, deletable, creatable, clickable, attribute, collection, filter) {
return { return creatable({
visit: visitable('/:dc/intentions'), visit: visitable('/:dc/intentions'),
intentions: collection( intentions: collection(
'[data-test-tabular-row]', '[data-test-tabular-row]',
@ -15,5 +15,5 @@ export default function(visitable, deletable, clickable, attribute, collection,
}) })
), ),
filter: filter, filter: filter,
}; });
} }

View File

@ -1,5 +1,5 @@
export default function(visitable, deletable, clickable, attribute, collection) { export default function(visitable, deletable, creatable, clickable, attribute, collection) {
return { return creatable({
visit: visitable('/:dc/kv'), visit: visitable('/:dc/kv'),
kvs: collection( kvs: collection(
'[data-test-tabular-row]', '[data-test-tabular-row]',
@ -9,5 +9,5 @@ export default function(visitable, deletable, clickable, attribute, collection)
actions: clickable('label'), actions: clickable('label'),
}) })
), ),
}; });
} }