diff --git a/ui/packages/consul-peerings/app/components/consul/peer/list/index.hbs b/ui/packages/consul-peerings/app/components/consul/peer/list/index.hbs index 886dfc8d2..b743baee6 100644 --- a/ui/packages/consul-peerings/app/components/consul/peer/list/index.hbs +++ b/ui/packages/consul-peerings/app/components/consul/peer/list/index.hbs @@ -59,7 +59,7 @@ {{/if}} diff --git a/ui/packages/consul-peerings/app/components/consul/peer/list/test-support.js b/ui/packages/consul-peerings/app/components/consul/peer/list/test-support.js index 126e444b9..04507f094 100644 --- a/ui/packages/consul-peerings/app/components/consul/peer/list/test-support.js +++ b/ui/packages/consul-peerings/app/components/consul/peer/list/test-support.js @@ -1,19 +1,19 @@ export const selectors = { - $: '.consul-peer-list', + $: ".consul-peer-list", collection: { - $: '[data-test-list-row]', + $: "[data-test-list-row]", peer: { - $: 'li', + $: "li", name: { - $: '[data-test-peer]' - } + $: "[data-test-peer]", + }, }, - } + }, }; export default (collection, isPresent, attribute, actions) => () => { return collection(`${selectors.$} ${selectors.collection.$}`, { peer: isPresent(selectors.collection.peer.$), - name: attribute('data-test-peer', selectors.collection.peer.name.$), - ...actions(['regenerate', 'delete']), + name: attribute("data-test-peer", selectors.collection.peer.name.$), + ...actions(["regenerate", "delete", "view"]), }); }; diff --git a/ui/packages/consul-peerings/app/templates/dc/peers/show/addresses.hbs b/ui/packages/consul-peerings/app/templates/dc/peers/show/addresses.hbs index f3934cda5..4e179dc32 100644 --- a/ui/packages/consul-peerings/app/templates/dc/peers/show/addresses.hbs +++ b/ui/packages/consul-peerings/app/templates/dc/peers/show/addresses.hbs @@ -2,7 +2,7 @@ {{#if (gt route.model.items.length 0)}} {{else}} - +

{{t "routes.dc.peers.show.addresses.empty.header"}} diff --git a/ui/packages/consul-peerings/app/templates/dc/peers/show/exported.hbs b/ui/packages/consul-peerings/app/templates/dc/peers/show/exported.hbs index 6119c00c0..10af30503 100644 --- a/ui/packages/consul-peerings/app/templates/dc/peers/show/exported.hbs +++ b/ui/packages/consul-peerings/app/templates/dc/peers/show/exported.hbs @@ -76,7 +76,10 @@ {{else}} - +

{{t diff --git a/ui/packages/consul-peerings/app/templates/dc/peers/show/imported.hbs b/ui/packages/consul-peerings/app/templates/dc/peers/show/imported.hbs index ecf1e756b..2286f0dc3 100644 --- a/ui/packages/consul-peerings/app/templates/dc/peers/show/imported.hbs +++ b/ui/packages/consul-peerings/app/templates/dc/peers/show/imported.hbs @@ -82,7 +82,10 @@ /> - +

{{t diff --git a/ui/packages/consul-ui/tests/acceptance/dc/peers/show.feature b/ui/packages/consul-ui/tests/acceptance/dc/peers/show.feature new file mode 100644 index 000000000..4fc7f7405 --- /dev/null +++ b/ui/packages/consul-ui/tests/acceptance/dc/peers/show.feature @@ -0,0 +1,136 @@ +@setupApplcationTest +Feature: dc / peers / show: Peers show + Scenario: Dialer side tabs + And 1 datacenter model with the value "dc-1" + And 1 peer models from yaml + --- + Name: a-peer + State: ACTIVE + # dialer side + PeerID: null + --- + When I visit the peers page for yaml + --- + dc: dc-1 + --- + And I click actions on the peers + And I click view on the peers + Then the url should be /dc-1/peers/a-peer/imported-services + Then I see importedServicesIsVisible on the tabs + And I see exportedServicesIsVisible on the tabs + And I don't see addressesIsVisible on the tabs + + Scenario: Receiver side tabs + And 1 datacenter model with the value "dc-1" + And 1 peer models from yaml + --- + Name: a-peer + State: ACTIVE + # receiver side + PeerID: 'some-peer' + --- + When I visit the peers page for yaml + --- + dc: dc-1 + --- + And I click actions on the peers + And I click view on the peers + Then the url should be /dc-1/peers/a-peer/imported-services + Then I see importedServicesIsVisible on the tabs + And I see exportedServicesIsVisible on the tabs + And I see addressesIsVisible on the tabs + + Scenario: Imported Services Empty + And 1 datacenter model with the value "dc-1" + And 1 peer models from yaml + --- + Name: a-peer + State: ACTIVE + --- + And 0 service models + When I visit the peer page for yaml + --- + dc: dc-1 + peer: a-peer + --- + Then I see the "[data-test-imported-services-empty]" element + + Scenario: Imported Services not empty + And 1 datacenter model with the value "dc-1" + And 1 peer models from yaml + --- + Name: a-peer + State: ACTIVE + --- + And 1 service models from yaml + --- + Name: 'service-for-peer-a' + --- + When I visit the peer page for yaml + --- + dc: dc-1 + peer: a-peer + --- + Then I don't see the "[data-test-imported-services-empty]" element + + Scenario: Exported Services Empty + And 1 datacenter model with the value "dc-1" + And 1 peer models from yaml + --- + Name: a-peer + State: ACTIVE + --- + And 0 service models + When I visitExported the peer page for yaml + --- + dc: dc-1 + peer: a-peer + --- + Then I see the "[data-test-exported-services-empty]" element + + Scenario: Exported Services not empty + And 1 datacenter model with the value "dc-1" + And 1 peer models from yaml + --- + Name: a-peer + State: ACTIVE + --- + And 1 service models from yaml + --- + Name: 'service-for-peer-a' + --- + When I visitExported the peer page for yaml + --- + dc: dc-1 + peer: a-peer + --- + Then I don't see the "[data-test-exported-services-empty]" element + + Scenario: Addresses Empty + And 1 datacenter model with the value "dc-1" + And 1 peer models from yaml + --- + Name: a-peer + State: ACTIVE + PeerServerAddresses: null + --- + When I visitAddresses the peer page for yaml + --- + dc: dc-1 + peer: a-peer + --- + Then I see the "[data-test-addresses-empty]" element + + Scenario: Addresses Not Empty + And 1 datacenter model with the value "dc-1" + And 1 peer models from yaml + --- + Name: a-peer + State: ACTIVE + --- + When I visitAddresses the peer page for yaml + --- + dc: dc-1 + peer: a-peer + --- + Then I don't see the "[data-test-addresses-empty]" element \ No newline at end of file diff --git a/ui/packages/consul-ui/tests/acceptance/steps/dc/peers/show-steps.js b/ui/packages/consul-ui/tests/acceptance/steps/dc/peers/show-steps.js new file mode 100644 index 000000000..06173e1e0 --- /dev/null +++ b/ui/packages/consul-ui/tests/acceptance/steps/dc/peers/show-steps.js @@ -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); + }); +} diff --git a/ui/packages/consul-ui/tests/pages.js b/ui/packages/consul-ui/tests/pages.js index c3ceb2af5..a14d23293 100644 --- a/ui/packages/consul-ui/tests/pages.js +++ b/ui/packages/consul-ui/tests/pages.js @@ -75,6 +75,7 @@ import intention from 'consul-ui/tests/pages/dc/intentions/edit'; import nspaces from 'consul-ui/tests/pages/dc/nspaces/index'; import nspace from 'consul-ui/tests/pages/dc/nspaces/edit'; import peers from 'consul-ui/tests/pages/dc/peers/index'; +import peersShow from 'consul-ui/tests/pages/dc/peers/show'; // utils const deletable = createDeletable(clickable); @@ -234,6 +235,7 @@ export default { nspace(visitable, submitable, deletable, cancelable, policySelector, roleSelector) ), peers: create(peers(visitable, creatable, consulPeerList, popoverSelect)), + peer: create(peersShow(visitable)), settings: create(settings(visitable, submitable, isPresent)), routingConfig: create(routingConfig(visitable, text)), }; diff --git a/ui/packages/consul-ui/tests/pages/dc/peers/index.js b/ui/packages/consul-ui/tests/pages/dc/peers/index.js index b46701909..d60b3e41e 100644 --- a/ui/packages/consul-ui/tests/pages/dc/peers/index.js +++ b/ui/packages/consul-ui/tests/pages/dc/peers/index.js @@ -1,7 +1,10 @@ +import tabgroup from 'consul-ui/components/tab-nav/pageobject'; + export default function (visitable, creatable, items, popoverSelect) { return creatable({ visit: visitable('/:dc/peers'), peers: items(), sort: popoverSelect('[data-test-sort-control]'), + tabs: tabgroup('tab', ['imported-services', 'exported-services', 'addresses']), }); } diff --git a/ui/packages/consul-ui/tests/pages/dc/peers/show.js b/ui/packages/consul-ui/tests/pages/dc/peers/show.js new file mode 100644 index 000000000..25dcbe60f --- /dev/null +++ b/ui/packages/consul-ui/tests/pages/dc/peers/show.js @@ -0,0 +1,8 @@ +export default function (visitable) { + return { + visit: visitable('/:dc/peers/:peer'), + visitExported: visitable('/:dc/peers/:peer/exported-services'), + visitImported: visitable('/:dc/peers/:peer/imported-services'), + visitAddresses: visitable('/:dc/peers/:peer/addresses'), + }; +} diff --git a/ui/packages/consul-ui/tests/steps/interactions/visit.js b/ui/packages/consul-ui/tests/steps/interactions/visit.js index 5a4551cf5..fc382e6c7 100644 --- a/ui/packages/consul-ui/tests/steps/interactions/visit.js +++ b/ui/packages/consul-ui/tests/steps/interactions/visit.js @@ -29,5 +29,13 @@ export default function (scenario, pages, set, reset) { // do I absolutely definitely need that all the time? return set(pages[name]).visit(data); } + ) + .when( + ['I $method the $name page for yaml\n$yaml', 'I $method the $name page for json\n$json'], + function (method, name, data) { + reset(); + + return set(pages[name])[method](data); + } ); }