Basic acceptance testing for navigating via cancel buttons

This commit is contained in:
John Cowen 2018-07-04 18:39:15 +01:00
parent f85369c375
commit 15b627a517
6 changed files with 54 additions and 19 deletions

View File

@ -31,7 +31,6 @@ 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]
# This should be a page object function
And I click "[data-test-back]" And I click "[data-test-back]"
Then the url should be [Back] Then the url should be [Back]
Where: Where:
@ -43,6 +42,22 @@ Feature: Page Navigation
| acl | acls | /dc-1/acls/anonymous | /dc-1/acls | | acl | acls | /dc-1/acls/anonymous | /dc-1/acls |
| intention | intentions | /dc-1/intentions/ee52203d-989f-4f7a-ab5a-2bef004164ca | /dc-1/intentions | | intention | intentions | /dc-1/intentions/ee52203d-989f-4f7a-ab5a-2bef004164ca | /dc-1/intentions |
-------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------
Scenario: Clicking a [Item] in the [Model] listing and canceling
When I visit the [Model] page for yaml
---
dc: dc-1
---
When I click [Item] on the [Model]
Then the url should be [URL]
And I click "[type=reset]"
Then the url should be [Back]
Where:
--------------------------------------------------------------------------------------------------------
| Item | Model | URL | Back |
| kv | kvs | /dc-1/kv/necessitatibus-0/edit | /dc-1/kv |
| acl | acls | /dc-1/acls/anonymous | /dc-1/acls |
| 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
@ -53,7 +68,6 @@ Feature: Page Navigation
--- ---
When I click create When I click create
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]" And I click "[data-test-back]"
Then the url should be [Back] Then the url should be [Back]
Where: Where:
@ -63,3 +77,5 @@ Feature: Page Navigation
| acl | acls | /dc-1/acls/create | /dc-1/acls | | acl | acls | /dc-1/acls/create | /dc-1/acls |
| intention | intentions | /dc-1/intentions/create | /dc-1/intentions | | intention | intentions | /dc-1/intentions/create | /dc-1/intentions |
------------------------------------------------------------------------ ------------------------------------------------------------------------
Scenario: Using I click on should change the currentPage ^
Then ok

View File

@ -0,0 +1,11 @@
export default function(clickable, is) {
return function(obj) {
return {
...obj,
...{
cancel: clickable('[type=reset]'),
cancelIsEnabled: is(':not(:disabled)', '[type=reset]'),
},
};
};
}

View File

@ -3,6 +3,7 @@ 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 createCreatable from 'consul-ui/tests/lib/page-object/createCreatable';
import createCancelable from 'consul-ui/tests/lib/page-object/createCancelable';
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';
@ -27,6 +28,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); const creatable = createCreatable(clickable, is);
const cancelable = createCancelable(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)),
@ -35,12 +37,12 @@ export default {
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, creatable, clickable, attribute, collection)), kvs: create(kvs(visitable, deletable, creatable, clickable, attribute, collection)),
kv: create(kv(visitable, submitable, deletable)), kv: create(kv(visitable, submitable, deletable, cancelable, clickable)),
acls: create(acls(visitable, deletable, creatable, 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, cancelable, clickable)),
intentions: create( intentions: create(
intentions(visitable, deletable, creatable, clickable, attribute, collection, intentionFilter) intentions(visitable, deletable, creatable, clickable, attribute, collection, intentionFilter)
), ),
intention: create(intention(visitable, submitable, deletable)), intention: create(intention(visitable, submitable, deletable, cancelable)),
settings: create(settings(visitable, submitable)), settings: create(settings(visitable, submitable)),
}; };

View File

@ -1,9 +1,11 @@
export default function(visitable, submitable, deletable, clickable) { export default function(visitable, submitable, deletable, cancelable, clickable) {
return submitable( return submitable(
deletable({ cancelable(
visit: visitable(['/:dc/acls/:acl', '/:dc/acls/create']), deletable({
use: clickable('[data-test-use]'), visit: visitable(['/:dc/acls/:acl', '/:dc/acls/create']),
confirmUse: clickable('button.type-delete'), use: clickable('[data-test-use]'),
}) confirmUse: clickable('button.type-delete'),
})
)
); );
} }

View File

@ -1,7 +1,9 @@
export default function(visitable, submitable, deletable) { export default function(visitable, submitable, deletable, cancelable) {
return submitable( return submitable(
deletable({ cancelable(
visit: visitable(['/:dc/intentions/:intention', '/:dc/intentions/create']), deletable({
}) visit: visitable(['/:dc/intentions/:intention', '/:dc/intentions/create']),
})
)
); );
} }

View File

@ -1,7 +1,9 @@
export default function(visitable, submitable, deletable) { export default function(visitable, submitable, deletable, cancelable) {
return submitable( return submitable(
deletable({ cancelable(
visit: visitable(['/:dc/kv/:kv/edit', '/:dc/kv/create'], str => str), deletable({
}) visit: visitable(['/:dc/kv/:kv/edit', '/:dc/kv/create'], str => str),
})
)
); );
} }