diff --git a/ui-v2/tests/acceptance/page-navigation.feature b/ui-v2/tests/acceptance/page-navigation.feature index 1ec219f272..95a88fa044 100644 --- a/ui-v2/tests/acceptance/page-navigation.feature +++ b/ui-v2/tests/acceptance/page-navigation.feature @@ -31,7 +31,6 @@ Feature: Page Navigation --- When I click [Item] on the [Model] 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: @@ -43,6 +42,22 @@ Feature: Page Navigation | acl | acls | /dc-1/acls/anonymous | /dc-1/acls | | 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 Scenario: Clicking items in the listings, without depending on the salt ^ Then ok @@ -53,7 +68,6 @@ Feature: Page Navigation --- 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: @@ -63,3 +77,5 @@ Feature: Page Navigation | acl | acls | /dc-1/acls/create | /dc-1/acls | | intention | intentions | /dc-1/intentions/create | /dc-1/intentions | ------------------------------------------------------------------------ + Scenario: Using I click on should change the currentPage ^ + Then ok diff --git a/ui-v2/tests/lib/page-object/createCancelable.js b/ui-v2/tests/lib/page-object/createCancelable.js new file mode 100644 index 0000000000..390362e86d --- /dev/null +++ b/ui-v2/tests/lib/page-object/createCancelable.js @@ -0,0 +1,11 @@ +export default function(clickable, is) { + return function(obj) { + return { + ...obj, + ...{ + cancel: clickable('[type=reset]'), + cancelIsEnabled: is(':not(:disabled)', '[type=reset]'), + }, + }; + }; +} diff --git a/ui-v2/tests/pages.js b/ui-v2/tests/pages.js index 1922588f47..6720acc544 100644 --- a/ui-v2/tests/pages.js +++ b/ui-v2/tests/pages.js @@ -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 createSubmitable from 'consul-ui/tests/lib/page-object/createSubmitable'; 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 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 submitable = createSubmitable(clickable, is); const creatable = createCreatable(clickable, is); +const cancelable = createCancelable(clickable, is); export default { index: create(index(visitable, collection)), dcs: create(dcs(visitable, clickable, attribute, collection)), @@ -35,12 +37,12 @@ export default { nodes: create(nodes(visitable, clickable, attribute, collection, catalogFilter)), node: create(node(visitable, deletable, clickable, attribute, collection, radiogroup)), 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)), - acl: create(acl(visitable, submitable, deletable, clickable)), + acl: create(acl(visitable, submitable, deletable, cancelable, clickable)), intentions: create( 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)), }; diff --git a/ui-v2/tests/pages/dc/acls/edit.js b/ui-v2/tests/pages/dc/acls/edit.js index 53ede15259..71c0620717 100644 --- a/ui-v2/tests/pages/dc/acls/edit.js +++ b/ui-v2/tests/pages/dc/acls/edit.js @@ -1,9 +1,11 @@ -export default function(visitable, submitable, deletable, clickable) { +export default function(visitable, submitable, deletable, cancelable, clickable) { return submitable( - deletable({ - visit: visitable(['/:dc/acls/:acl', '/:dc/acls/create']), - use: clickable('[data-test-use]'), - confirmUse: clickable('button.type-delete'), - }) + cancelable( + deletable({ + visit: visitable(['/:dc/acls/:acl', '/:dc/acls/create']), + use: clickable('[data-test-use]'), + confirmUse: clickable('button.type-delete'), + }) + ) ); } diff --git a/ui-v2/tests/pages/dc/intentions/edit.js b/ui-v2/tests/pages/dc/intentions/edit.js index 5c6d94550a..a9cdff3866 100644 --- a/ui-v2/tests/pages/dc/intentions/edit.js +++ b/ui-v2/tests/pages/dc/intentions/edit.js @@ -1,7 +1,9 @@ -export default function(visitable, submitable, deletable) { +export default function(visitable, submitable, deletable, cancelable) { return submitable( - deletable({ - visit: visitable(['/:dc/intentions/:intention', '/:dc/intentions/create']), - }) + cancelable( + deletable({ + visit: visitable(['/:dc/intentions/:intention', '/:dc/intentions/create']), + }) + ) ); } diff --git a/ui-v2/tests/pages/dc/kv/edit.js b/ui-v2/tests/pages/dc/kv/edit.js index f7a019705b..b644876cc0 100644 --- a/ui-v2/tests/pages/dc/kv/edit.js +++ b/ui-v2/tests/pages/dc/kv/edit.js @@ -1,7 +1,9 @@ -export default function(visitable, submitable, deletable) { +export default function(visitable, submitable, deletable, cancelable) { return submitable( - deletable({ - visit: visitable(['/:dc/kv/:kv/edit', '/:dc/kv/create'], str => str), - }) + cancelable( + deletable({ + visit: visitable(['/:dc/kv/:kv/edit', '/:dc/kv/create'], str => str), + }) + ) ); }