Skip to content

Commit

Permalink
Cypress check stalls execution (#993)
Browse files Browse the repository at this point in the history
* Change Cypress reload function to check the stall execution issue on CI-CD

* Updated Kong file for latest kong-plugin-jwt-keycloak plugins

* Update response message for invalid credential after updating new keycloak

* Split Test Plan into separate spec files

* Split cids access approve request scenarios into separate spec file

* Update gwa response message
  • Loading branch information
nirajCITZ committed Feb 23, 2024
1 parent daa42eb commit 74a4dbe
Show file tree
Hide file tree
Showing 52 changed files with 454 additions and 437 deletions.
4 changes: 2 additions & 2 deletions e2e/cypress/tests/01-api-key/01-create-api.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Products from '../../pageObjects/products'
import ServiceAccountsPage from '../../pageObjects/serviceAccounts'


describe('Create API Spec', () => {
describe('Create API Spec', () => {
const login = new LoginPage()
const home = new HomePage()
const sa = new ServiceAccountsPage()
Expand All @@ -14,7 +14,7 @@ describe('Create API Spec', () => {

before(() => {
cy.visit('/')
cy.reload()
cy.reload(true)
cy.resetState()
cy.deleteAllCookies()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('Change an Active environment to Inactive', () => {
before(() => {
cy.visit('/')
cy.deleteAllCookies()
cy.reload()
cy.reload(true)
})

beforeEach(() => {
Expand Down Expand Up @@ -114,7 +114,7 @@ describe('Change an the environment back to active', () => {
cy.visit('/')
// cy.deleteAllCookies()
// cy.clearCookies()
// cy.reload()
// cy.reload(true)
})

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Request Access without colleting credential Spec', () => {

before(() => {
cy.visit('/')
cy.reload()
cy.reload(true)
})

beforeEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/tests/01-api-key/07-approve-pending-rqst.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Approve Pending Request Spec', () => {
before(() => {
cy.visit('/')
cy.deleteAllCookies()
cy.reload()
cy.reload(true)
})

beforeEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/tests/01-api-key/08-grant-access.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Grant Access Spec', () => {
before(() => {
cy.visit('/')
cy.deleteAllCookies()
cy.reload()
cy.reload(true)
})

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('Grant appropriate permissions to team members for client credential fl
before(() => {
cy.visit('/')
cy.deleteAllCookies()
cy.reload()
cy.reload(true)
})

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Generate Authorization Profiles', () => {
before(() => {
cy.visit('/')
cy.deleteAllCookies()
cy.reload()
cy.reload(true)
})

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('Access manager approves developer access request for Client ID/Secret

before(() => {
cy.visit('/')
cy.reload()
cy.reload(true)
})

beforeEach(() => {
Expand Down Expand Up @@ -77,215 +77,4 @@ describe('Make an API request using Client ID, Secret, and Access Token', () =>
})
})
})
})

describe('Verify the selected client scoped is displayed in assigned default list', () => {
const clientScopes = new keycloakClientScopesPage()
const groups = new keycloakGroupPage()
var nameSpace: string
const home = new HomePage()
const authProfile = new AuthorizationProfile()

before(() => {
cy.visit(Cypress.env('KEYCLOAK_URL'))
cy.reload()
})

beforeEach(() => {
cy.preserveCookies()
cy.fixture('developer').as('developer')
cy.fixture('apiowner').as('apiowner')
cy.fixture('state/regen').as('regen')
cy.fixture('admin').as('admin')
})

it('Authenticates Admin owner', () => {
cy.get('@admin').then(({ user }: any) => {
cy.contains('Administration Console').click({ force: true })
cy.keycloakLogin(user.credentials.username, user.credentials.password)
})
})

it('Navigate to Clients page', () => {
cy.contains('Clients').click()
})

it('Select the consumer ID', () => {
cy.readFile('cypress/fixtures/state/store.json').then((store_res) => {
let cc = JSON.parse(store_res.clientidsecret)
cy.contains(cc.clientId).click()
})
})

it('Navigate to client scope tab', () => {
clientScopes.selectTab('Client Scopes')
})

it('Verify that "System.Write" scope is in assigned default scope', () => {
clientScopes.verifyAssignedScope('System.Write', true)
})

after(() => {
cy.keycloakLogout()
})

})

describe('Deselect the scope from authorization tab', () => {
const login = new LoginPage()
const home = new HomePage()
const consumers = new ConsumersPage()

before(() => {
cy.visit('/')
cy.reload()
})

beforeEach(() => {
cy.preserveCookies()
cy.fixture('access-manager').as('access-manager')
cy.fixture('apiowner').as('apiowner')
cy.fixture('manage-control-config-setting').as('manage-control-config-setting')
cy.fixture('common-testdata').as('common-testdata')
// cy.visit(login.path)
})

it('authenticates Mark (Access Manager)', () => {
cy.get('@access-manager').then(({ user }: any) => {
cy.get('@common-testdata').then(({ clientCredentials }: any) => {
cy.login(user.credentials.username, user.credentials.password).then(() => {
home.useNamespace(clientCredentials.namespace);
})
})
})
})

it('Navigate to Consumer page ', () => {
cy.visit(consumers.path);
})

it('Select the consumer from the list ', () => {
consumers.clickOnTheFirstConsumerID()
})

it('Deselect scopes in Authorization Tab', () => {
cy.get('@apiowner').then(({ clientCredentials }: any) => {
consumers.editConsumerDialog()
consumers.selectAuthorizationScope(clientCredentials.clientIdSecret.authProfile.scopes, false)
consumers.saveAppliedConfig()
})
})
after(() => {
cy.logout()
})
})

describe('Verify the selected client scoped is not displayed in assigned default list', () => {
const clientScopes = new keycloakClientScopesPage()
const groups = new keycloakGroupPage()
var nameSpace: string
const home = new HomePage()
const authProfile = new AuthorizationProfile()

before(() => {
cy.visit(Cypress.env('KEYCLOAK_URL'))
cy.reload()
})

beforeEach(() => {
cy.preserveCookies()
cy.fixture('developer').as('developer')
cy.fixture('apiowner').as('apiowner')
cy.fixture('state/regen').as('regen')
cy.fixture('admin').as('admin')
})

it('Authenticates Admin owner', () => {
cy.get('@admin').then(({ user }: any) => {
cy.contains('Administration Console').click({ force: true })
cy.keycloakLogin(user.credentials.username, user.credentials.password)
})
})

it('Navigate to Clients page', () => {
cy.contains('Clients').click()
})

it('Select the consumer ID', () => {
cy.readFile('cypress/fixtures/state/store.json').then((store_res) => {
let cc = JSON.parse(store_res.clientidsecret)
cy.contains(cc.clientId).click()
})
})

it('Navigate to client scope tab', () => {
clientScopes.selectTab('Client Scopes')
})

it('Verify that "System.Write" scope is not in assigned default scope', () => {
clientScopes.verifyAssignedScope('System.Write', false)
})

after(() => {
cy.keycloakLogout()
})

})

// describe('Revoke product environment access for Client Credential authorization spec', () => {
// const login = new LoginPage()
// const consumers = new ConsumersPage()
// const home = new HomePage()

// before(() => {
// cy.visit('/')
// cy.deleteAllCookies()
// cy.reload()
// })

// 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(({ clientCredentials }: any) => {
// cy.get('@access-manager').then(({ user }: any) => {
// cy.login(user.credentials.username, user.credentials.password)
// home.useNamespace(clientCredentials.namespace);
// })
// })
// })

// it('Navigate to Consumer page and filter the product', () => {
// cy.get('@apiowner').then(({ clientCredentials }: any) => {
// cy.visit(consumers.path);
// let product = clientCredentials.clientIdSecret.product
// 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")
// })


// after(() => {
// cy.logout()
// cy.clearLocalStorage({ log: true })
// cy.deleteAllCookies()
// })

// })
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import HomePage from '../../pageObjects/home'
import LoginPage from '../../pageObjects/login'
import ConsumersPage from '../../pageObjects/consumers'
import KeycloakUserGroupPage from '../../pageObjects/keycloakUserGroup'
import keycloakGroupPage from '../../pageObjects/keycloakGroup'
import AuthorizationProfile from '../../pageObjects/authProfile'
import keycloakClientScopesPage from '../../pageObjects/keycloakClientScopes'

describe('Verify the selected client scoped is displayed in assigned default list', () => {
const clientScopes = new keycloakClientScopesPage()
const groups = new keycloakGroupPage()
var nameSpace: string
const home = new HomePage()
const authProfile = new AuthorizationProfile()

before(() => {
cy.visit(Cypress.env('KEYCLOAK_URL'))
cy.reload(true)
})

beforeEach(() => {
cy.preserveCookies()
cy.fixture('developer').as('developer')
cy.fixture('apiowner').as('apiowner')
cy.fixture('state/regen').as('regen')
cy.fixture('admin').as('admin')
})

it('Authenticates Admin owner', () => {
cy.get('@admin').then(({ user }: any) => {
cy.contains('Administration Console').click({ force: true })
cy.keycloakLogin(user.credentials.username, user.credentials.password)
})
})

it('Navigate to Clients page', () => {
cy.contains('Clients').click()
})

it('Select the consumer ID', () => {
cy.readFile('cypress/fixtures/state/store.json').then((store_res) => {
let cc = JSON.parse(store_res.clientidsecret)
cy.contains(cc.clientId).click()
})
})

it('Navigate to client scope tab', () => {
clientScopes.selectTab('Client Scopes')
})

it('Verify that "System.Write" scope is in assigned default scope', () => {
clientScopes.verifyAssignedScope('System.Write', true)
})

after(() => {
cy.keycloakLogout()
})

})
Loading

0 comments on commit 74a4dbe

Please sign in to comment.