-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for Revoke Environment access and Delete consumer feature
- Loading branch information
Showing
15 changed files
with
427 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
services: | ||
- name: a-service-for-newplatform | ||
host: httpbin.org | ||
tags: [ns.newplatform.test] | ||
port: 443 | ||
protocol: https | ||
retries: 0 | ||
routes: | ||
- name: a-service-for-newplatform-route | ||
tags: [ns.newplatform.test] | ||
hosts: | ||
- a-service-for-newplatform.api.gov.bc.ca | ||
paths: | ||
- / | ||
methods: | ||
- GET | ||
strip_path: false | ||
https_redirect_status_code: 426 | ||
path_handling: v0 | ||
|
||
plugins: | ||
- name: key-auth | ||
tags: [ ns.newplatform.test ] | ||
protocols: [ http, https ] | ||
config: | ||
key_names: ["X-API-KEY"] | ||
run_on_preflight: true | ||
hide_credentials: true | ||
key_in_body: false | ||
- name: acl | ||
tags: [ ns.newplatform.test ] | ||
config: | ||
hide_groups_header: true | ||
allow: [ "406CB7CF" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
services: | ||
- name: a-service-for-newplatform-test | ||
host: httpbin.org | ||
tags: [ns.newplatform.test] | ||
port: 443 | ||
protocol: https | ||
retries: 0 | ||
routes: | ||
- name: a-service-for-newplatform-test-route | ||
tags: [ns.newplatform.test] | ||
hosts: | ||
- a-service-for-newplatform-test.api.gov.bc.ca | ||
paths: | ||
- / | ||
methods: | ||
- GET | ||
strip_path: false | ||
https_redirect_status_code: 426 | ||
path_handling: v0 | ||
|
||
plugins: | ||
- name: key-auth | ||
tags: [ ns.newplatform.test ] | ||
protocols: [ http, https ] | ||
config: | ||
key_names: ["X-API-KEY"] | ||
run_on_preflight: true | ||
hide_credentials: true | ||
key_in_body: false | ||
- name: acl | ||
tags: [ ns.newplatform.test ] | ||
config: | ||
hide_groups_header: true | ||
allow: [ "9AA97172" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import ConsumersPage from '../../pageObjects/consumers' | ||
import LoginPage from '../../pageObjects/login' | ||
import HomePage from '../../pageObjects/home' | ||
import ProductPage from '../../pageObjects/products' | ||
|
||
describe('Revoke product environment access for Kong API spec', () => { | ||
const login = new LoginPage() | ||
const consumers = new ConsumersPage() | ||
const home = new HomePage() | ||
|
||
before(() => { | ||
cy.visit('/') | ||
cy.reload() | ||
cy.deleteAllCookies() | ||
}) | ||
|
||
beforeEach(() => { | ||
cy.preserveCookies() | ||
cy.fixture('access-manager').as('access-manager') | ||
cy.fixture('apiowner').as('apiowner') | ||
cy.fixture('developer').as('developer') | ||
cy.fixture('state/store').as('store') | ||
}) | ||
|
||
it('authenticates Mark (Access-Manager)', () => { | ||
cy.get('@apiowner').then(({ namespace }: any) => { | ||
cy.get('@access-manager').then(({ user }: any) => { | ||
cy.login(user.credentials.username, user.credentials.password) | ||
home.useNamespace(namespace); | ||
}) | ||
}) | ||
}) | ||
|
||
it('Navigate to Consumer page and filter the product', () => { | ||
cy.get('@apiowner').then(({ product }: any) => { | ||
cy.visit(consumers.path); | ||
consumers.filterConsumerByTypeAndValue('Products', product.name) | ||
}) | ||
}) | ||
|
||
it('Click on the first consumer', () => { | ||
consumers.clickOnTheFirstConsumerID() | ||
}) | ||
|
||
it('Revoke access for Test environment', () => { | ||
cy.wait(1000) | ||
consumers.revokeProductEnvAccess('Test') | ||
}) | ||
|
||
it('Verify the confirmation message once the access is revoked', () => { | ||
cy.verifyToastMessage("Product Revoked") | ||
}) | ||
|
||
it('Navigate to Consumer page and filter the product', () => { | ||
cy.get('@apiowner').then(({ product }: any) => { | ||
cy.visit(consumers.path); | ||
consumers.filterConsumerByTypeAndValue('Products', product.name) | ||
}) | ||
}) | ||
|
||
it('Click on the first consumer', () => { | ||
consumers.clickOnTheFirstConsumerID() | ||
}) | ||
|
||
it('Click on Grant Access button', () => { | ||
cy.wait(1000) | ||
consumers.clickOnGrantAccessBtn() | ||
}) | ||
|
||
it('Grant Access to Test environment', () => { | ||
cy.get('@apiowner').then(({ product }: any) => { | ||
consumers.grantAccessToGivenProductEnvironment(product.name, product.test_environment.name) | ||
}) | ||
}) | ||
|
||
it('Verify that API is accessible with the generated API Key for Test environment', () => { | ||
cy.get('@apiowner').then(({ product }: any) => { | ||
cy.makeKongRequest(product.test_environment.config.serviceName, 'GET').then((response) => { | ||
cy.log(response) | ||
expect(response.status).to.be.equal(200) | ||
}) | ||
}) | ||
}) | ||
|
||
after(() => { | ||
cy.logout() | ||
cy.clearLocalStorage({ log: true }) | ||
cy.deleteAllCookies() | ||
}) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.