ui: Add more acceptance tests for cluster peering (#14707)

* ui: Add more acceptance tests for cluster peering

* Lint
This commit is contained in:
John Cowen 2022-09-29 17:38:41 +01:00 committed by GitHub
parent 4ece020bf1
commit 60400173b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 186 additions and 3 deletions

View File

@ -46,7 +46,7 @@ as |item index|>
<Actions as |Action|>
{{#if (can "write peer" item=item)}}
<Action
data-test-edit-action
data-test-regenerate-action
{{on 'click' (fn @onedit item)}}
>
<BlockSlot @name="label">

View File

@ -10,9 +10,10 @@ export const selectors = {
},
}
};
export default (collection, isPresent, attribute) => () => {
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']),
});
};

View File

@ -73,6 +73,7 @@ as |sort filters items|}}
@aria={{hash
label="Add peer connection"
}}
class="peer-create-modal"
as |modal|>
<BlockSlot @name="header">
{{did-insert (set this 'create' modal)}}

View File

@ -0,0 +1,43 @@
@setupApplicationTest
Feature: dc / peers / create: Peer Create Token
Scenario:
Given 1 datacenter model with the value "dc-1"
And the url "/v1/peering/token" responds with from yaml
---
body:
PeeringToken: an-encoded-token
---
When I visit the peers page for yaml
---
dc: dc-1
---
Then the url should be /dc-1/peers
And I click create
Then I fill in with yaml
---
Name: new-peer
---
When I click ".peer-create-modal .modal-dialog-footer button"
Then a POST request was made to "/v1/peering/token" from yaml
---
body:
PeerName: new-peer
---
Then I see the text "an-encoded-token" in ".consul-peer-form-generate code"
When I click ".consul-peer-form-generate button[type=reset]"
And the url "/v1/peering/token" responds with from yaml
---
body:
PeeringToken: another-encoded-token
---
Then I fill in with yaml
---
Name: another-new-peer
---
When I click ".peer-create-modal .modal-dialog-footer button"
Then a POST request was made to "/v1/peering/token" from yaml
---
body:
PeerName: another-new-peer
---
Then I see the text "another-encoded-token" in ".consul-peer-form-generate code"

View File

@ -0,0 +1,47 @@
@setupApplicationTest
Feature: dc / peers / delete: Deleting items with confirmations, success and error notifications
Background:
Given 1 datacenter model with the value "datacenter"
Scenario: Deleting a peer model from the listing page
Given 1 peer model from yaml
---
Name: peer-name
State: ACTIVE
---
When I visit the peers page for yaml
---
dc: datacenter
---
And I click actions on the peers
And I click delete on the peers
And I click confirmDelete on the peers
Then a DELETE request was made to "/v1/peering/peer-name"
And "[data-notification]" has the "notification-delete" class
And "[data-notification]" has the "success" class
Scenario: Deleting a peer from the peer listing page with error
Given 1 peer model from yaml
---
Name: peer-name
State: ACTIVE
---
When I visit the peers page for yaml
---
dc: datacenter
---
Given the url "/v1/peering/peer-name" responds with a 500 status
And I click actions on the peers
And I click delete on the peers
And I click confirmDelete on the peers
And "[data-notification]" has the "notification-update" class
And "[data-notification]" has the "error" class
Scenario: A Peer currently deleting cannot be deleted
Given 1 peer model from yaml
---
Name: peer-name
State: DELETING
---
When I visit the peers page for yaml
---
dc: datacenter
---
And I don't see actions on the peers

View File

@ -0,0 +1,30 @@
@setupApplicationTest
Feature: dc / peers / establish: Peer Establish Peering
Scenario:
Given 1 datacenter model with the value "dc-1"
And the url "/v1/peering/token" responds with from yaml
---
body:
PeeringToken: an-encoded-token
---
When I visit the peers page for yaml
---
dc: dc-1
---
Then the url should be /dc-1/peers
And I click create
When I click "[data-test-tab=tab_establish-peering] button"
Then I fill in with yaml
---
Name: new-peer
Token: an-encoded-token
---
When I click ".peer-create-modal .modal-dialog-footer button"
Then a POST request was made to "/v1/peering/establish" from yaml
---
body:
PeerName: new-peer
PeeringToken: an-encoded-token
---
And "[data-notification]" has the "notification-update" class
And "[data-notification]" has the "success" class

View File

@ -0,0 +1,21 @@
@setupApplicationTest
Feature: dc / peers / regenerate: Regenerate Peer Token
Scenario:
Given 1 datacenter model with the value "datacenter"
And 1 peer model from yaml
---
Name: peer-name
State: ACTIVE
---
And the url "/v1/peering/token" responds with from yaml
---
body:
PeeringToken: an-encoded-token
---
When I visit the peers page for yaml
---
dc: datacenter
---
And I click actions on the peers
And I click regenerate on the peers
Then I see the text "an-encoded-token" in ".consul-peer-form-generate code"

View File

@ -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);
});
}

View File

@ -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);
});
}

View File

@ -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);
});
}

View File

@ -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);
});
}

View File

@ -111,7 +111,7 @@ const consulNspaceList = consulNspaceListFactory(
text,
morePopoverMenu
);
const consulPeerList = consulPeerListFactory(collection, isPresent, attribute);
const consulPeerList = consulPeerListFactory(collection, isPresent, attribute, morePopoverMenu);
const consulKvList = consulKvListFactory(collection, clickable, attribute, deletable);
const consulTokenList = consulTokenListFactory(
collection,