mirror of https://github.com/status-im/consul.git
Add tests peers.show
This commit is contained in:
parent
38fed7d2b6
commit
54409c9ac4
|
@ -59,7 +59,7 @@
|
|||
</Action>
|
||||
{{/if}}
|
||||
<Action
|
||||
data-test-edit-action
|
||||
data-test-view-action
|
||||
@href={{href-to "dc.peers.show" item.Name}}
|
||||
>
|
||||
<BlockSlot @name="label">
|
||||
|
|
|
@ -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"]),
|
||||
});
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{{#if (gt route.model.items.length 0)}}
|
||||
<Consul::Peer::Address::List @items={{route.model.items}} />
|
||||
{{else}}
|
||||
<EmptyState @login={{route.model.app.login.open}}>
|
||||
<EmptyState @login={{route.model.app.login.open}} data-test-addresses-empty>
|
||||
<BlockSlot @name="header">
|
||||
<h2>
|
||||
{{t "routes.dc.peers.show.addresses.empty.header"}}
|
||||
|
|
|
@ -76,7 +76,10 @@
|
|||
</li>
|
||||
</VerticalCollection>
|
||||
{{else}}
|
||||
<EmptyState @login={{route.model.app.login.open}}>
|
||||
<EmptyState
|
||||
@login={{route.model.app.login.open}}
|
||||
data-test-exported-services-empty
|
||||
>
|
||||
<BlockSlot @name="header">
|
||||
<h2>
|
||||
{{t
|
||||
|
|
|
@ -82,7 +82,10 @@
|
|||
/>
|
||||
</collection.Collection>
|
||||
<collection.Empty>
|
||||
<EmptyState @login={{route.model.app.login.open}}>
|
||||
<EmptyState
|
||||
@login={{route.model.app.login.open}}
|
||||
data-test-imported-services-empty
|
||||
>
|
||||
<BlockSlot @name="header">
|
||||
<h2>
|
||||
{{t
|
||||
|
|
|
@ -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
|
|
@ -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);
|
||||
});
|
||||
}
|
|
@ -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)),
|
||||
};
|
||||
|
|
|
@ -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']),
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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'),
|
||||
};
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue