Skip to content

Commit

Permalink
Merge branch 'dev' into feature/sprint-67-uifixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ikethecoder committed May 12, 2023
2 parents 4231132 + 970a73e commit 38e4e29
Show file tree
Hide file tree
Showing 50 changed files with 781 additions and 226 deletions.
2 changes: 1 addition & 1 deletion e2e/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export default defineConfig({
config.specPattern=[
'./cypress/tests/01-*/*.ts',
'./cypress/tests/02-*/*.ts',
'./cypress/tests/06-*/*.ts',
'./cypress/tests/03-*/*.ts',
'./cypress/tests/04-*/*.ts',
'./cypress/tests/05-*/*.ts',
'./cypress/tests/06-*/*.ts',
'./cypress/tests/07-*/*.ts',
'./cypress/tests/08-*/*.ts',
'./cypress/tests/09-*/*.ts',
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/fixtures/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
"mode": "auto",
"environmentDetails": [
{
"environment": "dev",
"environment": "test",
"issuerUrl": "http://keycloak.localtest.me:9080/auth/realms/master",
"clientRegistration": "managed",
"clientId": "gwa-api",
Expand Down
32 changes: 32 additions & 0 deletions e2e/cypress/fixtures/apiowner.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,38 @@
}
}
},
"clientIdSecret_publicProfile": {
"product": {
"name": "Client Credentials Test Product",
"orgName": "Ministry of Health",
"orgUnitName": "Planning and Innovation Division",
"environment": {
"name": "test",
"config": {
"terms": "Terms of Use for API Gateway",
"authorization": "Public",
"optionalInstructions": "This is a automation test",
"serviceName": "cc-service-for-platform"
}
}
}
},
"KongApiOnly": {
"product": {
"name": "Auto Test Product",
"orgName": "Ministry of Health",
"orgUnitName": "Planning and Innovation Division",
"environment": {
"name": "dev",
"config": {
"terms": "Terms of Use for API Gateway",
"authorization": "Kong API Key Only",
"optionalInstructions": "This is a automation test",
"serviceName": "a-service-for-newplatform"
}
}
}
},
"clientIdSecret_KongKeyToCC": {
"product": {
"name": "Auto Test Product",
Expand Down
10 changes: 10 additions & 0 deletions e2e/cypress/fixtures/developer.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@
"environment": "dev"
}
},
"elevatedAccess":{
"application": {
"name": "Request for Elevated Acess",
"description": "Test application for auto test"
},
"product": {
"name": "Auto Test Product",
"environment": "dev"
}
},
"deleteApplication":{
"application": {
"name": "delete-application-without-access",
Expand Down
4 changes: 3 additions & 1 deletion e2e/cypress/fixtures/manage-control-config-setting.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"rateLimiting": {
"requestPerHour_Consumer" : "1",
"requestPerHour_Global" : "2"
"requestPerHour_Global" : "2",
"rateLimiting_hour": "25",
"requestPerHour_Elevated" : "250"
},
"ipRestriction" :{
"ipRange_valid" : "192.168.0.1/0",
Expand Down
7 changes: 6 additions & 1 deletion e2e/cypress/fixtures/manage-control/kong-plugin-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
"config.hour": "20",
"config.policy": "local"
},
"rateLimiting902": {
"name": "rate-limiting_902",
"config.hour": "20",
"limit_by": "service"
},
"rateLimitingConsumer": {
"name": "rate-limiting",
"config.hour": "100",
Expand All @@ -17,6 +22,6 @@
"username": "consumer1"
},
"keyAuth": {
"config.anonymous": "09f98d53-4797-4ba9-a9e8-6417a1cee3b0"
"config.anonymous": "e60a4444-eeab-4d5b-8285-6e6a648d85ec"
}
}
8 changes: 8 additions & 0 deletions e2e/cypress/fixtures/rate-limiting-902.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
plugins:
- name: rate-limiting_902
tags: [ns.newplatform]
config:
fault_tolerant: true
hide_client_headers: false
limit_by: service
minute: 30
22 changes: 12 additions & 10 deletions e2e/cypress/fixtures/service-plugin-key-auth-only.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
plugins:
- name: key-auth
tags: [ ns.newplatform ]
protocols: [ http, https ]
config:
key_names: ["X-API-KEY"]
run_on_preflight: true
hide_credentials: true
key_in_body: false

plugins:
-
name: key-auth
tags:
- ns.newplatform
protocols:
- http
- https
config:
key_names:
- x-api-key
anonymous: 1aaf2351-0622-4cc4-8d14-32e78771e620
5 changes: 4 additions & 1 deletion e2e/cypress/pageObjects/apiDirectory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ class ApiDirectoryPage {
addOrganizationBtn: string = '[data-testid="addOrganizationBtn"]'


createAccessRequest(product: any, app: any, accessRqst: any) {
createAccessRequest(product: any, app: any, accessRqst: any, elevatedAccess?: boolean) {
cy.contains('a', product.name, { timeout: 10000 }).should('be.visible');
cy.contains(product.name).click()
if(elevatedAccess){
cy.contains('For elevated access, please Request Access').should('be.visible');
}
cy.get(this.rqstAccessBtn).click()
cy.get(this.appSelect).select(app.name)
cy.get('[data-testid=access-rqst-app-env-' + product.environment + ']').click()
Expand Down
60 changes: 47 additions & 13 deletions e2e/cypress/pageObjects/consumers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ import { Assertion } from "chai"
import { wrap } from "module"
import dateformat from 'dateformat'
import { checkElementExists } from "../support/e2e"
import { String } from "cypress/types/lodash"
import { StringLiteral } from "typescript"
import { truncate } from "fs/promises"

export default class ConsumersPage {

path: string = '/manager/consumers'
rateLimitHourInput: string = '[data-testid="ratelimit-hour-input"]'
ipRestrictionAllowInput: string = '[data-testid="allow-ip-restriction-input-input"]'
Expand Down Expand Up @@ -38,6 +42,9 @@ export default class ConsumersPage {
removeRateLimitControlButton: string = '[data-testid="ratelimit-item-delete-btn-0"]'
rateLimitRouteRadioBtn: string = '[data-testid="ratelimit-route-radio"]'
consumerDialogCancelBtn: string = '[data-testid="edit-consumer-dialog-edit-cancel-btn"]'
linkConsumerToNamespaceBtn: string = '[data-testid="link-consumer-namespace"]'
userNameTxt: string = '[data-testid="link-consumer-username"]'
linkBtn: string = '[data-testid="link-consumer-link-btn"]'

clickOnRateLimitingOption() {
cy.get(this.rateLimitingOption, { timeout: 2000 }).click()
Expand Down Expand Up @@ -65,14 +72,24 @@ export default class ConsumersPage {
setRateLimiting(requestCount: string, scope = 'Service', policy = 'Local') {
this.editConsumerDialog()
cy.wait(2000)
if (!checkElementExists(this.rateLimitingOption)){
if (!checkElementExists(this.rateLimitingOption)) {
cy.get(this.consumerDialogCancelBtn).click()
this.editConsumerDialog()
}
// cy.wait(1000)
cy.wait(1000)
this.setRateLimitingWithOutConsumerID(requestCount, scope, policy)
// cy.wait(500)
cy.get(this.consumerDialogSaveBtn).click()
cy.get(this.consumerDialogSaveBtn, { timeout: 2000 }).should('not.exist')
cy.wait(3000)
}

setRateLimitingWithOutConsumerID(requestCount: string, scope?: string, policy?: string) {
scope = scope || 'Service'
policy = policy || 'Local'
this.clickOnRateLimitingOption()
cy.wait(3000)


cy.get(this.rateLimitHourInput, { timeout: 5000 }).click()
cy.get(this.rateLimitHourInput, { timeout: 2000 }).type(requestCount)
Expand All @@ -83,10 +100,6 @@ export default class ConsumersPage {
cy.get(this.policyDropDown).select(policy, { force: true }).invoke('val')
}
cy.get(this.rateLimitingApplyBtn).click()
// cy.wait(500)
cy.get(this.consumerDialogSaveBtn).click()
cy.get(this.consumerDialogSaveBtn, { timeout: 2000 }).should('not.exist')
cy.wait(3000)
}

setAllowedIPAddress(allowIP: string, scope = 'Service') {
Expand All @@ -98,8 +111,6 @@ export default class ConsumersPage {
cy.contains('span', 'Route').click({ force: true })
}
cy.get(this.applyBtn).click()
// cy.contains('h2', 'ip-restriction').should('be.visible')
// cy.wait(500)
cy.get(this.consumerDialogSaveBtn).click()
cy.wait(1000)
}
Expand Down Expand Up @@ -151,7 +162,7 @@ export default class ConsumersPage {
cy.verifyToastMessage("Access request approved")
}

reviewThePendingRequest() : Boolean{
reviewThePendingRequest(): Boolean {
cy.wait(3000)
var flag = false;
cy.get("body").then($body => {
Expand Down Expand Up @@ -310,16 +321,39 @@ export default class ConsumersPage {
selectAuthorizationScope(scopes: any) {
cy.contains("Authorization").click()
scopes.forEach(function (scope: string) {
cy.get('[data-testid="client-scope-'+scope+'"]').click()
cy.get('[data-testid="client-scope-' + scope + '"]').click()
cy.wait(1000)
})
}

selectClientRole(roles: any) {
cy.contains("Authorization").click()
roles.forEach(function (role: string) {
cy.get('[data-testid="client-role-'+role.toLocaleLowerCase()+'"]').click()
cy.get('[data-testid="client-role-' + role.toLocaleLowerCase() + '"]').click()
cy.wait(1000)
})
}
}

deleteConsumer(consumerID: any) {
cy.get(this.allConsumerTable).find('tr').each(($row, index) => {
cy.log($row.find('td:nth-child(1)').text())
if ($row.find('td:nth-child(1)').text() == consumerID) {
cy.wrap($row).find('button').first().click()
cy.get('[data-testid="consumer-delete-menuitem"]').last().click({force:true})
}
})
}

clickOnLinkConsumerToNamespaceBtn() {
cy.get(this.linkConsumerToNamespaceBtn).click({force:true})
}

linkTheConsumerToNamespace(consumerID: any) {
cy.get(this.userNameTxt).type(consumerID)
cy.get(this.linkBtn).click({force:true})
}

getText(){
cy.get('[data-testid="all-consumer-control-tbl"]').find('tr').last().find('td').first().find('a').as('inputValue')
}
}
8 changes: 8 additions & 0 deletions e2e/cypress/pageObjects/myAccess.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class myAccessPage {

generateSecretsBtn: string = '[data-testid=generate-secrets-button]'
apiKyeValueTxt: string = '[data-testid=sa-new-creds-api-key]'
clientId: string = '[data-testid=sa-new-creds-client-id]'
Expand All @@ -12,6 +13,7 @@ class myAccessPage {
regenerateCredentialBtn: string = '[data-testid=regenerate-credentials-btn]'
regenerateCredentialCloseBtn: string = '[data-testid=regenerate-credentials-done-button]'
collectCredentialsBtn: string = '[data-testid="generate-credentials-button"]'
clientIDValueTxt: string = '[data-testid="sa-new-creds-client-id"]'
path: string = '/devportal/access'


Expand Down Expand Up @@ -158,6 +160,12 @@ class myAccessPage {
}
})
}

saveClientIDValue() {
cy.get(this.clientIDValueTxt).invoke('val').then(($clientID: any) => {
cy.saveState('clientID', $clientID)
})
}
}

export default myAccessPage
1 change: 0 additions & 1 deletion e2e/cypress/pageObjects/namespaceAccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class NamespaceAccessPage {
// cy.get(this.userNameInput).type(editPermission.email);
let accessRole: Array<string> = editPermission.accessRole
accessRole.forEach(function (accessName) {
debugger
cy.contains("Permissions").next().find('li').find('label').each(($el, index, $list) => {
// cy.wrap($el).find('input').uncheck({ force: true });
const textAccessRoleName = $el.text()
Expand Down
Loading

0 comments on commit 38e4e29

Please sign in to comment.