open-consul/ui-v2/tests/acceptance/dc/acls/tokens/login-errors.feature

53 lines
1.8 KiB
Gherkin
Raw Normal View History

UI: Removes success notification on faking a success response for `self` (#4906) In order to continue supporting the legacy ACL system, we replace the 500 error from a non-existent `self` endpoint with a response of a `null` `AccessorID` - which makes sense (a null AccessorID means old API) We then redirect the user to the old ACL pages which then gives a 403 if their token was wrong which then redirects them back to the login page. Due to the multiple redirects and not wanting to test the validity of the token before redirecting (thus calling the same API endpoint twice), it is not straightforwards to turn the 'faked' response from the `self` endpoint into an error (flash messages are 'lost' through multiple redirects). In order to make this a slightly better experience, you can now return a `false` during execution of an action requiring success/failure feedback, this essentially skips the notification, so if the action is 'successful' but you don't want to show the notification, you can. This resolves showing a successful notification when the `self` endpoint response is faked. The last part of the puzzle is to make sure that the global 403 catching error in the application Route also produces an erroneous notification. Please note this can only happen with a ui client using the new ACL system when communicating with a cluster using the old ACL system, and only when you enter the wrong token. Lastly, further acceptance tests have been added around this This commit also adds functionality to avoid any possible double notification messages, to avoid UI overlapping
2018-11-07 15:57:41 +00:00
@setupApplicationTest
Feature: dc / acls / tokens / index: ACL Login Errors
Scenario: I get any 500 error that is not the specific legacy token cluster one
Given 1 datacenter model with the value "dc-1"
Given the url "/v1/acl/tokens" responds with a 500 status
When I visit the tokens page for yaml
---
dc: dc-1
---
Then the url should be /dc-1/acls/tokens
Then I see the text "500 (The backend responded with an error)" in "[data-test-error]"
Scenario: I get a 500 error from acl/tokens that is the specific legacy one
Given 1 datacenter model with the value "dc-1"
And the url "/v1/acl/tokens" responds with from yaml
---
status: 500
body: "rpc error making call: rpc: can't find method ACL.TokenRead"
---
When I visit the tokens page for yaml
---
dc: dc-1
---
Then the url should be /dc-1/acls/tokens
Then ".app-view" has the "unauthorized" class
Scenario: I get a 500 error from acl/token/self that is the specific legacy one
Given 1 datacenter model with the value "dc-1"
Given the url "/v1/acl/tokens" responds with from yaml
---
status: 500
body: "rpc error making call: rpc: can't find method ACL.TokenRead"
---
And the url "/v1/acl/token/self" responds with from yaml
---
status: 500
body: "rpc error making call: rpc: can't find method ACL.TokenRead"
---
And the url "/v1/acl/list" responds with a 403 status
When I visit the tokens page for yaml
---
dc: dc-1
---
Then the url should be /dc-1/acls/tokens
Then ".app-view" has the "unauthorized" class
Then I fill in with yaml
---
secret: something
---
And I submit
Then ".app-view" has the "unauthorized" class
And "[data-notification]" has the "error" class