From 067905bf50c14b04a3b24addb5d355cda04849e9 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Fri, 5 Jul 2024 08:16:10 -0700 Subject: [PATCH 01/54] add createGateway command --- e2e/cypress/pageObjects/home.ts | 1 + e2e/cypress/support/auth-commands.ts | 24 +++++++++++++++++-- e2e/cypress/support/global.d.ts | 5 ++++ .../tests/01-api-key/01-create-api.cy.ts | 3 +-- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/e2e/cypress/pageObjects/home.ts b/e2e/cypress/pageObjects/home.ts index 559257c20..2e6dc43e6 100644 --- a/e2e/cypress/pageObjects/home.ts +++ b/e2e/cypress/pageObjects/home.ts @@ -9,6 +9,7 @@ class HomePage { manageNamespace: string = '[data-testid="ns-dropdown-manage-btn"]' confirmDeleteNamespaceBtn: string = '[data-testid="confirm-delete-namespace-btn"]' namespaceCancelBtn: string = '[data-testid="ns-modal-cancel-btn"]' + gatewaysNavButtom: string = '[data-testid="navbar-link-Gateways"]' createNamespace(name: string): void { cy.get(this.nsDropdown).click() diff --git a/e2e/cypress/support/auth-commands.ts b/e2e/cypress/support/auth-commands.ts index c2c6d4c48..c5b8d84c9 100644 --- a/e2e/cypress/support/auth-commands.ts +++ b/e2e/cypress/support/auth-commands.ts @@ -61,10 +61,9 @@ Cypress.Commands.add('login', (username: string, password: string, skipFlag = fa } if (!skipFlag) { - cy.get(home.nsDropdown, { timeout: 6000 }).then(($el) => { + cy.get(home.gatewaysNavButtom, { timeout: 6000 }).then(($el) => { expect($el).to.exist expect($el).to.be.visible - expect($el).contain('No Active Namespace') }) cy.log('> Log in') } @@ -79,6 +78,27 @@ Cypress.Commands.add('keycloakLogin', (username: string, password: string) => { cy.get(login.loginSubmitButton).click() }) +Cypress.Commands.add('createGatewayV3', (gatewayid?: string, displayname?: string) => { + cy.log('< Create namespace - ') + const payload = { + gatewayId: gatewayid ? gatewayid : '', + displayName: displayname ? displayname : '', + } + cy.setHeaders({ 'Content-Type': 'application/json' }) + cy.setRequestBody(payload) + cy.callAPI('ds/api/v3/gateways', 'POST').then( + ({ apiRes: { body, status } }: any) => { + expect(status).to.be.equal(200) + if (payload.gatewayId) { + expect(body.gatewayId).to.be.equal(payload.gatewayId) + } + if (payload.displayName) { + expect(body.displayName).to.be.equal(payload.displayName) + } + } + ) +}) + Cypress.Commands.add('getLastConsumerID', () => { let id: any cy.get('[data-testid="all-consumer-control-tbl"]') diff --git a/e2e/cypress/support/global.d.ts b/e2e/cypress/support/global.d.ts index a3591c2e7..5762de6cd 100644 --- a/e2e/cypress/support/global.d.ts +++ b/e2e/cypress/support/global.d.ts @@ -28,6 +28,11 @@ declare namespace Cypress { preserveCookiesDefaults(): void + createGatewayV3( + gatewayid?: string, + displayname?: string, + ): Chainable + saveState( key: string, value: string, diff --git a/e2e/cypress/tests/01-api-key/01-create-api.cy.ts b/e2e/cypress/tests/01-api-key/01-create-api.cy.ts index 4817e4cfd..7d70320e1 100644 --- a/e2e/cypress/tests/01-api-key/01-create-api.cy.ts +++ b/e2e/cypress/tests/01-api-key/01-create-api.cy.ts @@ -51,8 +51,7 @@ describe('Create API Spec', () => { it('creates and activates new namespace', () => { cy.getUserSession().then(() => { cy.get('@common-testdata').then(({ namespace }: any) => { - nameSpace = namespace - home.createNamespace(namespace) + cy.createGatewayV3(namespace) cy.get('@login').then(function (xhr: any) { userSession = xhr.response.headers['x-auth-request-access-token'] }) From b0d796242dc8f88e0e71c013669f8cc45eab49ca Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Mon, 8 Jul 2024 11:22:25 -0700 Subject: [PATCH 02/54] add query for ns id --- src/authz/graphql-whitelist/unknown-51c470.gql | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/authz/graphql-whitelist/unknown-51c470.gql diff --git a/src/authz/graphql-whitelist/unknown-51c470.gql b/src/authz/graphql-whitelist/unknown-51c470.gql new file mode 100644 index 000000000..ea98aa726 --- /dev/null +++ b/src/authz/graphql-whitelist/unknown-51c470.gql @@ -0,0 +1,7 @@ + +query GetNamespaces { + allNamespaces { + id + name + } +} From 01dc6a38569e23cd1c7038a8b1c55d3a7ca0fc6a Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Mon, 8 Jul 2024 14:21:00 -0700 Subject: [PATCH 03/54] add testid for gatewayid on detail page --- src/nextapp/pages/manager/gateways/detail.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nextapp/pages/manager/gateways/detail.tsx b/src/nextapp/pages/manager/gateways/detail.tsx index a18acea4f..f0700d30f 100644 --- a/src/nextapp/pages/manager/gateways/detail.tsx +++ b/src/nextapp/pages/manager/gateways/detail.tsx @@ -216,7 +216,7 @@ const NamespacesPage: React.FC = () => { )} - + {namespace?.data.currentNamespace?.name} From eabaa84317d685f6a2a71e6ac61762318a1f4b93 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Mon, 8 Jul 2024 14:22:11 -0700 Subject: [PATCH 04/54] and display name --- src/nextapp/pages/manager/gateways/detail.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nextapp/pages/manager/gateways/detail.tsx b/src/nextapp/pages/manager/gateways/detail.tsx index f0700d30f..eb2018bc8 100644 --- a/src/nextapp/pages/manager/gateways/detail.tsx +++ b/src/nextapp/pages/manager/gateways/detail.tsx @@ -195,7 +195,7 @@ const NamespacesPage: React.FC = () => { )} {namespace.isSuccess && !namespace.isFetching && ( <> - + {namespace.data?.currentNamespace?.displayName} Date: Mon, 8 Jul 2024 15:14:51 -0700 Subject: [PATCH 05/54] add activateGateway command --- e2e/cypress/support/auth-commands.ts | 55 ++++++++++++++++++- e2e/cypress/support/global.d.ts | 8 ++- .../tests/01-api-key/01-create-api.cy.ts | 3 +- 3 files changed, 62 insertions(+), 4 deletions(-) diff --git a/e2e/cypress/support/auth-commands.ts b/e2e/cypress/support/auth-commands.ts index c5b8d84c9..bd08aa32f 100644 --- a/e2e/cypress/support/auth-commands.ts +++ b/e2e/cypress/support/auth-commands.ts @@ -1,4 +1,5 @@ import * as jwt from 'jsonwebtoken' +import { gql } from 'graphql-request' import HomePage from '../pageObjects/home' import LoginPage from '../pageObjects/login' import NamespaceAccessPage from '../pageObjects/namespaceAccess' @@ -78,7 +79,7 @@ Cypress.Commands.add('keycloakLogin', (username: string, password: string) => { cy.get(login.loginSubmitButton).click() }) -Cypress.Commands.add('createGatewayV3', (gatewayid?: string, displayname?: string) => { +Cypress.Commands.add('createGateway', (gatewayid?: string, displayname?: string) => { cy.log('< Create namespace - ') const payload = { gatewayId: gatewayid ? gatewayid : '', @@ -99,6 +100,34 @@ Cypress.Commands.add('createGatewayV3', (gatewayid?: string, displayname?: strin ) }) +Cypress.Commands.add('activateGateway', (gatewayId: string) => { + const query = gql` +query GetNamespaces { + allNamespaces { + id + name + } +} +` + return cy.gqlQuery(query).then((response) => { + const nsdata = response.apiRes.body.data.allNamespaces.find((ns: { name: string }) => ns.name === gatewayId) + if (nsdata) { + return nsdata.id + } else { + throw new Error('Namespace not found') + } + }).then((namespaceId) => { + cy.log(`The namespace ID is: ${namespaceId}`) + // activate namespace + cy.setHeaders({ 'Content-Type': 'application/json' }) + cy.callAPI(`admin/switch/${namespaceId}`, 'PUT') + cy.visit('/manager/gateways/detail') + cy.get('[data-testid="ns-detail-gatewayid"]').then(($el) => { + expect($el).contain(gatewayId) + }) + }) +}) + Cypress.Commands.add('getLastConsumerID', () => { let id: any cy.get('[data-testid="all-consumer-control-tbl"]') @@ -546,6 +575,30 @@ Cypress.Commands.add('makeAPIRequest', (endPoint: string, methodType: string) => }) }) +Cypress.Commands.add('gqlQuery', (query, variables = {}) => { + cy.loginByAuthAPI('', '').then((token_res: any) => { + cy.setHeaders({ + 'Accept': 'application/json', + 'Content-Type': 'application/json' + }) + cy.setAuthorizationToken(token_res.token) + return cy.request({ + url: Cypress.env('BASE_URL') + '/gql/api', + method: 'POST', + headers, + body: JSON.stringify({ query, variables }), + failOnStatusCode: false, + }).then((apiResponse) => { + // You can also return data or use it in further tests + const responseData = { + apiRes: apiResponse, + } + // cy.addToAstraScanIdList(response2.body.status) + return responseData + }) + }) +}) + Cypress.Commands.add('makeAPIRequestForScanResult', (scanID: string) => { return cy.request({ url: 'http://astra.localtest.me:8094/alerts/' + scanID, diff --git a/e2e/cypress/support/global.d.ts b/e2e/cypress/support/global.d.ts index 5762de6cd..2a60ddef9 100644 --- a/e2e/cypress/support/global.d.ts +++ b/e2e/cypress/support/global.d.ts @@ -28,11 +28,13 @@ declare namespace Cypress { preserveCookiesDefaults(): void - createGatewayV3( + createGateway( gatewayid?: string, displayname?: string, ): Chainable + activateGateway(gatewayId: string): Chainable> + saveState( key: string, value: string, @@ -82,7 +84,9 @@ declare namespace Cypress { setRequestBody(requestBody: any): void setAuthorizationToken(token: string): void - + + gqlQuery(query: string, variables?: Record): Chainable + callAPI(endPoint: string, methodType: string): Chainable> makeAPIRequest(endPoint: string, methodType: string): Chainable> diff --git a/e2e/cypress/tests/01-api-key/01-create-api.cy.ts b/e2e/cypress/tests/01-api-key/01-create-api.cy.ts index 7d70320e1..79f38187c 100644 --- a/e2e/cypress/tests/01-api-key/01-create-api.cy.ts +++ b/e2e/cypress/tests/01-api-key/01-create-api.cy.ts @@ -51,7 +51,8 @@ describe('Create API Spec', () => { it('creates and activates new namespace', () => { cy.getUserSession().then(() => { cy.get('@common-testdata').then(({ namespace }: any) => { - cy.createGatewayV3(namespace) + cy.createGateway(namespace) + cy.activateGateway(namespace) cy.get('@login').then(function (xhr: any) { userSession = xhr.response.headers['x-auth-request-access-token'] }) From 66177a7d6b1a380483e9ec6d8133d924bcea96a5 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Mon, 8 Jul 2024 15:25:28 -0700 Subject: [PATCH 06/54] update permissions names --- e2e/cypress/fixtures/access-manager.json | 2 +- e2e/cypress/fixtures/api.json | 6 ++-- e2e/cypress/fixtures/apiowner.json | 34 +++++++++---------- e2e/cypress/fixtures/common-testdata.json | 10 +++--- .../05-namespace-manage.cy.ts | 2 +- .../07-namespace-view.cy.ts | 2 +- .../08-gateway-config.cy.ts | 2 +- .../tests/19-api-v3/02-organization.ts | 2 +- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/e2e/cypress/fixtures/access-manager.json b/e2e/cypress/fixtures/access-manager.json index 6ada07e69..7a5c3ea8c 100644 --- a/e2e/cypress/fixtures/access-manager.json +++ b/e2e/cypress/fixtures/access-manager.json @@ -13,7 +13,7 @@ "namespace": "permission" }, "serviceAccount": { - "scopes": ["GatewayConfig.Publish", "Namespace.Manage", "Content.Publish"] + "scopes": ["GatewayConfig.Publish", "Gateway.Manage", "Content.Publish"] }, "labels_consumer1": { "labels": { diff --git a/e2e/cypress/fixtures/api.json b/e2e/cypress/fixtures/api.json index 91dbdac97..75acae44b 100644 --- a/e2e/cypress/fixtures/api.json +++ b/e2e/cypress/fixtures/api.json @@ -35,7 +35,7 @@ { "resourceType": "namespace", "scopes": [ - "Namespace.View" + "Gateway.View" ] } ] @@ -363,7 +363,7 @@ "name": "GatewayConfig.Publish" }, { - "name": "Namespace.Manage" + "name": "Gateway.Manage" }, { "name": "Access.Manage" @@ -372,7 +372,7 @@ "name": "Content.Publish" }, { - "name": "Namespace.View" + "name": "Gateway.View" }, { "name": "CredentialIssuer.Admin" diff --git a/e2e/cypress/fixtures/apiowner.json b/e2e/cypress/fixtures/apiowner.json index 7d8caa53d..d72069948 100644 --- a/e2e/cypress/fixtures/apiowner.json +++ b/e2e/cypress/fixtures/apiowner.json @@ -15,7 +15,7 @@ "serviceAccount": { "scopes": [ "GatewayConfig.Publish", - "Namespace.Manage", + "Gateway.Manage", "Content.Publish" ] }, @@ -316,7 +316,7 @@ "serviceAccount": { "scopes": [ "GatewayConfig.Publish", - "Namespace.Manage" + "Gateway.Manage" ] }, "product": { @@ -345,7 +345,7 @@ "serviceAccount": { "scopes": [ "GatewayConfig.Publish", - "Namespace.Manage" + "Gateway.Manage" ] }, "product": { @@ -435,7 +435,7 @@ "serviceAccount": { "scopes": [ "GatewayConfig.Publish", - "Namespace.Manage" + "Gateway.Manage" ] }, "product": { @@ -462,14 +462,14 @@ "userName": "Mark F Mark L", "email": "mark@gmail.com", "accessRole": [ - "Namespace.View" + "Gateway.View" ] }, "Wendy": { "userName": "Wendy F Wendy L", "email": "wendy@test.com", "accessRole": [ - "Namespace.Manage", + "Gateway.Manage", "CredentialIssuer.Admin" ] }, @@ -477,7 +477,7 @@ "userName": "Wendy F Wendy L", "email": "wendy@test.com", "accessRole": [ - "Namespace.Manage" + "Gateway.Manage" ] }, "Wendy_CA": { @@ -492,14 +492,14 @@ "email": "wendy@test.com", "accessRole": [ "GatewayConfig.Publish", - "Namespace.View" + "Gateway.View" ] }, "Janis": { "userName": "Janis Smith", "email": "janis@testmail.com", "accessRole": [ - "Namespace.Manage", + "Gateway.Manage", "CredentialIssuer.Admin" ] } @@ -508,7 +508,7 @@ "Mark": { "userName": "mark", "accessRole": [ - "Namespace.View", + "Gateway.View", "Access.Manage" ] }, @@ -521,7 +521,7 @@ "Wendy": { "userName": "wendy", "accessRole": [ - "Namespace.Manage" + "Gateway.Manage" ] }, "Wendy_ci": { @@ -532,7 +532,7 @@ }, "serviceAccount": { "scopes": [ - "Namespace.Manage", + "Gateway.Manage", "Content.Publish" ] } @@ -544,7 +544,7 @@ "email": "mark@gmail.com", "accessRole": [ "Access.Manage", - "Namespace.View" + "Gateway.View" ] }, "Janis": { @@ -552,7 +552,7 @@ "email": "janis@testmail.com", "accessRole": [ "CredentialIssuer.Admin", - "Namespace.Manage" + "Gateway.Manage" ] }, "OldUser": { @@ -560,8 +560,8 @@ "email": "olduser@testmail.com", "accessRole": [ "Access.Manage", - "Namespace.View", - "Namespace.Manage" + "Gateway.View", + "Gateway.Manage" ] } }, @@ -570,7 +570,7 @@ "userName": "mark", "accessRole": [ "Access.Manage", - "Namespace.View" + "Gateway.View" ] } }, diff --git a/e2e/cypress/fixtures/common-testdata.json b/e2e/cypress/fixtures/common-testdata.json index 2728113f5..f3c7cf668 100644 --- a/e2e/cypress/fixtures/common-testdata.json +++ b/e2e/cypress/fixtures/common-testdata.json @@ -32,14 +32,14 @@ "userName": "Mark F Mark L", "email": "mark@gmail.com", "accessRole": [ - "Namespace.View" + "Gateway.View" ] }, "Wendy": { "userName": "Wendy F Wendy L", "email": "wendy@test.com", "accessRole": [ - "Namespace.Manage", + "Gateway.Manage", "CredentialIssuer.Admin" ] }, @@ -47,7 +47,7 @@ "userName": "Wendy F Wendy L", "email": "wendy@test.com", "accessRole": [ - "Namespace.Manage" + "Gateway.Manage" ] }, "Wendy_CA": { @@ -62,14 +62,14 @@ "email": "wendy@test.com", "accessRole": [ "GatewayConfig.Publish", - "Namespace.View" + "Gateway.View" ] }, "Janis": { "userName": "Janis Smith", "email": "janis@testmail.com", "accessRole": [ - "Namespace.Manage", + "Gateway.Manage", "CredentialIssuer.Admin" ] } diff --git a/e2e/cypress/tests/12-access-permission/05-namespace-manage.cy.ts b/e2e/cypress/tests/12-access-permission/05-namespace-manage.cy.ts index 3075dfe44..63769b4fa 100644 --- a/e2e/cypress/tests/12-access-permission/05-namespace-manage.cy.ts +++ b/e2e/cypress/tests/12-access-permission/05-namespace-manage.cy.ts @@ -34,7 +34,7 @@ describe('Grant Namespace Manage Role', () => { }) }) - it('Grant only "Namespace.Manage" permission to Wendy', () => { + it('Grant only "Gateway.Manage" permission to Wendy', () => { cy.get('@apiowner').then(({ checkPermission }: any) => { cy.visit(na.path) // na.revokeAllPermission('wendy@idir') diff --git a/e2e/cypress/tests/12-access-permission/07-namespace-view.cy.ts b/e2e/cypress/tests/12-access-permission/07-namespace-view.cy.ts index 0acd828a1..564ce1ec4 100644 --- a/e2e/cypress/tests/12-access-permission/07-namespace-view.cy.ts +++ b/e2e/cypress/tests/12-access-permission/07-namespace-view.cy.ts @@ -34,7 +34,7 @@ describe('Grant Namespace View Role to Mark', () => { }) }) - it('Grant only "Namespace.View" permission to Mark', () => { + it('Grant only "Gateway.View" permission to Mark', () => { cy.get('@apiowner').then(({ checkPermission }: any) => { cy.visit(na.path) na.revokeAllPermission(checkPermission.grantPermission.Mark.userName) diff --git a/e2e/cypress/tests/12-access-permission/08-gateway-config.cy.ts b/e2e/cypress/tests/12-access-permission/08-gateway-config.cy.ts index 0f5b16d00..8a584e533 100644 --- a/e2e/cypress/tests/12-access-permission/08-gateway-config.cy.ts +++ b/e2e/cypress/tests/12-access-permission/08-gateway-config.cy.ts @@ -36,7 +36,7 @@ describe('Grant Gateway Config Role to Wendy', () => { }) }) - it('Grant "GatewayConfig.Publish" and "Namespace.View" access to Wendy (access manager)', () => { + it('Grant "GatewayConfig.Publish" and "Gateway.View" access to Wendy (access manager)', () => { cy.get('@apiowner').then(({ checkPermission }: any) => { cy.visit(na.path) // na.revokePermission(checkPermission.grantPermission.Wendy) diff --git a/e2e/cypress/tests/19-api-v3/02-organization.ts b/e2e/cypress/tests/19-api-v3/02-organization.ts index 246ffde0d..23fbaf756 100644 --- a/e2e/cypress/tests/19-api-v3/02-organization.ts +++ b/e2e/cypress/tests/19-api-v3/02-organization.ts @@ -169,7 +169,7 @@ describe('Organization', () => { resourceType: 'organization', scopes: ['GroupAccess.Manage', 'Namespace.Assign', 'Dataset.Manage'], }, - { resourceType: 'namespace', scopes: ['Namespace.View'] }, + { resourceType: 'namespace', scopes: ['Gateway.View'] }, ], }, } From 5f547397d4bc9b8452802df994ed7e519b7014c0 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Mon, 8 Jul 2024 15:47:00 -0700 Subject: [PATCH 07/54] confirm activation using currentNamespace --- e2e/cypress/pageObjects/home.ts | 12 ---------- e2e/cypress/support/auth-commands.ts | 22 ++++++++++++++----- .../tests/01-api-key/01-create-api.cy.ts | 15 ++++++++----- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/e2e/cypress/pageObjects/home.ts b/e2e/cypress/pageObjects/home.ts index 2e6dc43e6..de617a848 100644 --- a/e2e/cypress/pageObjects/home.ts +++ b/e2e/cypress/pageObjects/home.ts @@ -11,18 +11,6 @@ class HomePage { namespaceCancelBtn: string = '[data-testid="ns-modal-cancel-btn"]' gatewaysNavButtom: string = '[data-testid="navbar-link-Gateways"]' - createNamespace(name: string): void { - cy.get(this.nsDropdown).click() - cy.get(this.nsDropdownCreateNsBtn).click() - cy.get(this.namespaceNameInput).type(name) // using `platform` as a default ns as its being seeding through feeder - cy.get(this.nsCreateBtn).click() - cy.verifyToastMessage("Namespace "+name+" created!") - cy.wait(5000) // wait for dropdown to have latest text - cy.get(this.nsDropdown).then(($el) => { - expect($el).contain(name) - }) - } - useNamespace(name: string): Boolean { var flag = new Boolean(false); cy.get(this.nsDropdown).click() diff --git a/e2e/cypress/support/auth-commands.ts b/e2e/cypress/support/auth-commands.ts index bd08aa32f..d2aaffc70 100644 --- a/e2e/cypress/support/auth-commands.ts +++ b/e2e/cypress/support/auth-commands.ts @@ -101,7 +101,7 @@ Cypress.Commands.add('createGateway', (gatewayid?: string, displayname?: string) }) Cypress.Commands.add('activateGateway', (gatewayId: string) => { - const query = gql` + const getAllNsQuery = gql` query GetNamespaces { allNamespaces { id @@ -109,7 +109,17 @@ query GetNamespaces { } } ` - return cy.gqlQuery(query).then((response) => { + const currentNsQuery = gql` + query GetCurrentNamespace { + currentNamespace { + name + org + orgUnit + } + } +` + // get the (true) id for the namespace + return cy.gqlQuery(getAllNsQuery).then((response) => { const nsdata = response.apiRes.body.data.allNamespaces.find((ns: { name: string }) => ns.name === gatewayId) if (nsdata) { return nsdata.id @@ -118,12 +128,12 @@ query GetNamespaces { } }).then((namespaceId) => { cy.log(`The namespace ID is: ${namespaceId}`) - // activate namespace + // then activate the namespace cy.setHeaders({ 'Content-Type': 'application/json' }) cy.callAPI(`admin/switch/${namespaceId}`, 'PUT') - cy.visit('/manager/gateways/detail') - cy.get('[data-testid="ns-detail-gatewayid"]').then(($el) => { - expect($el).contain(gatewayId) + return cy.gqlQuery(currentNsQuery).then((response) => { + const currentNs = response.apiRes.body.data.currentNamespace + expect(currentNs.name).to.eq(gatewayId) }) }) }) diff --git a/e2e/cypress/tests/01-api-key/01-create-api.cy.ts b/e2e/cypress/tests/01-api-key/01-create-api.cy.ts index 79f38187c..ae8d20ade 100644 --- a/e2e/cypress/tests/01-api-key/01-create-api.cy.ts +++ b/e2e/cypress/tests/01-api-key/01-create-api.cy.ts @@ -53,6 +53,10 @@ describe('Create API Spec', () => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.createGateway(namespace) cy.activateGateway(namespace) + cy.visit('/manager/gateways/detail') + cy.get('[data-testid="ns-detail-gatewayid"]').then(($el) => { + expect($el).contain(namespace) + }) cy.get('@login').then(function (xhr: any) { userSession = xhr.response.headers['x-auth-request-access-token'] }) @@ -60,11 +64,12 @@ describe('Create API Spec', () => { }) }) - it('Verify for invalid namespace name', () => { - cy.get('@apiowner').then(({ invalid_namespace }: any) => { - home.validateNamespaceName(invalid_namespace) - }) - }) + // TODO: Update this test to use gwa cli (if not covered in other tests) + // it('Verify for invalid namespace name', () => { + // cy.get('@apiowner').then(({ invalid_namespace }: any) => { + // home.validateNamespaceName(invalid_namespace) + // }) + // }) it('creates a new service account', () => { cy.visit(sa.path) From 8a77dabd75096292202c505b45c7baa96f292fc2 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Mon, 8 Jul 2024 16:00:14 -0700 Subject: [PATCH 08/54] update `gwa gateway` commands in tests --- README.md | 2 +- e2e/Dockerfile | 2 +- e2e/cypress/support/auth-commands.ts | 2 +- .../01-client-cred-team-access.cy.ts | 4 ++-- .../09-two-tiered-hidden.cy.ts | 2 +- .../10-clear-resources/01-create-api.cy.ts | 4 ++-- .../12-access-permission/01-create-api.cy.ts | 4 ++-- .../01-create-api.cy.ts | 4 ++-- .../01-client-cred-team-access.ts | 4 ++-- .../03-verify-org-admin-member-org.ts | 4 ++-- .../05-verify-org-admin-member-org-unit.ts | 4 ++-- .../tests/15-aps-api/01-create-api.cy.ts | 4 ++-- .../tests/16-gwa-cli/01-cli-commands.ts | 6 +++--- .../04-delete-namespace-gwa.ts | 18 +++++++++--------- 14 files changed, 32 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index ddef88476..62427ec00 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Run this command to test logging in and creating a namespace: ``` gwa login -gwa namespace create --name gw-12345 +gwa gateway create --gateway-id gw-12345 ``` ### Keycloak configuration diff --git a/e2e/Dockerfile b/e2e/Dockerfile index 432a9cd5a..f5b7aa069 100644 --- a/e2e/Dockerfile +++ b/e2e/Dockerfile @@ -22,7 +22,7 @@ COPY e2e/*.yml /e2e COPY e2e/entrypoint.sh /tmp ADD e2e/cypress /e2e/cypress -RUN curl -v -L -O https://github.com/bcgov/gwa-cli/releases/download/v2.0.15/gwa_Linux_x86_64.tgz \ +RUN curl -v -L -O https://github.com/bcgov/gwa-cli/releases/download/v3.0.0/gwa_Linux_x86_64.tgz \ && tar -xzf gwa_Linux_x86_64.tgz \ && mv gwa /usr/local/bin/. diff --git a/e2e/cypress/support/auth-commands.ts b/e2e/cypress/support/auth-commands.ts index d2aaffc70..0c9190ea6 100644 --- a/e2e/cypress/support/auth-commands.ts +++ b/e2e/cypress/support/auth-commands.ts @@ -348,7 +348,7 @@ Cypress.Commands.add( () => { cy.wait(3000) cy.get('@accessTokenResponse').then((res: any) => { - cy.executeCliCommand('gwa config set --namespace ' + namespace).then( + cy.executeCliCommand('gwa config set --gateway ' + namespace).then( (response) => { cy.executeCliCommand( 'gwa config set --token ' + res.body.access_token diff --git a/e2e/cypress/tests/02-client-credential-flow/01-client-cred-team-access.cy.ts b/e2e/cypress/tests/02-client-credential-flow/01-client-cred-team-access.cy.ts index 29b770c58..8ff4962b2 100644 --- a/e2e/cypress/tests/02-client-credential-flow/01-client-cred-team-access.cy.ts +++ b/e2e/cypress/tests/02-client-credential-flow/01-client-cred-team-access.cy.ts @@ -39,14 +39,14 @@ describe('Grant appropriate permissions to team members for client credential fl it('create namespace using gwa cli command', () => { var cleanedUrl = Cypress.env('BASE_URL').replace(/^http?:\/\//i, ""); - cy.exec('gwa namespace create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 5000, failOnNonZeroExit: false }).then((response) => { + cy.exec('gwa gateway create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 5000, failOnNonZeroExit: false }).then((response) => { debugger assert.isNotNaN(response.stdout) namespace = response.stdout cy.replaceWordInJsonObject('ccplatform', namespace, 'cc-service-gwa.yml') cy.updateJsonValue('common-testdata.json', 'clientCredentials.namespace', namespace) // cy.updateJsonValue('apiowner.json', 'clientCredentials.clientIdSecret.product.environment.name.config.serviceName', 'cc-service-for-' + namespace) - cy.executeCliCommand("gwa config set --namespace " + namespace) + cy.executeCliCommand("gwa config set --gateway " + namespace) }); }) diff --git a/e2e/cypress/tests/09-update-product-env/09-two-tiered-hidden.cy.ts b/e2e/cypress/tests/09-update-product-env/09-two-tiered-hidden.cy.ts index b103e7afd..bc3edb7ff 100644 --- a/e2e/cypress/tests/09-update-product-env/09-two-tiered-hidden.cy.ts +++ b/e2e/cypress/tests/09-update-product-env/09-two-tiered-hidden.cy.ts @@ -50,7 +50,7 @@ describe('Verify Two Tiered Hidden', () => { it('create namespace with cli', () => { cy.get('@common-testdata').then(({ twoTieredHidden }: any) => { cy.executeCliCommand( - 'gwa namespace create --name ' + + 'gwa gateway create --gateway-id ' + twoTieredHidden.namespace + ' --description="Two Tiered Hidden"' ).then((response) => { diff --git a/e2e/cypress/tests/10-clear-resources/01-create-api.cy.ts b/e2e/cypress/tests/10-clear-resources/01-create-api.cy.ts index d7c126c42..080ebb0eb 100644 --- a/e2e/cypress/tests/10-clear-resources/01-create-api.cy.ts +++ b/e2e/cypress/tests/10-clear-resources/01-create-api.cy.ts @@ -42,13 +42,13 @@ describe('Create API Spec for Delete Resources', () => { it('create namespace using gwa cli command', () => { var cleanedUrl = Cypress.env('BASE_URL').replace(/^http?:\/\//i, ""); - cy.exec('gwa namespace create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { + cy.exec('gwa gateway create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { assert.isNotNaN(response.stdout) namespace = response.stdout cy.replaceWordInJsonObject('ns.deleteplatform', 'ns.' + namespace, 'service-clear-resources-gwa.yml') cy.updateJsonValue('common-testdata.json', 'deleteResources.namespace', namespace) // cy.updateJsonValue('apiowner.json', 'clientCredentials.clientIdSecret.product.environment.name.config.serviceName', 'cc-service-for-' + namespace) - cy.executeCliCommand("gwa config set --namespace " + namespace) + cy.executeCliCommand("gwa config set --gateway " + namespace) }); }) diff --git a/e2e/cypress/tests/12-access-permission/01-create-api.cy.ts b/e2e/cypress/tests/12-access-permission/01-create-api.cy.ts index 938ff9685..68d021830 100644 --- a/e2e/cypress/tests/12-access-permission/01-create-api.cy.ts +++ b/e2e/cypress/tests/12-access-permission/01-create-api.cy.ts @@ -42,13 +42,13 @@ describe('Create API Spec', () => { it('create namespace using gwa cli command', () => { var cleanedUrl = Cypress.env('BASE_URL').replace(/^http?:\/\//i, ""); - cy.exec('gwa namespace create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { + cy.exec('gwa gateway create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { assert.isNotNaN(response.stdout) namespace = response.stdout cy.replaceWordInJsonObject('ns.permission', 'ns.' + namespace, 'service-permission-gwa.yml') cy.updateJsonValue('common-testdata.json', 'checkPermission.namespace', namespace) // cy.updateJsonValue('apiowner.json', 'clientCredentials.clientIdSecret.product.environment.name.config.serviceName', 'cc-service-for-' + namespace) - cy.executeCliCommand("gwa config set --namespace " + namespace) + cy.executeCliCommand("gwa config set --gateway " + namespace) }); }) diff --git a/e2e/cypress/tests/13-namespace-preview-mode/01-create-api.cy.ts b/e2e/cypress/tests/13-namespace-preview-mode/01-create-api.cy.ts index 02fea2554..6f6059679 100644 --- a/e2e/cypress/tests/13-namespace-preview-mode/01-create-api.cy.ts +++ b/e2e/cypress/tests/13-namespace-preview-mode/01-create-api.cy.ts @@ -42,12 +42,12 @@ describe('Create API Spec', () => { it('create namespace using gwa cli command', () => { var cleanedUrl = Cypress.env('BASE_URL').replace(/^http?:\/\//i, ""); - cy.exec('gwa namespace create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { + cy.exec('gwa gateway create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { assert.isNotNaN(response.stdout) namespace = response.stdout cy.updateJsonValue('common-testdata.json', 'namespacePreview.namespace', namespace) // cy.updateJsonValue('apiowner.json', 'clientCredentials.clientIdSecret.product.environment.name.config.serviceName', 'cc-service-for-' + namespace) - cy.executeCliCommand("gwa config set --namespace " + namespace) + cy.executeCliCommand("gwa config set --gateway " + namespace) }); }) diff --git a/e2e/cypress/tests/14-org-assignment/01-client-cred-team-access.ts b/e2e/cypress/tests/14-org-assignment/01-client-cred-team-access.ts index 4e8ed934d..f83765a9f 100644 --- a/e2e/cypress/tests/14-org-assignment/01-client-cred-team-access.ts +++ b/e2e/cypress/tests/14-org-assignment/01-client-cred-team-access.ts @@ -50,12 +50,12 @@ describe('Add Organization to publish API', () => { it('create namespace using gwa cli command', () => { var cleanedUrl = Cypress.env('BASE_URL').replace(/^http?:\/\//i, ""); - cy.exec('gwa namespace create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { + cy.exec('gwa gateway create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { assert.isNotNaN(response.stdout) namespace = response.stdout cy.updateJsonValue('common-testdata.json', 'orgAssignment.namespace', namespace) // cy.updateJsonValue('apiowner.json', 'clientCredentials.clientIdSecret.product.environment.name.config.serviceName', 'cc-service-for-' + namespace) - cy.executeCliCommand("gwa config set --namespace " + namespace) + cy.executeCliCommand("gwa config set --gateway " + namespace) }); }) diff --git a/e2e/cypress/tests/14-org-assignment/03-verify-org-admin-member-org.ts b/e2e/cypress/tests/14-org-assignment/03-verify-org-admin-member-org.ts index 86fa3c287..c4320fe12 100644 --- a/e2e/cypress/tests/14-org-assignment/03-verify-org-admin-member-org.ts +++ b/e2e/cypress/tests/14-org-assignment/03-verify-org-admin-member-org.ts @@ -44,12 +44,12 @@ describe('Multiple Org Adming for the organization', () => { it('create namespace using gwa cli command', () => { var cleanedUrl = Cypress.env('BASE_URL').replace(/^http?:\/\//i, ""); - cy.exec('gwa namespace create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { + cy.exec('gwa gateway create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { assert.isNotNaN(response.stdout) namespace = response.stdout cy.updateJsonValue('common-testdata.json', 'orgAssignment.namespace', namespace) // cy.updateJsonValue('apiowner.json', 'clientCredentials.clientIdSecret.product.environment.name.config.serviceName', 'cc-service-for-' + namespace) - cy.executeCliCommand("gwa config set --namespace " + namespace) + cy.executeCliCommand("gwa config set --gateway " + namespace) }); }) diff --git a/e2e/cypress/tests/14-org-assignment/05-verify-org-admin-member-org-unit.ts b/e2e/cypress/tests/14-org-assignment/05-verify-org-admin-member-org-unit.ts index 0fe81f42a..2a19a394f 100644 --- a/e2e/cypress/tests/14-org-assignment/05-verify-org-admin-member-org-unit.ts +++ b/e2e/cypress/tests/14-org-assignment/05-verify-org-admin-member-org-unit.ts @@ -43,12 +43,12 @@ describe('Multiple Org Admin for the organization', () => { it('create namespace using gwa cli command', () => { var cleanedUrl = Cypress.env('BASE_URL').replace(/^http?:\/\//i, ""); - cy.exec('gwa namespace create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { + cy.exec('gwa gateway create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { assert.isNotNaN(response.stdout) namespace = response.stdout cy.updateJsonValue('common-testdata.json', 'orgAssignment.namespace', namespace) // cy.updateJsonValue('apiowner.json', 'clientCredentials.clientIdSecret.product.environment.name.config.serviceName', 'cc-service-for-' + namespace) - cy.executeCliCommand("gwa config set --namespace " + namespace) + cy.executeCliCommand("gwa config set --gateway " + namespace) }); }) diff --git a/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts b/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts index 7dd135961..c432833fd 100644 --- a/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts +++ b/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts @@ -42,13 +42,13 @@ describe('Create API Spec', () => { it('create namespace using gwa cli command', () => { var cleanedUrl = Cypress.env('BASE_URL').replace(/^http?:\/\//i, ""); - cy.exec('gwa namespace create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { + cy.exec('gwa gateway create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { assert.isNotNaN(response.stdout) namespace = response.stdout cy.updateJsonValue('common-testdata.json', 'apiTest.namespace', namespace) cy.updateJsonValue('api.json', 'organization.expectedNamespace.name', namespace) // cy.updateJsonValue('apiowner.json', 'clientCredentials.clientIdSecret.product.environment.name.config.serviceName', 'cc-service-for-' + namespace) - cy.executeCliCommand("gwa config set --namespace " + namespace) + cy.executeCliCommand("gwa config set --gateway " + namespace) }); }) diff --git a/e2e/cypress/tests/16-gwa-cli/01-cli-commands.ts b/e2e/cypress/tests/16-gwa-cli/01-cli-commands.ts index be6fbe98d..3b2b484e5 100644 --- a/e2e/cypress/tests/16-gwa-cli/01-cli-commands.ts +++ b/e2e/cypress/tests/16-gwa-cli/01-cli-commands.ts @@ -77,15 +77,15 @@ describe('Verify CLI commands', () => { }) it('Check gwa command to create namespace', () => { - cy.executeCliCommand('gwa namespace create --generate --host ' + cleanedUrl + ' --scheme http').then((response) => { + cy.executeCliCommand('gwa gateway create --generate --host ' + cleanedUrl + ' --scheme http').then((response) => { assert.isNotNaN(response.stdout) namespace = response.stdout }); }) - it('Check gwa namespace list command and verify the created namespace in the list', () => { - cy.executeCliCommand('gwa namespace list --host ' + cleanedUrl + ' --scheme http').then((response) => { + it('Check gwa gateway list command and verify the created namespace in the list', () => { + cy.executeCliCommand('gwa gatway list --host ' + cleanedUrl + ' --scheme http').then((response) => { expect(response.stdout).to.contain(namespace); }); }) diff --git a/e2e/cypress/tests/17-delete-application/04-delete-namespace-gwa.ts b/e2e/cypress/tests/17-delete-application/04-delete-namespace-gwa.ts index 87768c2f6..5883b05aa 100644 --- a/e2e/cypress/tests/17-delete-application/04-delete-namespace-gwa.ts +++ b/e2e/cypress/tests/17-delete-application/04-delete-namespace-gwa.ts @@ -34,30 +34,30 @@ describe('Verify namespace delete using gwa command', () => { it('Create namespace using gwa cli command', () => { var cleanedUrl = Cypress.env('BASE_URL').replace(/^http?:\/\//i, ""); - cy.exec('gwa namespace create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { + cy.exec('gwa gateway create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { assert.isNotNaN(response.stdout) _namespace = response.stdout }); }) - it('Check gwa namespace destroy command for soft deleting namespace', () => { - cy.executeCliCommand('gwa namespace destroy ' + _namespace).then((response) => { + it('Check gwa gateway destroy command for soft deleting namespace', () => { + cy.executeCliCommand('gwa gateway destroy ' + _namespace).then((response) => { expect(response.stdout).to.contain('Namespace destroyed: ' + _namespace); }); }) - it('Check that deleted namespace does not display in gwa namespace list command', () => { - cy.executeCliCommand('gwa namespace list').then((response) => { + it('Check that deleted namespace does not display in gwa gateway list command', () => { + cy.executeCliCommand('gwa gateway list').then((response) => { expect(response.stdout).not.to.contain(_namespace); }); }) - it('Check gwa namespace destroy command for the namespace associated with services', () => { + it('Check gwa gateway destroy command for the namespace associated with services', () => { cy.get('@common-testdata').then(({ namespace }: any) => { _namespace = namespace - cy.executeCliCommand('gwa config set --namespace ' + namespace).then((response) => { + cy.executeCliCommand('gwa config set --gateway ' + namespace).then((response) => { expect(response.stdout).to.contain("Config settings saved") - cy.executeCliCommand('gwa namespace destroy').then((response) => { + cy.executeCliCommand('gwa gateway destroy').then((response) => { expect(response.stderr).to.contain('Error: Validation Failed'); }); }) @@ -65,7 +65,7 @@ describe('Verify namespace delete using gwa command', () => { }) it('Check validation if any consumer is associated with namespace for hard deleting the namespace', () => { - cy.executeCliCommand('gwa namespace destroy --force').then((response) => { + cy.executeCliCommand('gwa gateway destroy --force').then((response) => { expect(response.stderr).to.contain('Error: Validation Failed'); }); }) From 1644caafeb980974c3c378b4daf8e2f1ae9c3136 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Mon, 8 Jul 2024 16:20:02 -0700 Subject: [PATCH 09/54] use v3 endpoint for orgs --- e2e/cypress/fixtures/api.json | 2 +- e2e/cypress/tests/01-api-key/01-create-api.cy.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/e2e/cypress/fixtures/api.json b/e2e/cypress/fixtures/api.json index 75acae44b..a7218b1d6 100644 --- a/e2e/cypress/fixtures/api.json +++ b/e2e/cypress/fixtures/api.json @@ -4,7 +4,7 @@ "accept": "application/json", "content-type": "application/json" }, - "endPoint": "ds/api/v2/organizations", + "endPoint": "ds/api/v3/organizations", "orgExpectedList": { "name": "planning-and-innovation-division", "title": "Planning and Innovation Division" diff --git a/e2e/cypress/tests/01-api-key/01-create-api.cy.ts b/e2e/cypress/tests/01-api-key/01-create-api.cy.ts index ae8d20ade..9fa414993 100644 --- a/e2e/cypress/tests/01-api-key/01-create-api.cy.ts +++ b/e2e/cypress/tests/01-api-key/01-create-api.cy.ts @@ -51,6 +51,7 @@ describe('Create API Spec', () => { it('creates and activates new namespace', () => { cy.getUserSession().then(() => { cy.get('@common-testdata').then(({ namespace }: any) => { + nameSpace = namespace cy.createGateway(namespace) cy.activateGateway(namespace) cy.visit('/manager/gateways/detail') @@ -107,7 +108,7 @@ it('Verify gwa gateway publish multiple config file', () => { cy.get('@api').then(({ organization }: any) => { cy.setHeaders(organization.headers) cy.setAuthorizationToken(userSession) - cy.makeAPIRequest(organization.endPoint + '/' + organization.orgName + '/' + organization.orgExpectedList.name + '/namespaces/' + nameSpace, 'PUT').then((response:any) => { + cy.makeAPIRequest(organization.endPoint + '/' + organization.orgName + '/' + organization.orgExpectedList.name + '/gateways/' + nameSpace, 'PUT').then((response:any) => { expect(response.apiRes.status).to.be.equal(200) }) }) From ee2a7bb95602bd7d61475210d158cfc20180dafa Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Mon, 8 Jul 2024 16:23:54 -0700 Subject: [PATCH 10/54] useNamespace --> activateGateway --- e2e/cypress/support/auth-commands.ts | 6 +++--- e2e/cypress/tests/01-api-key/02-team-access.cy.ts | 2 +- .../tests/01-api-key/03-request-access-inactive-env.cy.ts | 4 ++-- ...05-review-request-without-collecting-credentials.cy.ts | 2 +- .../tests/01-api-key/07-approve-pending-rqst.cy.ts | 2 +- e2e/cypress/tests/01-api-key/08-grant-access.cy.ts | 2 +- e2e/cypress/tests/01-api-key/10-revoke-access.cy.ts | 2 +- .../01-client-cred-team-access.cy.ts | 2 +- .../02-create_authorizarion_profile.cy.ts | 2 +- .../03-client-cred-create-api-prod-auth-pro.cy.ts | 2 +- .../05-cids-access-approve-api-rqst.cy.ts | 2 +- .../tests/02-client-credential-flow/07-deselect-scope.ts | 2 +- .../08-verify-client-scope-in-default-list.ts | 2 +- .../10-jwt-genkp-access-approve-api-rqst.cy.ts | 2 +- .../12-jwks-url-access-approval-api-rqst.cy.ts | 2 +- .../14-jwt-publlicKey-access-approve-api-rqst.cy.ts | 2 +- .../02-approve-pending-rqst-for-labels.spec.cy.ts | 2 +- e2e/cypress/tests/03-manage-labels/03-filter-labels.cy.ts | 2 +- e2e/cypress/tests/03-manage-labels/04-manage-labels.cy.ts | 2 +- e2e/cypress/tests/03-manage-labels/05-link-consumers.ts | 2 +- .../04-gateway-services/01-gateway-service-details.cy.ts | 2 +- .../04-gateway-services/02-filter-gateway-service.cy.ts | 2 +- .../tests/05-migrate-user/01-migrate-user-access.cy.ts | 8 ++++---- .../06-refresh-credential/02-client-credentials.cy.ts | 2 +- .../tests/07-manage-control/01-ip-restriction.cy.ts | 2 +- .../tests/07-manage-control/02-rate-limiting.cy.ts | 2 +- .../03-kong-api-only-apply-rate-limiting.cy.ts | 4 ++-- .../08-client-role/02-add-roles-authorization-profile.ts | 2 +- e2e/cypress/tests/08-client-role/03-read-client-role.ts | 2 +- e2e/cypress/tests/08-client-role/04-write-client-role.ts | 2 +- e2e/cypress/tests/08-client-role/05-check-without-role.ts | 2 +- .../01-client-credential-to-kong-acl-api.cy.ts | 4 ++-- .../02-kong-acl-api-to-client-credential.cy.ts | 4 ++-- .../03-apply-multiple-services.cy.ts | 4 ++-- .../09-update-product-env/04-change-env-status copy.cy.ts | 2 +- .../tests/09-update-product-env/06-shared-idp.cy.ts | 4 ++-- .../tests/09-update-product-env/07-kong-public-auth.ts | 2 +- .../09-update-product-env/08-protected-externally.ts | 2 +- .../09-update-product-env/09-two-tiered-hidden.cy.ts | 2 +- e2e/cypress/tests/10-clear-resources/01-create-api.cy.ts | 2 +- e2e/cypress/tests/10-clear-resources/02-team-access.cy.ts | 2 +- .../tests/10-clear-resources/04-delete-consumer.ts | 2 +- .../tests/10-clear-resources/05-delete-resources.cy.ts | 4 ++-- .../tests/10-clear-resources/06-delete-service-acc.ts | 2 +- e2e/cypress/tests/11-activity-feed/01-activity-feed.cy.ts | 2 +- .../tests/11-activity-feed/02-activity-feed-failure.cy.ts | 2 +- .../tests/12-access-permission/01-create-api.cy.ts | 2 +- .../tests/12-access-permission/02-team-access.cy.ts | 2 +- .../tests/12-access-permission/04-access-manager.cy.ts | 4 ++-- .../tests/12-access-permission/05-namespace-manage.cy.ts | 4 ++-- .../tests/12-access-permission/06-credential-issuer.cy.ts | 4 ++-- .../tests/12-access-permission/07-namespace-view.cy.ts | 4 ++-- .../tests/12-access-permission/08-gateway-config.cy.ts | 4 ++-- .../tests/12-access-permission/09-content-publish.cy.ts | 2 +- .../tests/13-namespace-preview-mode/01-create-api.cy.ts | 2 +- .../02-namespace-preview-mode.cy.ts | 2 +- .../tests/14-org-assignment/01-client-cred-team-access.ts | 8 ++++---- .../14-org-assignment/03-verify-org-admin-member-org.ts | 2 +- .../05-verify-org-admin-member-org-unit.ts | 2 +- e2e/cypress/tests/15-aps-api/01-create-api.cy.ts | 2 +- .../tests/15-aps-api/05-authorizationProfiles.cy.ts | 2 +- e2e/cypress/tests/15-aps-api/06-products.cy.ts | 2 +- e2e/cypress/tests/16-gwa-cli/02-cli-generate-config.ts | 2 +- .../03-delete-application-with-approved-request.cy.ts | 2 +- 64 files changed, 84 insertions(+), 84 deletions(-) diff --git a/e2e/cypress/support/auth-commands.ts b/e2e/cypress/support/auth-commands.ts index 0c9190ea6..19dfb266f 100644 --- a/e2e/cypress/support/auth-commands.ts +++ b/e2e/cypress/support/auth-commands.ts @@ -166,7 +166,7 @@ Cypress.Commands.add('resetCredential', (accessRole: string) => { cy.get('@common-testdata').then(({ checkPermission }: any) => { cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') - home.useNamespace(checkPermission.namespace) + cy.activateGateway(checkPermission.namespace) cy.visit(na.path) na.revokeAllPermission(checkPermission.grantPermission[accessRole].userName) cy.wait(2000) @@ -192,9 +192,9 @@ Cypress.Commands.add( cy.get('@apiowner').then(({ user }: any) => { cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') - // home.useNamespace(apiTest.namespace) + // cy.activateGateway(apiTest.namespace) if (isNamespaceSelected || undefined) { - home.useNamespace(namespace) + cy.activateGateway(namespace) } cy.get('@login').then(function (xhr: any) { userSession = xhr.response.headers['x-auth-request-access-token'] diff --git a/e2e/cypress/tests/01-api-key/02-team-access.cy.ts b/e2e/cypress/tests/01-api-key/02-team-access.cy.ts index 40c96c291..ab999d6cc 100644 --- a/e2e/cypress/tests/01-api-key/02-team-access.cy.ts +++ b/e2e/cypress/tests/01-api-key/02-team-access.cy.ts @@ -25,7 +25,7 @@ describe('Team Access Spec', () => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') - home.useNamespace(namespace) + cy.activateGateway(namespace) }) }) }) diff --git a/e2e/cypress/tests/01-api-key/03-request-access-inactive-env.cy.ts b/e2e/cypress/tests/01-api-key/03-request-access-inactive-env.cy.ts index 5b9ca7ba5..d567f71eb 100644 --- a/e2e/cypress/tests/01-api-key/03-request-access-inactive-env.cy.ts +++ b/e2e/cypress/tests/01-api-key/03-request-access-inactive-env.cy.ts @@ -30,7 +30,7 @@ describe('Change an Active environment to Inactive', () => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') - home.useNamespace(namespace) + cy.activateGateway(namespace) }) }) }) @@ -129,7 +129,7 @@ describe('Change an the environment back to active', () => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') - home.useNamespace(namespace) + cy.activateGateway(namespace) }) }) }) diff --git a/e2e/cypress/tests/01-api-key/05-review-request-without-collecting-credentials.cy.ts b/e2e/cypress/tests/01-api-key/05-review-request-without-collecting-credentials.cy.ts index ec1ac793b..a544a11de 100644 --- a/e2e/cypress/tests/01-api-key/05-review-request-without-collecting-credentials.cy.ts +++ b/e2e/cypress/tests/01-api-key/05-review-request-without-collecting-credentials.cy.ts @@ -27,7 +27,7 @@ describe('Approve Pending Request without collecting credentials Spec', () => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.get('@access-manager').then(({ user }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(namespace); + cy.activateGateway(namespace); }) }) }) diff --git a/e2e/cypress/tests/01-api-key/07-approve-pending-rqst.cy.ts b/e2e/cypress/tests/01-api-key/07-approve-pending-rqst.cy.ts index d20c171f1..5916edf77 100644 --- a/e2e/cypress/tests/01-api-key/07-approve-pending-rqst.cy.ts +++ b/e2e/cypress/tests/01-api-key/07-approve-pending-rqst.cy.ts @@ -37,7 +37,7 @@ describe('Approve Pending Request Spec', () => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.get('@access-manager').then(({ user }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(namespace); + cy.activateGateway(namespace); }) }) }) diff --git a/e2e/cypress/tests/01-api-key/08-grant-access.cy.ts b/e2e/cypress/tests/01-api-key/08-grant-access.cy.ts index b405ae971..d41e87914 100644 --- a/e2e/cypress/tests/01-api-key/08-grant-access.cy.ts +++ b/e2e/cypress/tests/01-api-key/08-grant-access.cy.ts @@ -27,7 +27,7 @@ describe('Grant Access Spec', () => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.get('@access-manager').then(({ user }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(namespace); + cy.activateGateway(namespace); }) }) }) diff --git a/e2e/cypress/tests/01-api-key/10-revoke-access.cy.ts b/e2e/cypress/tests/01-api-key/10-revoke-access.cy.ts index 1a3751718..7f8509cc3 100644 --- a/e2e/cypress/tests/01-api-key/10-revoke-access.cy.ts +++ b/e2e/cypress/tests/01-api-key/10-revoke-access.cy.ts @@ -27,7 +27,7 @@ describe('Revoke product environment access for Kong API spec', () => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.get('@access-manager').then(({ user }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(namespace); + cy.activateGateway(namespace); }) }) }) diff --git a/e2e/cypress/tests/02-client-credential-flow/01-client-cred-team-access.cy.ts b/e2e/cypress/tests/02-client-credential-flow/01-client-cred-team-access.cy.ts index 8ff4962b2..d7d8341d8 100644 --- a/e2e/cypress/tests/02-client-credential-flow/01-client-cred-team-access.cy.ts +++ b/e2e/cypress/tests/02-client-credential-flow/01-client-cred-team-access.cy.ts @@ -51,7 +51,7 @@ describe('Grant appropriate permissions to team members for client credential fl }) it('activates new namespace', () => { - home.useNamespace(namespace) + cy.activateGateway(namespace) }) diff --git a/e2e/cypress/tests/02-client-credential-flow/02-create_authorizarion_profile.cy.ts b/e2e/cypress/tests/02-client-credential-flow/02-create_authorizarion_profile.cy.ts index 117465051..03533b484 100644 --- a/e2e/cypress/tests/02-client-credential-flow/02-create_authorizarion_profile.cy.ts +++ b/e2e/cypress/tests/02-client-credential-flow/02-create_authorizarion_profile.cy.ts @@ -32,7 +32,7 @@ describe('Generate Authorization Profiles', () => { it('Select the namespace created for client credential ', () => { cy.get('@common-testdata').then(({ clientCredentials }: any) => { - home.useNamespace(clientCredentials.namespace) + cy.activateGateway(clientCredentials.namespace) }) }) diff --git a/e2e/cypress/tests/02-client-credential-flow/03-client-cred-create-api-prod-auth-pro.cy.ts b/e2e/cypress/tests/02-client-credential-flow/03-client-cred-create-api-prod-auth-pro.cy.ts index fe2ab6796..3bd594303 100644 --- a/e2e/cypress/tests/02-client-credential-flow/03-client-cred-create-api-prod-auth-pro.cy.ts +++ b/e2e/cypress/tests/02-client-credential-flow/03-client-cred-create-api-prod-auth-pro.cy.ts @@ -42,7 +42,7 @@ describe('Create API, Product, and Authorization Profiles; Apply Auth Profiles t cy.getUserSession().then(() => { cy.get('@common-testdata').then(({ clientCredentials }: any) => { nameSpace = clientCredentials.namespace - home.useNamespace(clientCredentials.namespace) + cy.activateGateway(clientCredentials.namespace) cy.get('@login').then(function (xhr: any) { userSession = xhr.response.headers['x-auth-request-access-token'] }) diff --git a/e2e/cypress/tests/02-client-credential-flow/05-cids-access-approve-api-rqst.cy.ts b/e2e/cypress/tests/02-client-credential-flow/05-cids-access-approve-api-rqst.cy.ts index 7c2b38156..267711176 100644 --- a/e2e/cypress/tests/02-client-credential-flow/05-cids-access-approve-api-rqst.cy.ts +++ b/e2e/cypress/tests/02-client-credential-flow/05-cids-access-approve-api-rqst.cy.ts @@ -28,7 +28,7 @@ describe('Access manager approves developer access request for Client ID/Secret cy.get('@access-manager').then(({ user }: any) => { cy.get('@common-testdata').then(({ clientCredentials }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(clientCredentials.namespace) + cy.activateGateway(clientCredentials.namespace) }) }) }) diff --git a/e2e/cypress/tests/02-client-credential-flow/07-deselect-scope.ts b/e2e/cypress/tests/02-client-credential-flow/07-deselect-scope.ts index 42f58f8b6..a48e13e65 100644 --- a/e2e/cypress/tests/02-client-credential-flow/07-deselect-scope.ts +++ b/e2e/cypress/tests/02-client-credential-flow/07-deselect-scope.ts @@ -29,7 +29,7 @@ describe('Deselect the scope from authorization tab', () => { 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); + cy.activateGateway(clientCredentials.namespace); }) }) }) diff --git a/e2e/cypress/tests/02-client-credential-flow/08-verify-client-scope-in-default-list.ts b/e2e/cypress/tests/02-client-credential-flow/08-verify-client-scope-in-default-list.ts index 221c38808..f758ab802 100644 --- a/e2e/cypress/tests/02-client-credential-flow/08-verify-client-scope-in-default-list.ts +++ b/e2e/cypress/tests/02-client-credential-flow/08-verify-client-scope-in-default-list.ts @@ -81,7 +81,7 @@ describe('Verify the selected client scoped is not displayed in assigned default // 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); +// cy.activateGateway(clientCredentials.namespace); // }) // }) // }) diff --git a/e2e/cypress/tests/02-client-credential-flow/10-jwt-genkp-access-approve-api-rqst.cy.ts b/e2e/cypress/tests/02-client-credential-flow/10-jwt-genkp-access-approve-api-rqst.cy.ts index 9a10b7965..32ac0a20f 100644 --- a/e2e/cypress/tests/02-client-credential-flow/10-jwt-genkp-access-approve-api-rqst.cy.ts +++ b/e2e/cypress/tests/02-client-credential-flow/10-jwt-genkp-access-approve-api-rqst.cy.ts @@ -26,7 +26,7 @@ describe('Access manager approves developer access request for JWT - Generated K cy.get('@access-manager').then(({ user }: any) => { cy.get('@common-testdata').then(({ clientCredentials }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(clientCredentials.namespace) + cy.activateGateway(clientCredentials.namespace) }) }) }) diff --git a/e2e/cypress/tests/02-client-credential-flow/12-jwks-url-access-approval-api-rqst.cy.ts b/e2e/cypress/tests/02-client-credential-flow/12-jwks-url-access-approval-api-rqst.cy.ts index 6350d1f99..6d53773ee 100644 --- a/e2e/cypress/tests/02-client-credential-flow/12-jwks-url-access-approval-api-rqst.cy.ts +++ b/e2e/cypress/tests/02-client-credential-flow/12-jwks-url-access-approval-api-rqst.cy.ts @@ -27,7 +27,7 @@ describe('Access manager approves developer access request for JWKS URL flow', ( cy.get('@access-manager').then(({ user }: any) => { cy.get('@common-testdata').then(({ clientCredentials }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(clientCredentials.namespace) + cy.activateGateway(clientCredentials.namespace) }) }) }) diff --git a/e2e/cypress/tests/02-client-credential-flow/14-jwt-publlicKey-access-approve-api-rqst.cy.ts b/e2e/cypress/tests/02-client-credential-flow/14-jwt-publlicKey-access-approve-api-rqst.cy.ts index 8fdd22d96..698f1b736 100644 --- a/e2e/cypress/tests/02-client-credential-flow/14-jwt-publlicKey-access-approve-api-rqst.cy.ts +++ b/e2e/cypress/tests/02-client-credential-flow/14-jwt-publlicKey-access-approve-api-rqst.cy.ts @@ -26,7 +26,7 @@ describe('Access manager approves developer access request for JWT - Generated K cy.get('@access-manager').then(({ user }: any) => { cy.get('@common-testdata').then(({ clientCredentials }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(clientCredentials.namespace) + cy.activateGateway(clientCredentials.namespace) }) }) }) diff --git a/e2e/cypress/tests/03-manage-labels/02-approve-pending-rqst-for-labels.spec.cy.ts b/e2e/cypress/tests/03-manage-labels/02-approve-pending-rqst-for-labels.spec.cy.ts index 7ff4da239..e76ffc8c7 100644 --- a/e2e/cypress/tests/03-manage-labels/02-approve-pending-rqst-for-labels.spec.cy.ts +++ b/e2e/cypress/tests/03-manage-labels/02-approve-pending-rqst-for-labels.spec.cy.ts @@ -28,7 +28,7 @@ describe('Approve Pending Request Spec', () => { cy.get('@access-manager').then(({ user }: any) => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(namespace); + cy.activateGateway(namespace); }) }) }) diff --git a/e2e/cypress/tests/03-manage-labels/03-filter-labels.cy.ts b/e2e/cypress/tests/03-manage-labels/03-filter-labels.cy.ts index 7e4f00872..79ee8e86f 100644 --- a/e2e/cypress/tests/03-manage-labels/03-filter-labels.cy.ts +++ b/e2e/cypress/tests/03-manage-labels/03-filter-labels.cy.ts @@ -29,7 +29,7 @@ describe('Filter Manage labels Spec', () => { cy.get('@access-manager').then(({ user }: any) => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(namespace); + cy.activateGateway(namespace); }) }) }) diff --git a/e2e/cypress/tests/03-manage-labels/04-manage-labels.cy.ts b/e2e/cypress/tests/03-manage-labels/04-manage-labels.cy.ts index 0fd11e4bc..8c4e8a1b4 100644 --- a/e2e/cypress/tests/03-manage-labels/04-manage-labels.cy.ts +++ b/e2e/cypress/tests/03-manage-labels/04-manage-labels.cy.ts @@ -27,7 +27,7 @@ describe('Manage/Edit labels spec', () => { cy.get('@access-manager').then(({ user }: any) => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(namespace); + cy.activateGateway(namespace); }) }) }) diff --git a/e2e/cypress/tests/03-manage-labels/05-link-consumers.ts b/e2e/cypress/tests/03-manage-labels/05-link-consumers.ts index 0d69e9158..978ac6f4d 100644 --- a/e2e/cypress/tests/03-manage-labels/05-link-consumers.ts +++ b/e2e/cypress/tests/03-manage-labels/05-link-consumers.ts @@ -29,7 +29,7 @@ describe('Link Consumers to Namespace', () => { cy.get('@access-manager').then(({ user }: any) => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(namespace); + cy.activateGateway(namespace); }) }) }) diff --git a/e2e/cypress/tests/04-gateway-services/01-gateway-service-details.cy.ts b/e2e/cypress/tests/04-gateway-services/01-gateway-service-details.cy.ts index 69c915900..696766a2a 100644 --- a/e2e/cypress/tests/04-gateway-services/01-gateway-service-details.cy.ts +++ b/e2e/cypress/tests/04-gateway-services/01-gateway-service-details.cy.ts @@ -27,7 +27,7 @@ describe('Verify Gateway Service details', () => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') - home.useNamespace(namespace) + cy.activateGateway(namespace) }) }) }) diff --git a/e2e/cypress/tests/04-gateway-services/02-filter-gateway-service.cy.ts b/e2e/cypress/tests/04-gateway-services/02-filter-gateway-service.cy.ts index df77485fd..4185064dd 100644 --- a/e2e/cypress/tests/04-gateway-services/02-filter-gateway-service.cy.ts +++ b/e2e/cypress/tests/04-gateway-services/02-filter-gateway-service.cy.ts @@ -29,7 +29,7 @@ describe('Filter Gateway Services Spec', () => { cy.get('@apiowner').then(({ namespace }: any) => { cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') - home.useNamespace(namespace) + cy.activateGateway(namespace) }) }) }) diff --git a/e2e/cypress/tests/05-migrate-user/01-migrate-user-access.cy.ts b/e2e/cypress/tests/05-migrate-user/01-migrate-user-access.cy.ts index 29600e05e..480054f56 100644 --- a/e2e/cypress/tests/05-migrate-user/01-migrate-user-access.cy.ts +++ b/e2e/cypress/tests/05-migrate-user/01-migrate-user-access.cy.ts @@ -24,7 +24,7 @@ describe('Assign Access to existing user Spec', () => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') - home.useNamespace(namespace) + cy.activateGateway(namespace) }) }) }) @@ -68,7 +68,7 @@ describe('Authernticate with old user to initiate migration', () => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.login(oldUser.credentials.username, oldUser.credentials.password) cy.log('Logged in!') - home.useNamespace(namespace) + cy.activateGateway(namespace) }) }) }) @@ -105,14 +105,14 @@ describe('Verify that permission of old user is migrated to new user', () => { // it('activates new namespace', () => { // cy.get('@apiowner').then(({ namespace }: any) => { - // home.useNamespace(namespace) + // cy.activateGateway(namespace) // }) // }) it('Get the permission of the user', () => { cy.getUserSession().then(() => { cy.get('@common-testdata').then(({ namespace }: any) => { - home.useNamespace(namespace) + cy.activateGateway(namespace) cy.get('@login').then(function (xhr: any) { userScopes = xhr.response.body.user.scopes }) diff --git a/e2e/cypress/tests/06-refresh-credential/02-client-credentials.cy.ts b/e2e/cypress/tests/06-refresh-credential/02-client-credentials.cy.ts index e7a10e6e4..d159321cb 100644 --- a/e2e/cypress/tests/06-refresh-credential/02-client-credentials.cy.ts +++ b/e2e/cypress/tests/06-refresh-credential/02-client-credentials.cy.ts @@ -31,7 +31,7 @@ import MyAccessPage from '../../pageObjects/myAccess' // cy.get('@access-manager').then(({ user, clientCredentials }: any) => { // cy.get('@developer').then(({ clientCredentials }: any) => { // cy.login(user.credentials.username, user.credentials.password).then(() => { -// home.useNamespace(clientCredentials.namespace); +// cy.activateGateway(clientCredentials.namespace); // cy.visit(consumers.path); // consumers.filterConsumerByTypeAndValue('Environment', clientCredentials.clientIdSecret.product.environment) // consumers.clickOnTheFirstConsumerID() diff --git a/e2e/cypress/tests/07-manage-control/01-ip-restriction.cy.ts b/e2e/cypress/tests/07-manage-control/01-ip-restriction.cy.ts index 4ea8283dc..43c279d7b 100644 --- a/e2e/cypress/tests/07-manage-control/01-ip-restriction.cy.ts +++ b/e2e/cypress/tests/07-manage-control/01-ip-restriction.cy.ts @@ -23,7 +23,7 @@ describe('Manage Control-IP Restriction Spec', () => { cy.get('@access-manager').then(({ user }: any) => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.login(user.credentials.username, user.credentials.password).then(() => { - home.useNamespace(namespace); + cy.activateGateway(namespace); }) }) }) diff --git a/e2e/cypress/tests/07-manage-control/02-rate-limiting.cy.ts b/e2e/cypress/tests/07-manage-control/02-rate-limiting.cy.ts index 6b99859b4..292b9eded 100644 --- a/e2e/cypress/tests/07-manage-control/02-rate-limiting.cy.ts +++ b/e2e/cypress/tests/07-manage-control/02-rate-limiting.cy.ts @@ -28,7 +28,7 @@ describe('Manage Control-Rate Limiting Spec for Service as Scope and Local Polic cy.get('@access-manager').then(({ user }: any) => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.login(user.credentials.username, user.credentials.password).then(() => { - home.useNamespace(namespace); + cy.activateGateway(namespace); }) }) }) diff --git a/e2e/cypress/tests/07-manage-control/03-kong-api-only-apply-rate-limiting.cy.ts b/e2e/cypress/tests/07-manage-control/03-kong-api-only-apply-rate-limiting.cy.ts index 08767f570..8de053b68 100644 --- a/e2e/cypress/tests/07-manage-control/03-kong-api-only-apply-rate-limiting.cy.ts +++ b/e2e/cypress/tests/07-manage-control/03-kong-api-only-apply-rate-limiting.cy.ts @@ -42,7 +42,7 @@ describe('Apply Kong API key only plugin', () => { cy.getUserSession().then(() => { cy.get('@common-testdata').then(({ namespace }: any) => { nameSpace = namespace - home.useNamespace(namespace) + cy.activateGateway(namespace) }) }) }) @@ -204,7 +204,7 @@ describe('Approve Pending Request Spec', () => { cy.get('@access-manager').then(({ user }: any) => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(namespace); + cy.activateGateway(namespace); }) }) }) diff --git a/e2e/cypress/tests/08-client-role/02-add-roles-authorization-profile.ts b/e2e/cypress/tests/08-client-role/02-add-roles-authorization-profile.ts index e6ed788f7..c37fcc880 100644 --- a/e2e/cypress/tests/08-client-role/02-add-roles-authorization-profile.ts +++ b/e2e/cypress/tests/08-client-role/02-add-roles-authorization-profile.ts @@ -33,7 +33,7 @@ describe('Apply client roles to the Authorization Profile', () => { it('Select the namespace created for client credential ', () => { cy.get('@common-testdata').then(({ clientCredentials }: any) => { - home.useNamespace(clientCredentials.namespace) + cy.activateGateway(clientCredentials.namespace) }) }) diff --git a/e2e/cypress/tests/08-client-role/03-read-client-role.ts b/e2e/cypress/tests/08-client-role/03-read-client-role.ts index cad5ca94d..eebd440b5 100644 --- a/e2e/cypress/tests/08-client-role/03-read-client-role.ts +++ b/e2e/cypress/tests/08-client-role/03-read-client-role.ts @@ -80,7 +80,7 @@ describe('Access manager apply "Read" role and approves developer access request cy.get('@access-manager').then(({ user }: any) => { cy.get('@common-testdata').then(({ clientCredentials }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(clientCredentials.namespace) + cy.activateGateway(clientCredentials.namespace) }) }) }) diff --git a/e2e/cypress/tests/08-client-role/04-write-client-role.ts b/e2e/cypress/tests/08-client-role/04-write-client-role.ts index 411fa8404..70ac86ea3 100644 --- a/e2e/cypress/tests/08-client-role/04-write-client-role.ts +++ b/e2e/cypress/tests/08-client-role/04-write-client-role.ts @@ -79,7 +79,7 @@ describe('Access manager apply "Write" role and approves developer access reques cy.get('@access-manager').then(({ user }: any) => { cy.get('@common-testdata').then(({ clientCredentials }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(clientCredentials.namespace) + cy.activateGateway(clientCredentials.namespace) }) }) }) diff --git a/e2e/cypress/tests/08-client-role/05-check-without-role.ts b/e2e/cypress/tests/08-client-role/05-check-without-role.ts index a96f1d6a0..d13c51c1e 100644 --- a/e2e/cypress/tests/08-client-role/05-check-without-role.ts +++ b/e2e/cypress/tests/08-client-role/05-check-without-role.ts @@ -43,7 +43,7 @@ describe('Reset Authorization profile to default (without any role)', () => { cy.getUserSession().then(() => { cy.get('@common-testdata').then(({ clientCredentials }: any) => { nameSpace = clientCredentials.namespace - home.useNamespace(clientCredentials.namespace) + cy.activateGateway(clientCredentials.namespace) }) }) }) diff --git a/e2e/cypress/tests/09-update-product-env/01-client-credential-to-kong-acl-api.cy.ts b/e2e/cypress/tests/09-update-product-env/01-client-credential-to-kong-acl-api.cy.ts index e9b7d910b..d8f4fce69 100644 --- a/e2e/cypress/tests/09-update-product-env/01-client-credential-to-kong-acl-api.cy.ts +++ b/e2e/cypress/tests/09-update-product-env/01-client-credential-to-kong-acl-api.cy.ts @@ -43,7 +43,7 @@ describe('Change Authorization profile', () => { cy.getUserSession().then(() => { cy.get('@common-testdata').then(({ clientCredentials }: any) => { nameSpace = clientCredentials.namespace - home.useNamespace(clientCredentials.namespace) + cy.activateGateway(clientCredentials.namespace) cy.get('@login').then(function (xhr: any) { userSession = xhr.response.headers['x-auth-request-access-token'] }) @@ -182,7 +182,7 @@ describe('Access manager approves developer access request for Kong API ACL auth cy.get('@access-manager').then(({ user }: any) => { cy.get('@common-testdata').then(({ clientCredentials }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(clientCredentials.namespace) + cy.activateGateway(clientCredentials.namespace) }) }) }) diff --git a/e2e/cypress/tests/09-update-product-env/02-kong-acl-api-to-client-credential.cy.ts b/e2e/cypress/tests/09-update-product-env/02-kong-acl-api-to-client-credential.cy.ts index 14f622a41..ebd18aa32 100644 --- a/e2e/cypress/tests/09-update-product-env/02-kong-acl-api-to-client-credential.cy.ts +++ b/e2e/cypress/tests/09-update-product-env/02-kong-acl-api-to-client-credential.cy.ts @@ -46,7 +46,7 @@ describe('Change Authorization profile from Kong ACL-API to Client Credential', cy.getUserSession().then(() => { cy.get('@common-testdata').then(({ namespace }: any) => { nameSpace = namespace - home.useNamespace(namespace) + cy.activateGateway(namespace) }) }) }) @@ -188,7 +188,7 @@ describe('Access manager approves developer access request for Client ID/Secret cy.get('@access-manager').then(({ user }: any) => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(namespace) + cy.activateGateway(namespace) }) }) }) diff --git a/e2e/cypress/tests/09-update-product-env/03-apply-multiple-services.cy.ts b/e2e/cypress/tests/09-update-product-env/03-apply-multiple-services.cy.ts index 50de65e81..2537f4c7c 100644 --- a/e2e/cypress/tests/09-update-product-env/03-apply-multiple-services.cy.ts +++ b/e2e/cypress/tests/09-update-product-env/03-apply-multiple-services.cy.ts @@ -48,7 +48,7 @@ describe('Apply multiple services to the product environment', () => { cy.getUserSession().then(() => { cy.get('@common-testdata').then(({ namespace }: any) => { nameSpace = namespace - home.useNamespace(namespace) + cy.activateGateway(namespace) }) }) }) @@ -215,7 +215,7 @@ describe('Access manager approves developer access request for Client ID/Secret cy.get('@access-manager').then(({ user }: any) => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(namespace) + cy.activateGateway(namespace) }) }) }) diff --git a/e2e/cypress/tests/09-update-product-env/04-change-env-status copy.cy.ts b/e2e/cypress/tests/09-update-product-env/04-change-env-status copy.cy.ts index 0eb83a20d..746eb9d7f 100644 --- a/e2e/cypress/tests/09-update-product-env/04-change-env-status copy.cy.ts +++ b/e2e/cypress/tests/09-update-product-env/04-change-env-status copy.cy.ts @@ -47,7 +47,7 @@ describe('Change Product environment from active to inactive', () => { cy.getUserSession().then(() => { cy.get('@common-testdata').then(({ namespace }: any) => { nameSpace = namespace - home.useNamespace(namespace) + cy.activateGateway(namespace) }) }) }) diff --git a/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts b/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts index 5f5744773..d0d54de34 100644 --- a/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts +++ b/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts @@ -37,7 +37,7 @@ describe('Apply Shared IDP while creating Authorization Profile', () => { cy.get('@apiowner').then(({ user }: any) => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(namespace) + cy.activateGateway(namespace) cy.get('@login').then(function (xhr: any) { userSession = xhr.response.headers['x-auth-request-access-token'] }) @@ -102,7 +102,7 @@ describe('Update IDP issuer for shared IDP profile', () => { cy.get('@apiowner').then(({ user }: any) => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(namespace) + cy.activateGateway(namespace) cy.get('@login').then(function (xhr: any) { userSession = xhr.response.headers['x-auth-request-access-token'] }) diff --git a/e2e/cypress/tests/09-update-product-env/07-kong-public-auth.ts b/e2e/cypress/tests/09-update-product-env/07-kong-public-auth.ts index 4db1d8d33..a596c70b1 100644 --- a/e2e/cypress/tests/09-update-product-env/07-kong-public-auth.ts +++ b/e2e/cypress/tests/09-update-product-env/07-kong-public-auth.ts @@ -43,7 +43,7 @@ describe('Verify for Kong Public Auth', () => { cy.getUserSession().then(() => { cy.get('@common-testdata').then(({ clientCredentials }: any) => { nameSpace = clientCredentials.namespace - home.useNamespace(clientCredentials.namespace) + cy.activateGateway(clientCredentials.namespace) cy.get('@login').then(function (xhr: any) { userSession = xhr.response.headers['x-auth-request-access-token'] }) diff --git a/e2e/cypress/tests/09-update-product-env/08-protected-externally.ts b/e2e/cypress/tests/09-update-product-env/08-protected-externally.ts index ff84052df..449271d3a 100644 --- a/e2e/cypress/tests/09-update-product-env/08-protected-externally.ts +++ b/e2e/cypress/tests/09-update-product-env/08-protected-externally.ts @@ -34,7 +34,7 @@ describe('Verify Protected Externally Auth', () => { cy.getUserSession().then(() => { cy.get('@common-testdata').then(({ clientCredentials }: any) => { nameSpace = clientCredentials.namespace - home.useNamespace(clientCredentials.namespace) + cy.activateGateway(clientCredentials.namespace) cy.get('@login').then(function (xhr: any) { userSession = xhr.response.headers['x-auth-request-access-token'] }) diff --git a/e2e/cypress/tests/09-update-product-env/09-two-tiered-hidden.cy.ts b/e2e/cypress/tests/09-update-product-env/09-two-tiered-hidden.cy.ts index bc3edb7ff..ad2f9ed86 100644 --- a/e2e/cypress/tests/09-update-product-env/09-two-tiered-hidden.cy.ts +++ b/e2e/cypress/tests/09-update-product-env/09-two-tiered-hidden.cy.ts @@ -69,7 +69,7 @@ describe('Verify Two Tiered Hidden', () => { cy.getUserSession().then(() => { cy.get('@common-testdata').then(({ twoTieredHidden }: any) => { nameSpace = twoTieredHidden.namespace - home.useNamespace(twoTieredHidden.namespace) + cy.activateGateway(twoTieredHidden.namespace) cy.get('@login').then(function (xhr: any) { userSession = xhr.response.headers['x-auth-request-access-token'] }) diff --git a/e2e/cypress/tests/10-clear-resources/01-create-api.cy.ts b/e2e/cypress/tests/10-clear-resources/01-create-api.cy.ts index 080ebb0eb..727b586f6 100644 --- a/e2e/cypress/tests/10-clear-resources/01-create-api.cy.ts +++ b/e2e/cypress/tests/10-clear-resources/01-create-api.cy.ts @@ -53,7 +53,7 @@ describe('Create API Spec for Delete Resources', () => { }) it('activates new namespace', () => { - home.useNamespace(namespace) + cy.activateGateway(namespace) }) it('creates a new service account', () => { diff --git a/e2e/cypress/tests/10-clear-resources/02-team-access.cy.ts b/e2e/cypress/tests/10-clear-resources/02-team-access.cy.ts index 0b9d69f7c..7b2851bff 100644 --- a/e2e/cypress/tests/10-clear-resources/02-team-access.cy.ts +++ b/e2e/cypress/tests/10-clear-resources/02-team-access.cy.ts @@ -24,7 +24,7 @@ describe('Team Access Spec', () => { cy.get('@common-testdata').then(({ deleteResources }: any) => { cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') - home.useNamespace(deleteResources.namespace) + cy.activateGateway(deleteResources.namespace) }) }) }) diff --git a/e2e/cypress/tests/10-clear-resources/04-delete-consumer.ts b/e2e/cypress/tests/10-clear-resources/04-delete-consumer.ts index b29d95b28..1e50e1e85 100644 --- a/e2e/cypress/tests/10-clear-resources/04-delete-consumer.ts +++ b/e2e/cypress/tests/10-clear-resources/04-delete-consumer.ts @@ -31,7 +31,7 @@ describe('Delete created consumer', () => { cy.get('@access-manager').then(({ user }: any) => { cy.get('@common-testdata').then(({ deleteResources }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(deleteResources.namespace); + cy.activateGateway(deleteResources.namespace); }) }) }) diff --git a/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts b/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts index 6a58f6ed9..e04d87551 100644 --- a/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts +++ b/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts @@ -29,7 +29,7 @@ describe('Delete created resources', () => { cy.get('@apiowner').then(({ user }: any) => { cy.get('@common-testdata').then(({ deleteResources }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(deleteResources.namespace); + cy.activateGateway(deleteResources.namespace); }) }) }) @@ -70,7 +70,7 @@ describe('Delete created resources', () => { }) cy.get('@common-testdata').then(({ deleteResources }: any) => { flag = true - home.useNamespace(deleteResources.namespace) + cy.activateGateway(deleteResources.namespace) }) }) diff --git a/e2e/cypress/tests/10-clear-resources/06-delete-service-acc.ts b/e2e/cypress/tests/10-clear-resources/06-delete-service-acc.ts index 2a82d2e05..b334b55c5 100644 --- a/e2e/cypress/tests/10-clear-resources/06-delete-service-acc.ts +++ b/e2e/cypress/tests/10-clear-resources/06-delete-service-acc.ts @@ -32,7 +32,7 @@ describe('Create API Spec', () => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') - home.useNamespace(namespace) + cy.activateGateway(namespace) }) }) }) diff --git a/e2e/cypress/tests/11-activity-feed/01-activity-feed.cy.ts b/e2e/cypress/tests/11-activity-feed/01-activity-feed.cy.ts index cae68ff2d..6dd68051b 100644 --- a/e2e/cypress/tests/11-activity-feed/01-activity-feed.cy.ts +++ b/e2e/cypress/tests/11-activity-feed/01-activity-feed.cy.ts @@ -108,7 +108,7 @@ describe('Verify the Activity filter for users', () => { it('activates new namespace', () => { cy.get('@common-testdata').then(({ namespace }: any) => { - home.useNamespace(namespace) + cy.activateGateway(namespace) }) }) diff --git a/e2e/cypress/tests/11-activity-feed/02-activity-feed-failure.cy.ts b/e2e/cypress/tests/11-activity-feed/02-activity-feed-failure.cy.ts index 74c4a2e8e..c7a764c89 100644 --- a/e2e/cypress/tests/11-activity-feed/02-activity-feed-failure.cy.ts +++ b/e2e/cypress/tests/11-activity-feed/02-activity-feed-failure.cy.ts @@ -86,7 +86,7 @@ describe('Create API, Product, and Authorization Profiles; Apply Auth Profiles t cy.getUserSession().then(() => { cy.get('@common-testdata').then(({ clientCredentials }: any) => { nameSpace = clientCredentials.namespace - home.useNamespace(clientCredentials.namespace) + cy.activateGateway(clientCredentials.namespace) cy.get('@login').then(function (xhr: any) { userSession = xhr.response.headers['x-auth-request-access-token'] }) diff --git a/e2e/cypress/tests/12-access-permission/01-create-api.cy.ts b/e2e/cypress/tests/12-access-permission/01-create-api.cy.ts index 68d021830..8a585ae21 100644 --- a/e2e/cypress/tests/12-access-permission/01-create-api.cy.ts +++ b/e2e/cypress/tests/12-access-permission/01-create-api.cy.ts @@ -53,7 +53,7 @@ describe('Create API Spec', () => { }) it('activates new namespace', () => { - home.useNamespace(namespace) + cy.activateGateway(namespace) }) it('creates a new service account', () => { diff --git a/e2e/cypress/tests/12-access-permission/02-team-access.cy.ts b/e2e/cypress/tests/12-access-permission/02-team-access.cy.ts index c8bb5898f..834dbcc5b 100644 --- a/e2e/cypress/tests/12-access-permission/02-team-access.cy.ts +++ b/e2e/cypress/tests/12-access-permission/02-team-access.cy.ts @@ -25,7 +25,7 @@ describe('Team Access Spec', () => { cy.get('@common-testdata').then(({ checkPermission }: any) => { cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') - home.useNamespace(checkPermission.namespace) + cy.activateGateway(checkPermission.namespace) }) }) }) diff --git a/e2e/cypress/tests/12-access-permission/04-access-manager.cy.ts b/e2e/cypress/tests/12-access-permission/04-access-manager.cy.ts index 2ba9413d2..71915ac5a 100644 --- a/e2e/cypress/tests/12-access-permission/04-access-manager.cy.ts +++ b/e2e/cypress/tests/12-access-permission/04-access-manager.cy.ts @@ -27,7 +27,7 @@ describe('Grant Access Manager Role', () => { cy.get('@common-testdata').then(({ checkPermission }: any) => { cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') - home.useNamespace(checkPermission.namespace) + cy.activateGateway(checkPermission.namespace) }) }) }) @@ -72,7 +72,7 @@ describe('Verify that Mark is able to view the pending request', () => { cy.visit(login.path) cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') - home.useNamespace(checkPermission.namespace) + cy.activateGateway(checkPermission.namespace) cy.visit(mp.path) }) }) diff --git a/e2e/cypress/tests/12-access-permission/05-namespace-manage.cy.ts b/e2e/cypress/tests/12-access-permission/05-namespace-manage.cy.ts index 63769b4fa..165686df0 100644 --- a/e2e/cypress/tests/12-access-permission/05-namespace-manage.cy.ts +++ b/e2e/cypress/tests/12-access-permission/05-namespace-manage.cy.ts @@ -29,7 +29,7 @@ describe('Grant Namespace Manage Role', () => { cy.get('@common-testdata').then(({ checkPermission }: any) => { cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') - home.useNamespace(checkPermission.namespace) + cy.activateGateway(checkPermission.namespace) }) }) }) @@ -77,7 +77,7 @@ describe('Verify that Wendy is able to see all the options for the Namespace', ( cy.visit(login.path) cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') - home.useNamespace(checkPermission.namespace) + cy.activateGateway(checkPermission.namespace) cy.visit(mp.path) }) }) diff --git a/e2e/cypress/tests/12-access-permission/06-credential-issuer.cy.ts b/e2e/cypress/tests/12-access-permission/06-credential-issuer.cy.ts index e50d355f4..41edbe719 100644 --- a/e2e/cypress/tests/12-access-permission/06-credential-issuer.cy.ts +++ b/e2e/cypress/tests/12-access-permission/06-credential-issuer.cy.ts @@ -28,7 +28,7 @@ describe('Grant Credential Issuer Role', () => { cy.get('@common-testdata').then(({ checkPermission }: any) => { cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') - home.useNamespace(checkPermission.namespace) + cy.activateGateway(checkPermission.namespace) }) }) }) @@ -75,7 +75,7 @@ describe('Verify that Wendy is able to generate authorization profile', () => { cy.visit(login.path) cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') - home.useNamespace(checkPermission.namespace) + cy.activateGateway(checkPermission.namespace) cy.visit(mp.path) }) }) diff --git a/e2e/cypress/tests/12-access-permission/07-namespace-view.cy.ts b/e2e/cypress/tests/12-access-permission/07-namespace-view.cy.ts index 564ce1ec4..38025ea7c 100644 --- a/e2e/cypress/tests/12-access-permission/07-namespace-view.cy.ts +++ b/e2e/cypress/tests/12-access-permission/07-namespace-view.cy.ts @@ -29,7 +29,7 @@ describe('Grant Namespace View Role to Mark', () => { cy.get('@common-testdata').then(({ checkPermission }: any) => { cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') - home.useNamespace(checkPermission.namespace) + cy.activateGateway(checkPermission.namespace) }) }) }) @@ -75,7 +75,7 @@ describe('Verify that Mark is unable to create service account', () => { cy.visit(login.path) cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') - home.useNamespace(checkPermission.namespace) + cy.activateGateway(checkPermission.namespace) cy.visit(mp.path) }) }) diff --git a/e2e/cypress/tests/12-access-permission/08-gateway-config.cy.ts b/e2e/cypress/tests/12-access-permission/08-gateway-config.cy.ts index 8a584e533..e550831f3 100644 --- a/e2e/cypress/tests/12-access-permission/08-gateway-config.cy.ts +++ b/e2e/cypress/tests/12-access-permission/08-gateway-config.cy.ts @@ -31,7 +31,7 @@ describe('Grant Gateway Config Role to Wendy', () => { cy.get('@apiowner').then(({ user }: any) => { cy.get('@common-testdata').then(({ checkPermission }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(checkPermission.namespace) + cy.activateGateway(checkPermission.namespace) }) }) }) @@ -78,7 +78,7 @@ describe('Verify that Wendy is able to generate authorization profile', () => { cy.visit(login.path) cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') - home.useNamespace(checkPermission.namespace) + cy.activateGateway(checkPermission.namespace) cy.visit(mp.path) }) }) diff --git a/e2e/cypress/tests/12-access-permission/09-content-publish.cy.ts b/e2e/cypress/tests/12-access-permission/09-content-publish.cy.ts index bad3c0f6b..43f252348 100644 --- a/e2e/cypress/tests/12-access-permission/09-content-publish.cy.ts +++ b/e2e/cypress/tests/12-access-permission/09-content-publish.cy.ts @@ -26,7 +26,7 @@ describe('Verify Content Publish Permission', () => { cy.get('@apiowner').then(({ user }: any) => { cy.get('@common-testdata').then(({ checkPermission }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(checkPermission.namespace) + cy.activateGateway(checkPermission.namespace) }) }) }) diff --git a/e2e/cypress/tests/13-namespace-preview-mode/01-create-api.cy.ts b/e2e/cypress/tests/13-namespace-preview-mode/01-create-api.cy.ts index 6f6059679..23933b01a 100644 --- a/e2e/cypress/tests/13-namespace-preview-mode/01-create-api.cy.ts +++ b/e2e/cypress/tests/13-namespace-preview-mode/01-create-api.cy.ts @@ -52,7 +52,7 @@ describe('Create API Spec', () => { }) it('activates new namespace', () => { - home.useNamespace(namespace) + cy.activateGateway(namespace) }) it('creates a new service account', () => { diff --git a/e2e/cypress/tests/13-namespace-preview-mode/02-namespace-preview-mode.cy.ts b/e2e/cypress/tests/13-namespace-preview-mode/02-namespace-preview-mode.cy.ts index 2d73b0753..e026f5aa9 100644 --- a/e2e/cypress/tests/13-namespace-preview-mode/02-namespace-preview-mode.cy.ts +++ b/e2e/cypress/tests/13-namespace-preview-mode/02-namespace-preview-mode.cy.ts @@ -34,7 +34,7 @@ describe('Verify Products when namespace in Preview Mode', () => { cy.get('@common-testdata').then(({ namespacePreview }: any) => { cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') - home.useNamespace(namespacePreview.namespace) + cy.activateGateway(namespacePreview.namespace) }) }) }) diff --git a/e2e/cypress/tests/14-org-assignment/01-client-cred-team-access.ts b/e2e/cypress/tests/14-org-assignment/01-client-cred-team-access.ts index f83765a9f..0b205f566 100644 --- a/e2e/cypress/tests/14-org-assignment/01-client-cred-team-access.ts +++ b/e2e/cypress/tests/14-org-assignment/01-client-cred-team-access.ts @@ -60,7 +60,7 @@ describe('Add Organization to publish API', () => { }) it('activates new namespace', () => { - home.useNamespace(namespace) + cy.activateGateway(namespace) }) it('creates a new service account', () => { @@ -158,7 +158,7 @@ describe('Org Admin approves the request', () => { }) it('Select the namespace', () => { - home.useNamespace(namespace) + cy.activateGateway(namespace) }) it('Clik on Enable Publishing option from Namespace Page', () => { @@ -198,7 +198,7 @@ describe('Activate the API to make it visible in API Directory', () => { it('Authenticates api owner', () => { cy.get('@apiowner').then(({ user }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(namespace) + cy.activateGateway(namespace) }) }) @@ -301,7 +301,7 @@ describe('Access manager approves developer access request for Kong API ACL auth it('Access Manager logs in', () => { cy.get('@access-manager').then(({ user }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(namespace) + cy.activateGateway(namespace) }) }) diff --git a/e2e/cypress/tests/14-org-assignment/03-verify-org-admin-member-org.ts b/e2e/cypress/tests/14-org-assignment/03-verify-org-admin-member-org.ts index c4320fe12..86fac9fef 100644 --- a/e2e/cypress/tests/14-org-assignment/03-verify-org-admin-member-org.ts +++ b/e2e/cypress/tests/14-org-assignment/03-verify-org-admin-member-org.ts @@ -54,7 +54,7 @@ describe('Multiple Org Adming for the organization', () => { }) it('activates new namespace', () => { - home.useNamespace(namespace) + cy.activateGateway(namespace) }) diff --git a/e2e/cypress/tests/14-org-assignment/05-verify-org-admin-member-org-unit.ts b/e2e/cypress/tests/14-org-assignment/05-verify-org-admin-member-org-unit.ts index 2a19a394f..5ae45c8e7 100644 --- a/e2e/cypress/tests/14-org-assignment/05-verify-org-admin-member-org-unit.ts +++ b/e2e/cypress/tests/14-org-assignment/05-verify-org-admin-member-org-unit.ts @@ -53,7 +53,7 @@ describe('Multiple Org Admin for the organization', () => { }) it('activates new namespace', () => { - home.useNamespace(namespace) + cy.activateGateway(namespace) }) it('creates a new service account', () => { diff --git a/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts b/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts index c432833fd..538537ea4 100644 --- a/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts +++ b/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts @@ -53,7 +53,7 @@ describe('Create API Spec', () => { }) it('activates new namespace', () => { - home.useNamespace(namespace) + cy.activateGateway(namespace) }) it('Associate Namespace to the organization Unit', () => { diff --git a/e2e/cypress/tests/15-aps-api/05-authorizationProfiles.cy.ts b/e2e/cypress/tests/15-aps-api/05-authorizationProfiles.cy.ts index c490f0ca1..c939409ee 100644 --- a/e2e/cypress/tests/15-aps-api/05-authorizationProfiles.cy.ts +++ b/e2e/cypress/tests/15-aps-api/05-authorizationProfiles.cy.ts @@ -242,7 +242,7 @@ describe('Deleted shared auth profile', () => { cy.getUserSessionTokenValue(apiTest.namespace).then((value) => { userSession = value namespace = apiTest.namespace - home.useNamespace(namespace); + cy.activateGateway(namespace); }) }) }) diff --git a/e2e/cypress/tests/15-aps-api/06-products.cy.ts b/e2e/cypress/tests/15-aps-api/06-products.cy.ts index e169e786e..9b049dc3c 100644 --- a/e2e/cypress/tests/15-aps-api/06-products.cy.ts +++ b/e2e/cypress/tests/15-aps-api/06-products.cy.ts @@ -30,7 +30,7 @@ describe('Get the user session token to check ', () => { cy.get('@apiowner').then(({ user }: any) => { cy.get('@common-testdata').then(({ apiTest }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(apiTest.namespace) + cy.activateGateway(apiTest.namespace) namespace = apiTest.namespace cy.get('@login').then(function (xhr: any) { userSession = xhr.response.headers['x-auth-request-access-token'] diff --git a/e2e/cypress/tests/16-gwa-cli/02-cli-generate-config.ts b/e2e/cypress/tests/16-gwa-cli/02-cli-generate-config.ts index e4214a9ef..845bb4f19 100644 --- a/e2e/cypress/tests/16-gwa-cli/02-cli-generate-config.ts +++ b/e2e/cypress/tests/16-gwa-cli/02-cli-generate-config.ts @@ -59,7 +59,7 @@ describe('Verify CLI commands for generate/apply config', () => { }) it('activates new namespace', () => { - home.useNamespace(namespace) + cy.activateGateway(namespace) }) it('Verify that the product created through gwa command is displayed in the portal', () => { diff --git a/e2e/cypress/tests/17-delete-application/03-delete-application-with-approved-request.cy.ts b/e2e/cypress/tests/17-delete-application/03-delete-application-with-approved-request.cy.ts index 008364333..c07b38e2b 100644 --- a/e2e/cypress/tests/17-delete-application/03-delete-application-with-approved-request.cy.ts +++ b/e2e/cypress/tests/17-delete-application/03-delete-application-with-approved-request.cy.ts @@ -76,7 +76,7 @@ describe('Approve Pending Request Spec', () => { cy.get('@access-manager').then(({ user }: any) => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.login(user.credentials.username, user.credentials.password) - home.useNamespace(namespace); + cy.activateGateway(namespace); }) }) }) From 8f5eaa5c8c3ee8c4eb6c524e174543c5a1f7e348 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Tue, 9 Jul 2024 09:45:44 -0700 Subject: [PATCH 11/54] remove graphql-request package use --- e2e/cypress/support/auth-commands.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/e2e/cypress/support/auth-commands.ts b/e2e/cypress/support/auth-commands.ts index 19dfb266f..e605ac2e8 100644 --- a/e2e/cypress/support/auth-commands.ts +++ b/e2e/cypress/support/auth-commands.ts @@ -1,5 +1,4 @@ import * as jwt from 'jsonwebtoken' -import { gql } from 'graphql-request' import HomePage from '../pageObjects/home' import LoginPage from '../pageObjects/login' import NamespaceAccessPage from '../pageObjects/namespaceAccess' @@ -101,7 +100,7 @@ Cypress.Commands.add('createGateway', (gatewayid?: string, displayname?: string) }) Cypress.Commands.add('activateGateway', (gatewayId: string) => { - const getAllNsQuery = gql` + const getAllNsQuery = ` query GetNamespaces { allNamespaces { id @@ -109,7 +108,7 @@ query GetNamespaces { } } ` - const currentNsQuery = gql` + const currentNsQuery = ` query GetCurrentNamespace { currentNamespace { name From 86dea7954a78f06faeed4b051b4858f04cdd2818 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Tue, 9 Jul 2024 10:45:18 -0700 Subject: [PATCH 12/54] 01/02 --- e2e/cypress/pageObjects/namespaceAccess.ts | 2 +- e2e/cypress/support/auth-commands.ts | 3 ++- e2e/cypress/tests/01-api-key/01-create-api.cy.ts | 2 +- e2e/cypress/tests/01-api-key/02-team-access.cy.ts | 10 +++++----- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/e2e/cypress/pageObjects/namespaceAccess.ts b/e2e/cypress/pageObjects/namespaceAccess.ts index 799914aa3..f493367d9 100644 --- a/e2e/cypress/pageObjects/namespaceAccess.ts +++ b/e2e/cypress/pageObjects/namespaceAccess.ts @@ -79,7 +79,7 @@ class NamespaceAccessPage { }) } - path: string = '/manager/namespace-access' + path: string = '/manager/admin-access' clickGrantUserAccessButton() { cy.wait(3000) diff --git a/e2e/cypress/support/auth-commands.ts b/e2e/cypress/support/auth-commands.ts index e605ac2e8..45a2a6de5 100644 --- a/e2e/cypress/support/auth-commands.ts +++ b/e2e/cypress/support/auth-commands.ts @@ -118,6 +118,7 @@ query GetNamespaces { } ` // get the (true) id for the namespace + cy.setHeaders({ 'Content-Type': 'application/json' }) return cy.gqlQuery(getAllNsQuery).then((response) => { const nsdata = response.apiRes.body.data.allNamespaces.find((ns: { name: string }) => ns.name === gatewayId) if (nsdata) { @@ -268,7 +269,7 @@ Cypress.Commands.add('logout', () => { cy.getSession().then(() => { cy.get('@session').then((res: any) => { cy.visit('/') - cy.wait(3000) + // cy.wait(3000) cy.get('[data-testid=auth-menu-user]').click({ force: true }) cy.get('[data-testid=auth-menu-signout-btn]').click({ force: true }) }) diff --git a/e2e/cypress/tests/01-api-key/01-create-api.cy.ts b/e2e/cypress/tests/01-api-key/01-create-api.cy.ts index 9fa414993..04b7180b4 100644 --- a/e2e/cypress/tests/01-api-key/01-create-api.cy.ts +++ b/e2e/cypress/tests/01-api-key/01-create-api.cy.ts @@ -52,7 +52,7 @@ describe('Create API Spec', () => { cy.getUserSession().then(() => { cy.get('@common-testdata').then(({ namespace }: any) => { nameSpace = namespace - cy.createGateway(namespace) + cy.createGateway(namespace) cy.activateGateway(namespace) cy.visit('/manager/gateways/detail') cy.get('[data-testid="ns-detail-gatewayid"]').then(($el) => { diff --git a/e2e/cypress/tests/01-api-key/02-team-access.cy.ts b/e2e/cypress/tests/01-api-key/02-team-access.cy.ts index ab999d6cc..7e81407a4 100644 --- a/e2e/cypress/tests/01-api-key/02-team-access.cy.ts +++ b/e2e/cypress/tests/01-api-key/02-team-access.cy.ts @@ -6,6 +6,7 @@ describe('Team Access Spec', () => { const login = new LoginPage() const home = new HomePage() const na = new NamespaceAccessPage() + let userSession: any before(() => { cy.visit('/') @@ -17,15 +18,14 @@ describe('Team Access Spec', () => { cy.preserveCookies() cy.fixture('apiowner').as('apiowner') cy.fixture('common-testdata').as('common-testdata') - // cy.visit(login.path) }) - + it('authenticates Janis (api owner)', () => { cy.get('@apiowner').then(({ user }: any) => { cy.get('@common-testdata').then(({ namespace }: any) => { - cy.login(user.credentials.username, user.credentials.password) - cy.log('Logged in!') - cy.activateGateway(namespace) + cy.getUserSessionTokenValue(namespace, true).then((value) => { + userSession = value + }) }) }) }) From fe691700fc2cda42da7c3bec7eb44d1683f4b7d4 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Tue, 9 Jul 2024 16:32:11 -0700 Subject: [PATCH 13/54] /02 tests, tweak create and activate gw --- e2e/cypress/fixtures/api.json | 14 ++++----- e2e/cypress/support/auth-commands.ts | 6 ++-- .../01-client-cred-team-access.cy.ts | 31 ++++++------------- ...client-cred-create-api-prod-auth-pro.cy.ts | 12 +++---- .../10-clear-resources/01-create-api.cy.ts | 2 +- .../12-access-permission/01-create-api.cy.ts | 2 +- .../tests/15-aps-api/01-create-api.cy.ts | 2 +- .../tests/15-aps-api/02-organization.cy.ts | 2 +- 8 files changed, 30 insertions(+), 41 deletions(-) diff --git a/e2e/cypress/fixtures/api.json b/e2e/cypress/fixtures/api.json index a7218b1d6..36a1787ca 100644 --- a/e2e/cypress/fixtures/api.json +++ b/e2e/cypress/fixtures/api.json @@ -79,9 +79,9 @@ } }, "apiDirectory": { - "endPoint": "ds/api/v2/namespaces", - "orgEndPoint": "ds/api/v2/organizations", - "directoryEndPoint": "ds/api/v2/directory", + "endPoint": "ds/api/v3/gateways", + "orgEndPoint": "ds/api/v3/gateways", + "directoryEndPoint": "ds/api/v3/directory", "headers": { "accept": "application/json", "content-type": "application/json" @@ -323,7 +323,7 @@ }, "owner": "janis@testmail.com" }, - "endPoint": "ds/api/v2/namespaces/apiplatform/issuers", + "endPoint": "ds/api/v3/gateways/apiplatform/issuers", "headers": { "accept": "application/json", "content-type": "application/json" @@ -334,8 +334,8 @@ "accept": "application/json", "content-type": "application/json" }, - "endPoint": "ds/api/v2/namespaces/apiplatform/products", - "deleteEnvironmentEndPoint": "ds/api/v2/namespaces/apiplatform/environments", + "endPoint": "ds/api/v3/gateways/apiplatform/products", + "deleteEnvironmentEndPoint": "ds/api/v3/gateways/apiplatform/environments", "body": { "name": "my-new-product", "appId": "DRE123456", @@ -355,7 +355,7 @@ "accept": "application/json", "content-type": "application/json" }, - "endPoint": "ds/api/v2/namespaces", + "endPoint": "ds/api/v3/gateways", "activity": { "name": "newplatform", "scopes": [ diff --git a/e2e/cypress/support/auth-commands.ts b/e2e/cypress/support/auth-commands.ts index 45a2a6de5..f2705616a 100644 --- a/e2e/cypress/support/auth-commands.ts +++ b/e2e/cypress/support/auth-commands.ts @@ -86,8 +86,9 @@ Cypress.Commands.add('createGateway', (gatewayid?: string, displayname?: string) } cy.setHeaders({ 'Content-Type': 'application/json' }) cy.setRequestBody(payload) - cy.callAPI('ds/api/v3/gateways', 'POST').then( + return cy.callAPI('ds/api/v3/gateways', 'POST').then( ({ apiRes: { body, status } }: any) => { + cy.log(JSON.stringify(body, null, 2)) expect(status).to.be.equal(200) if (payload.gatewayId) { expect(body.gatewayId).to.be.equal(payload.gatewayId) @@ -95,6 +96,7 @@ Cypress.Commands.add('createGateway', (gatewayid?: string, displayname?: string) if (payload.displayName) { expect(body.displayName).to.be.equal(payload.displayName) } + return cy.wrap(body) } ) }) @@ -117,6 +119,7 @@ query GetNamespaces { } } ` + cy.log('< Activating namespace - ' + gatewayId) // get the (true) id for the namespace cy.setHeaders({ 'Content-Type': 'application/json' }) return cy.gqlQuery(getAllNsQuery).then((response) => { @@ -127,7 +130,6 @@ query GetNamespaces { throw new Error('Namespace not found') } }).then((namespaceId) => { - cy.log(`The namespace ID is: ${namespaceId}`) // then activate the namespace cy.setHeaders({ 'Content-Type': 'application/json' }) cy.callAPI(`admin/switch/${namespaceId}`, 'PUT') diff --git a/e2e/cypress/tests/02-client-credential-flow/01-client-cred-team-access.cy.ts b/e2e/cypress/tests/02-client-credential-flow/01-client-cred-team-access.cy.ts index d7d8341d8..5e9bc365e 100644 --- a/e2e/cypress/tests/02-client-credential-flow/01-client-cred-team-access.cy.ts +++ b/e2e/cypress/tests/02-client-credential-flow/01-client-cred-team-access.cy.ts @@ -24,37 +24,24 @@ describe('Grant appropriate permissions to team members for client credential fl }) it('authenticates Janis (api owner) to get the user session token', () => { - cy.get('@apiowner').then(({ apiTest }: any) => { - cy.getUserSessionTokenValue(apiTest.namespace, false).then((value) => { + cy.get('@apiowner').then(({ clientCredentials }: any) => { + cy.getUserSessionTokenValue(clientCredentials.namespace, false).then((value) => { userSession = value }) }) }) - it('Set token with gwa config command', () => { - cy.exec('gwa config set --token ' + userSession, { timeout: 3000, failOnNonZeroExit: false }).then((response) => { - expect(response.stdout).to.contain("Config settings saved") - }); - }) - - it('create namespace using gwa cli command', () => { - var cleanedUrl = Cypress.env('BASE_URL').replace(/^http?:\/\//i, ""); - cy.exec('gwa gateway create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 5000, failOnNonZeroExit: false }).then((response) => { - debugger - assert.isNotNaN(response.stdout) - namespace = response.stdout + it('Create new namespace and activate it', () => { + cy.createGateway().then((response) => { + namespace = response.gatewayId + cy.log('New namespace created: ' + namespace) cy.replaceWordInJsonObject('ccplatform', namespace, 'cc-service-gwa.yml') cy.updateJsonValue('common-testdata.json', 'clientCredentials.namespace', namespace) - // cy.updateJsonValue('apiowner.json', 'clientCredentials.clientIdSecret.product.environment.name.config.serviceName', 'cc-service-for-' + namespace) - cy.executeCliCommand("gwa config set --gateway " + namespace) - }); - }) - - it('activates new namespace', () => { - cy.activateGateway(namespace) + cy.updateJsonValue('apiowner.json', 'clientCredentials.namespace', namespace) + cy.activateGateway(namespace) + }) }) - it('Grant namespace access to access manager(Mark)', () => { cy.get('@apiowner').then(({ clientCredentials }: any) => { cy.visit(na.path) diff --git a/e2e/cypress/tests/02-client-credential-flow/03-client-cred-create-api-prod-auth-pro.cy.ts b/e2e/cypress/tests/02-client-credential-flow/03-client-cred-create-api-prod-auth-pro.cy.ts index 3bd594303..9f8e32318 100644 --- a/e2e/cypress/tests/02-client-credential-flow/03-client-cred-create-api-prod-auth-pro.cy.ts +++ b/e2e/cypress/tests/02-client-credential-flow/03-client-cred-create-api-prod-auth-pro.cy.ts @@ -31,8 +31,8 @@ describe('Create API, Product, and Authorization Profiles; Apply Auth Profiles t }) it('authenticates Janis (api owner) to get the user session token', () => { - cy.get('@common-testdata').then(({ apiTest }: any) => { - cy.getUserSessionTokenValue(apiTest.namespace, false).then((value) => { + cy.get('@common-testdata').then(({ clientCredentials }: any) => { + cy.getUserSessionTokenValue(clientCredentials.namespace, false).then((value) => { userSession = value }) }) @@ -43,9 +43,9 @@ describe('Create API, Product, and Authorization Profiles; Apply Auth Profiles t cy.get('@common-testdata').then(({ clientCredentials }: any) => { nameSpace = clientCredentials.namespace cy.activateGateway(clientCredentials.namespace) - cy.get('@login').then(function (xhr: any) { - userSession = xhr.response.headers['x-auth-request-access-token'] - }) + // cy.get('@login').then(function (xhr: any) { + // userSession = xhr.response.headers['x-auth-request-access-token'] + // }) }) }) }) @@ -83,7 +83,7 @@ describe('Create API, Product, and Authorization Profiles; Apply Auth Profiles t cy.get('@api').then(({ organization }: any) => { cy.setHeaders(organization.headers) cy.setAuthorizationToken(userSession) - cy.makeAPIRequest(organization.endPoint + '/' + organization.orgName + '/' + organization.orgExpectedList.name + '/namespaces/' + nameSpace, 'PUT').then((response:any) => { + cy.makeAPIRequest(organization.endPoint + '/' + organization.orgName + '/' + organization.orgExpectedList.name + '/gateways/' + nameSpace, 'PUT').then((response:any) => { expect(response.apiRes.status).to.be.equal(200) }) }) diff --git a/e2e/cypress/tests/10-clear-resources/01-create-api.cy.ts b/e2e/cypress/tests/10-clear-resources/01-create-api.cy.ts index 727b586f6..7428b97dd 100644 --- a/e2e/cypress/tests/10-clear-resources/01-create-api.cy.ts +++ b/e2e/cypress/tests/10-clear-resources/01-create-api.cy.ts @@ -83,7 +83,7 @@ describe('Create API Spec for Delete Resources', () => { cy.get('@api').then(({ organization }: any) => { cy.setHeaders(organization.headers) cy.setAuthorizationToken(userSession) - cy.makeAPIRequest(organization.endPoint + '/' + organization.orgName + '/' + organization.orgExpectedList.name + '/namespaces/' + namespace, 'PUT').then((response:any) => { + cy.makeAPIRequest(organization.endPoint + '/' + organization.orgName + '/' + organization.orgExpectedList.name + '/gateways/' + namespace, 'PUT').then((response:any) => { expect(response.apiRes.status).to.be.equal(200) }) }) diff --git a/e2e/cypress/tests/12-access-permission/01-create-api.cy.ts b/e2e/cypress/tests/12-access-permission/01-create-api.cy.ts index 8a585ae21..6f54742bd 100644 --- a/e2e/cypress/tests/12-access-permission/01-create-api.cy.ts +++ b/e2e/cypress/tests/12-access-permission/01-create-api.cy.ts @@ -81,7 +81,7 @@ describe('Create API Spec', () => { cy.get('@api').then(({ organization }: any) => { cy.setHeaders(organization.headers) cy.setAuthorizationToken(userSession) - cy.makeAPIRequest(organization.endPoint + '/' + organization.orgName + '/' + organization.orgExpectedList.name + '/namespaces/' + namespace, 'PUT').then((response:any) => { + cy.makeAPIRequest(organization.endPoint + '/' + organization.orgName + '/' + organization.orgExpectedList.name + '/gateways/' + namespace, 'PUT').then((response:any) => { expect(response.apiRes.status).to.be.equal(200) }) }) diff --git a/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts b/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts index 538537ea4..756597a38 100644 --- a/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts +++ b/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts @@ -60,7 +60,7 @@ describe('Create API Spec', () => { cy.get('@api').then(({ organization }: any) => { cy.setHeaders(organization.headers) cy.setAuthorizationToken(userSession) - cy.makeAPIRequest(organization.endPoint + '/' + organization.orgName + '/' + organization.orgExpectedList.name + '/namespaces/' + namespace, 'PUT').then((response:any) => { + cy.makeAPIRequest(organization.endPoint + '/' + organization.orgName + '/' + organization.orgExpectedList.name + '/gateways/' + namespace, 'PUT').then((response:any) => { expect(response.apiRes.status).to.be.equal(200) }) }) diff --git a/e2e/cypress/tests/15-aps-api/02-organization.cy.ts b/e2e/cypress/tests/15-aps-api/02-organization.cy.ts index 989a099f5..0945a38fc 100644 --- a/e2e/cypress/tests/15-aps-api/02-organization.cy.ts +++ b/e2e/cypress/tests/15-aps-api/02-organization.cy.ts @@ -204,7 +204,7 @@ describe('Delete the Namespace associated with the organization', () => { it('Delete the namespace associated with the organization, organization unit and verify the success code in the response', () => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.get('@api').then(({ organization }: any) => { - cy.makeAPIRequest(organization.endPoint + '/' + organization.orgName + '/' + organization.orgExpectedList.name + '/namespaces/' + nameSpace, 'DELETE').then((res:any) => { + cy.makeAPIRequest(organization.endPoint + '/' + organization.orgName + '/' + organization.orgExpectedList.name + '/gateways/' + nameSpace, 'DELETE').then((res:any) => { expect(res.apiRes.status).to.be.equal(200) cy.addToAstraScanIdList(res.astraRes.body.status) response = res.apiRes.body From 09bfccb88584718f2e3868947e07833f3620438e Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Wed, 10 Jul 2024 16:41:39 -0700 Subject: [PATCH 14/54] upload JSON report to GH --- .github/workflows/aps-cypress-e2e.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/aps-cypress-e2e.yaml b/.github/workflows/aps-cypress-e2e.yaml index 1f8a82cfe..05f74427d 100644 --- a/.github/workflows/aps-cypress-e2e.yaml +++ b/.github/workflows/aps-cypress-e2e.yaml @@ -58,12 +58,18 @@ jobs: fi done - - name: Upload E2E Test Results Report + - name: Upload E2E Test Results HTML Report uses: actions/upload-artifact@v2 with: - name: test-results + name: test-results-html path: ${{ github.workspace }}/e2e/results/report + - name: Upload E2E Test Results JSON Report + uses: actions/upload-artifact@v2 + with: + name: test-results-json + path: ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json + - name: Upload E2E Code Coverage Report uses: actions/upload-artifact@v2 with: From d597b126cbeeaf99d9cb3eb9c223f0cfc14b1bfb Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Thu, 11 Jul 2024 06:43:50 -0700 Subject: [PATCH 15/54] createGateway w/ API instead of cli --- .../tests/09-update-product-env/09-two-tiered-hidden.cy.ts | 4 +--- e2e/cypress/tests/12-access-permission/01-create-api.cy.ts | 7 +++---- .../tests/13-namespace-preview-mode/01-create-api.cy.ts | 7 +++---- .../tests/14-org-assignment/01-client-cred-team-access.ts | 7 +++---- .../14-org-assignment/03-verify-org-admin-member-org.ts | 7 +++---- .../05-verify-org-admin-member-org-unit.ts | 7 +++---- e2e/cypress/tests/15-aps-api/01-create-api.cy.ts | 7 +++---- 7 files changed, 19 insertions(+), 27 deletions(-) diff --git a/e2e/cypress/tests/09-update-product-env/09-two-tiered-hidden.cy.ts b/e2e/cypress/tests/09-update-product-env/09-two-tiered-hidden.cy.ts index ad2f9ed86..8914a0474 100644 --- a/e2e/cypress/tests/09-update-product-env/09-two-tiered-hidden.cy.ts +++ b/e2e/cypress/tests/09-update-product-env/09-two-tiered-hidden.cy.ts @@ -50,9 +50,7 @@ describe('Verify Two Tiered Hidden', () => { it('create namespace with cli', () => { cy.get('@common-testdata').then(({ twoTieredHidden }: any) => { cy.executeCliCommand( - 'gwa gateway create --gateway-id ' + - twoTieredHidden.namespace + - ' --description="Two Tiered Hidden"' + 'gwa gateway create --gateway-id ' + twoTieredHidden.namespace + ' --display-name="Two Tiered Hidden"' ).then((response) => { expect(response.stdout).to.contain(twoTieredHidden.namespace) }) diff --git a/e2e/cypress/tests/12-access-permission/01-create-api.cy.ts b/e2e/cypress/tests/12-access-permission/01-create-api.cy.ts index 6f54742bd..f53346bbe 100644 --- a/e2e/cypress/tests/12-access-permission/01-create-api.cy.ts +++ b/e2e/cypress/tests/12-access-permission/01-create-api.cy.ts @@ -41,10 +41,9 @@ describe('Create API Spec', () => { }) it('create namespace using gwa cli command', () => { - var cleanedUrl = Cypress.env('BASE_URL').replace(/^http?:\/\//i, ""); - cy.exec('gwa gateway create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { - assert.isNotNaN(response.stdout) - namespace = response.stdout + cy.createGateway().then((response) => { + namespace = response.gatewayId + cy.log('New namespace created: ' + namespace) cy.replaceWordInJsonObject('ns.permission', 'ns.' + namespace, 'service-permission-gwa.yml') cy.updateJsonValue('common-testdata.json', 'checkPermission.namespace', namespace) // cy.updateJsonValue('apiowner.json', 'clientCredentials.clientIdSecret.product.environment.name.config.serviceName', 'cc-service-for-' + namespace) diff --git a/e2e/cypress/tests/13-namespace-preview-mode/01-create-api.cy.ts b/e2e/cypress/tests/13-namespace-preview-mode/01-create-api.cy.ts index 23933b01a..2fd1ee925 100644 --- a/e2e/cypress/tests/13-namespace-preview-mode/01-create-api.cy.ts +++ b/e2e/cypress/tests/13-namespace-preview-mode/01-create-api.cy.ts @@ -41,10 +41,9 @@ describe('Create API Spec', () => { }) it('create namespace using gwa cli command', () => { - var cleanedUrl = Cypress.env('BASE_URL').replace(/^http?:\/\//i, ""); - cy.exec('gwa gateway create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { - assert.isNotNaN(response.stdout) - namespace = response.stdout + cy.createGateway().then((response) => { + namespace = response.gatewayId + cy.log('New namespace created: ' + namespace) cy.updateJsonValue('common-testdata.json', 'namespacePreview.namespace', namespace) // cy.updateJsonValue('apiowner.json', 'clientCredentials.clientIdSecret.product.environment.name.config.serviceName', 'cc-service-for-' + namespace) cy.executeCliCommand("gwa config set --gateway " + namespace) diff --git a/e2e/cypress/tests/14-org-assignment/01-client-cred-team-access.ts b/e2e/cypress/tests/14-org-assignment/01-client-cred-team-access.ts index 0b205f566..2b3384324 100644 --- a/e2e/cypress/tests/14-org-assignment/01-client-cred-team-access.ts +++ b/e2e/cypress/tests/14-org-assignment/01-client-cred-team-access.ts @@ -49,10 +49,9 @@ describe('Add Organization to publish API', () => { }) it('create namespace using gwa cli command', () => { - var cleanedUrl = Cypress.env('BASE_URL').replace(/^http?:\/\//i, ""); - cy.exec('gwa gateway create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { - assert.isNotNaN(response.stdout) - namespace = response.stdout + cy.createGateway().then((response) => { + namespace = response.gatewayId + cy.log('New namespace created: ' + namespace) cy.updateJsonValue('common-testdata.json', 'orgAssignment.namespace', namespace) // cy.updateJsonValue('apiowner.json', 'clientCredentials.clientIdSecret.product.environment.name.config.serviceName', 'cc-service-for-' + namespace) cy.executeCliCommand("gwa config set --gateway " + namespace) diff --git a/e2e/cypress/tests/14-org-assignment/03-verify-org-admin-member-org.ts b/e2e/cypress/tests/14-org-assignment/03-verify-org-admin-member-org.ts index 86fac9fef..5e8898007 100644 --- a/e2e/cypress/tests/14-org-assignment/03-verify-org-admin-member-org.ts +++ b/e2e/cypress/tests/14-org-assignment/03-verify-org-admin-member-org.ts @@ -43,10 +43,9 @@ describe('Multiple Org Adming for the organization', () => { }) it('create namespace using gwa cli command', () => { - var cleanedUrl = Cypress.env('BASE_URL').replace(/^http?:\/\//i, ""); - cy.exec('gwa gateway create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { - assert.isNotNaN(response.stdout) - namespace = response.stdout + cy.createGateway().then((response) => { + namespace = response.gatewayId + cy.log('New namespace created: ' + namespace) cy.updateJsonValue('common-testdata.json', 'orgAssignment.namespace', namespace) // cy.updateJsonValue('apiowner.json', 'clientCredentials.clientIdSecret.product.environment.name.config.serviceName', 'cc-service-for-' + namespace) cy.executeCliCommand("gwa config set --gateway " + namespace) diff --git a/e2e/cypress/tests/14-org-assignment/05-verify-org-admin-member-org-unit.ts b/e2e/cypress/tests/14-org-assignment/05-verify-org-admin-member-org-unit.ts index 5ae45c8e7..bb8669b08 100644 --- a/e2e/cypress/tests/14-org-assignment/05-verify-org-admin-member-org-unit.ts +++ b/e2e/cypress/tests/14-org-assignment/05-verify-org-admin-member-org-unit.ts @@ -42,10 +42,9 @@ describe('Multiple Org Admin for the organization', () => { }) it('create namespace using gwa cli command', () => { - var cleanedUrl = Cypress.env('BASE_URL').replace(/^http?:\/\//i, ""); - cy.exec('gwa gateway create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { - assert.isNotNaN(response.stdout) - namespace = response.stdout + cy.createGateway().then((response) => { + namespace = response.gatewayId + cy.log('New namespace created: ' + namespace) cy.updateJsonValue('common-testdata.json', 'orgAssignment.namespace', namespace) // cy.updateJsonValue('apiowner.json', 'clientCredentials.clientIdSecret.product.environment.name.config.serviceName', 'cc-service-for-' + namespace) cy.executeCliCommand("gwa config set --gateway " + namespace) diff --git a/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts b/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts index 756597a38..edef12e6a 100644 --- a/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts +++ b/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts @@ -41,10 +41,9 @@ describe('Create API Spec', () => { }) it('create namespace using gwa cli command', () => { - var cleanedUrl = Cypress.env('BASE_URL').replace(/^http?:\/\//i, ""); - cy.exec('gwa gateway create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { - assert.isNotNaN(response.stdout) - namespace = response.stdout + cy.createGateway().then((response) => { + namespace = response.gatewayId + cy.log('New namespace created: ' + namespace) cy.updateJsonValue('common-testdata.json', 'apiTest.namespace', namespace) cy.updateJsonValue('api.json', 'organization.expectedNamespace.name', namespace) // cy.updateJsonValue('apiowner.json', 'clientCredentials.clientIdSecret.product.environment.name.config.serviceName', 'cc-service-for-' + namespace) From d8b968b674b9c14e8fa4b1e555a3850d530c5e7a Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Thu, 11 Jul 2024 16:38:39 -0700 Subject: [PATCH 16/54] visit after activateGateway to fetch session --- e2e/cypress/support/auth-commands.ts | 12 ++++++++---- .../05-migrate-user/01-migrate-user-access.cy.ts | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/e2e/cypress/support/auth-commands.ts b/e2e/cypress/support/auth-commands.ts index f2705616a..06df91412 100644 --- a/e2e/cypress/support/auth-commands.ts +++ b/e2e/cypress/support/auth-commands.ts @@ -270,10 +270,14 @@ Cypress.Commands.add('logout', () => { cy.log('< Logging out') cy.getSession().then(() => { cy.get('@session').then((res: any) => { - cy.visit('/') - // cy.wait(3000) - cy.get('[data-testid=auth-menu-user]').click({ force: true }) - cy.get('[data-testid=auth-menu-signout-btn]').click({ force: true }) + cy.visit('/').then(() => { + cy.get('body').then($body => { + if ($body.find('[data-testid=auth-menu-user]').length) { + cy.get('[data-testid=auth-menu-user]').click(); + cy.get('[data-testid=auth-menu-signout-btn]').click(); + } + }); + }) }) }) cy.log('> Logging out') diff --git a/e2e/cypress/tests/05-migrate-user/01-migrate-user-access.cy.ts b/e2e/cypress/tests/05-migrate-user/01-migrate-user-access.cy.ts index 480054f56..6b20a871a 100644 --- a/e2e/cypress/tests/05-migrate-user/01-migrate-user-access.cy.ts +++ b/e2e/cypress/tests/05-migrate-user/01-migrate-user-access.cy.ts @@ -113,6 +113,7 @@ describe('Verify that permission of old user is migrated to new user', () => { cy.getUserSession().then(() => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.activateGateway(namespace) + cy.visit('/') cy.get('@login').then(function (xhr: any) { userScopes = xhr.response.body.user.scopes }) From e35c85c2668168c080aa64452e37b48247f7877d Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Fri, 12 Jul 2024 08:38:10 -0700 Subject: [PATCH 17/54] env var for disabling Astra on API requests --- e2e/cypress.config.ts | 1 + e2e/cypress/support/auth-commands.ts | 39 +++++++++++++++++++--------- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/e2e/cypress.config.ts b/e2e/cypress.config.ts index 1041093a2..56bfe6029 100644 --- a/e2e/cypress.config.ts +++ b/e2e/cypress.config.ts @@ -58,6 +58,7 @@ export default defineConfig({ }, chromeWebSecurity: false, env: { + ASTRA_SCAN_ENABLED: true, CLIENT_ID: 'aps-portal', CLIENT_SECRET: '8e1a17ed-cb93-4806-ac32-e303d1c86018', OIDC_ISSUER: 'http://keycloak.localtest.me:9081/auth/realms/master', diff --git a/e2e/cypress/support/auth-commands.ts b/e2e/cypress/support/auth-commands.ts index 06df91412..5ed2ac6b7 100644 --- a/e2e/cypress/support/auth-commands.ts +++ b/e2e/cypress/support/auth-commands.ts @@ -565,14 +565,32 @@ Cypress.Commands.add('makeAPIRequest', (endPoint: string, methodType: string) => requestData['method'] = methodType // Scan request with Astra - cy.request({ - url: 'http://astra.localtest.me:8094/scan/', - method: 'POST', - body: requestData, - headers: headers, - failOnStatusCode: false, - }).then((astraResponse) => { - // Actual API request + if (Cypress.env('ASTRA_SCAN_ENABLED') == 'true') { + cy.request({ + url: 'http://astra.localtest.me:8094/scan/', + method: 'POST', + body: requestData, + headers: headers, + failOnStatusCode: false, + }).then((astraResponse) => { + // Actual API request + cy.request({ + url: Cypress.env('BASE_URL') + '/' + endPoint, + method: methodType, + body: body, + headers: headers, + failOnStatusCode: false, + }).then((apiResponse) => { + // You can also return data or use it in further tests + const responseData = { + astraRes: astraResponse, + apiRes: apiResponse, + } + // cy.addToAstraScanIdList(response2.body.status) + return responseData + }) + }) + } else { cy.request({ url: Cypress.env('BASE_URL') + '/' + endPoint, method: methodType, @@ -580,15 +598,12 @@ Cypress.Commands.add('makeAPIRequest', (endPoint: string, methodType: string) => headers: headers, failOnStatusCode: false, }).then((apiResponse) => { - // You can also return data or use it in further tests const responseData = { - astraRes: astraResponse, apiRes: apiResponse, } - // cy.addToAstraScanIdList(response2.body.status) return responseData }) - }) + } }) Cypress.Commands.add('gqlQuery', (query, variables = {}) => { From 2546a4aa44bf001c21c69fa8bd81b35fdb0a53c3 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Fri, 12 Jul 2024 09:10:29 -0700 Subject: [PATCH 18/54] revert logout to include wait --- e2e/cypress/support/auth-commands.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/e2e/cypress/support/auth-commands.ts b/e2e/cypress/support/auth-commands.ts index 5ed2ac6b7..80597b950 100644 --- a/e2e/cypress/support/auth-commands.ts +++ b/e2e/cypress/support/auth-commands.ts @@ -270,14 +270,10 @@ Cypress.Commands.add('logout', () => { cy.log('< Logging out') cy.getSession().then(() => { cy.get('@session').then((res: any) => { - cy.visit('/').then(() => { - cy.get('body').then($body => { - if ($body.find('[data-testid=auth-menu-user]').length) { - cy.get('[data-testid=auth-menu-user]').click(); - cy.get('[data-testid=auth-menu-signout-btn]').click(); - } - }); - }) + cy.visit('/') + cy.wait(3000) + cy.get('[data-testid=auth-menu-user]').click({ force: true }) + cy.get('[data-testid=auth-menu-signout-btn]').click({ force: true }) }) }) cy.log('> Logging out') From 8f211aa3d0774dcace9749461ece20b0f14dedf6 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Fri, 12 Jul 2024 10:37:13 -0700 Subject: [PATCH 19/54] use cy.request in getUserSession --- e2e/cypress/support/auth-commands.ts | 10 +++++++++- e2e/cypress/support/global.d.ts | 2 ++ e2e/cypress/tests/01-api-key/01-create-api.cy.ts | 2 +- ...03-client-cred-create-api-prod-auth-pro.cy.ts | 2 +- .../05-migrate-user/01-migrate-user-access.cy.ts | 16 +++++++--------- .../01-client-credential-to-kong-acl-api.cy.ts | 2 +- .../09-update-product-env/06-shared-idp.cy.ts | 4 ++-- .../09-update-product-env/07-kong-public-auth.ts | 2 +- .../08-protected-externally.ts | 2 +- .../09-two-tiered-hidden.cy.ts | 2 +- .../tests/10-clear-resources/01-create-api.cy.ts | 9 ++++----- .../02-activity-feed-failure.cy.ts | 2 +- .../12-access-permission/01-create-api.cy.ts | 2 +- .../01-create-api.cy.ts | 2 +- .../01-client-cred-team-access.ts | 2 +- .../03-verify-org-admin-member-org.ts | 2 +- .../05-verify-org-admin-member-org-unit.ts | 2 +- e2e/cypress/tests/15-aps-api/01-create-api.cy.ts | 2 +- e2e/cypress/tests/15-aps-api/06-products.cy.ts | 2 +- e2e/cypress/tests/16-gwa-cli/01-cli-commands.ts | 11 +++++++++-- .../04-delete-namespace-gwa.ts | 13 ++++++++++--- 21 files changed, 57 insertions(+), 36 deletions(-) diff --git a/e2e/cypress/support/auth-commands.ts b/e2e/cypress/support/auth-commands.ts index 80597b950..22580a5ca 100644 --- a/e2e/cypress/support/auth-commands.ts +++ b/e2e/cypress/support/auth-commands.ts @@ -190,7 +190,7 @@ Cypress.Commands.add( cy.fixture('apiowner').as('apiowner') cy.preserveCookies() cy.visit(login.path) - cy.getUserSession().then(() => { + cy.interceptUserSession().then(() => { cy.get('@apiowner').then(({ user }: any) => { cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') @@ -635,6 +635,14 @@ Cypress.Commands.add('makeAPIRequestForScanResult', (scanID: string) => { }) Cypress.Commands.add('getUserSession', () => { + cy.request({ + method: 'GET', + url: Cypress.config('baseUrl') + '/admin/session', + failOnStatusCode: true + }).as('login') +}); + +Cypress.Commands.add('interceptUserSession', () => { cy.intercept(Cypress.config('baseUrl') + '/admin/session').as('login') }) diff --git a/e2e/cypress/support/global.d.ts b/e2e/cypress/support/global.d.ts index 2a60ddef9..88486ef10 100644 --- a/e2e/cypress/support/global.d.ts +++ b/e2e/cypress/support/global.d.ts @@ -92,6 +92,8 @@ declare namespace Cypress { makeAPIRequest(endPoint: string, methodType: string): Chainable> getUserSession(): Chainable> + + interceptUserSession(): Chainable> compareJSONObjects( actualResponse: any, diff --git a/e2e/cypress/tests/01-api-key/01-create-api.cy.ts b/e2e/cypress/tests/01-api-key/01-create-api.cy.ts index 04b7180b4..1c29bfbad 100644 --- a/e2e/cypress/tests/01-api-key/01-create-api.cy.ts +++ b/e2e/cypress/tests/01-api-key/01-create-api.cy.ts @@ -59,7 +59,7 @@ describe('Create API Spec', () => { expect($el).contain(namespace) }) cy.get('@login').then(function (xhr: any) { - userSession = xhr.response.headers['x-auth-request-access-token'] + userSession = xhr.headers['x-auth-request-access-token'] }) }) }) diff --git a/e2e/cypress/tests/02-client-credential-flow/03-client-cred-create-api-prod-auth-pro.cy.ts b/e2e/cypress/tests/02-client-credential-flow/03-client-cred-create-api-prod-auth-pro.cy.ts index 9f8e32318..00e9fa540 100644 --- a/e2e/cypress/tests/02-client-credential-flow/03-client-cred-create-api-prod-auth-pro.cy.ts +++ b/e2e/cypress/tests/02-client-credential-flow/03-client-cred-create-api-prod-auth-pro.cy.ts @@ -44,7 +44,7 @@ describe('Create API, Product, and Authorization Profiles; Apply Auth Profiles t nameSpace = clientCredentials.namespace cy.activateGateway(clientCredentials.namespace) // cy.get('@login').then(function (xhr: any) { - // userSession = xhr.response.headers['x-auth-request-access-token'] + // userSession = xhr.headers['x-auth-request-access-token'] // }) }) }) diff --git a/e2e/cypress/tests/05-migrate-user/01-migrate-user-access.cy.ts b/e2e/cypress/tests/05-migrate-user/01-migrate-user-access.cy.ts index 6b20a871a..ff2a15e09 100644 --- a/e2e/cypress/tests/05-migrate-user/01-migrate-user-access.cy.ts +++ b/e2e/cypress/tests/05-migrate-user/01-migrate-user-access.cy.ts @@ -96,7 +96,7 @@ describe('Verify that permission of old user is migrated to new user', () => { cy.visit(login.path) }) - it('authenticates with new user', () => { + it.only('authenticates with new user', () => { cy.get('@usermigration').then(({ newUser }: any) => { cy.login(newUser.credentials.username, newUser.credentials.password) cy.log('Logged in!') @@ -109,14 +109,12 @@ describe('Verify that permission of old user is migrated to new user', () => { // }) // }) - it('Get the permission of the user', () => { - cy.getUserSession().then(() => { - cy.get('@common-testdata').then(({ namespace }: any) => { - cy.activateGateway(namespace) - cy.visit('/') - cy.get('@login').then(function (xhr: any) { - userScopes = xhr.response.body.user.scopes - }) + it.only('Get the permission of the user', () => { + cy.get('@common-testdata').then(({ namespace }: any) => { + cy.activateGateway(namespace) + cy.getUserSession() + cy.get('@login').then(function (xhr: any) { + userScopes = xhr.body.user.scopes }) }) }) diff --git a/e2e/cypress/tests/09-update-product-env/01-client-credential-to-kong-acl-api.cy.ts b/e2e/cypress/tests/09-update-product-env/01-client-credential-to-kong-acl-api.cy.ts index d8f4fce69..83a1a7a7a 100644 --- a/e2e/cypress/tests/09-update-product-env/01-client-credential-to-kong-acl-api.cy.ts +++ b/e2e/cypress/tests/09-update-product-env/01-client-credential-to-kong-acl-api.cy.ts @@ -45,7 +45,7 @@ describe('Change Authorization profile', () => { nameSpace = clientCredentials.namespace cy.activateGateway(clientCredentials.namespace) cy.get('@login').then(function (xhr: any) { - userSession = xhr.response.headers['x-auth-request-access-token'] + userSession = xhr.headers['x-auth-request-access-token'] }) }) }) diff --git a/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts b/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts index d0d54de34..d7a23329e 100644 --- a/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts +++ b/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts @@ -39,7 +39,7 @@ describe('Apply Shared IDP while creating Authorization Profile', () => { cy.login(user.credentials.username, user.credentials.password) cy.activateGateway(namespace) cy.get('@login').then(function (xhr: any) { - userSession = xhr.response.headers['x-auth-request-access-token'] + userSession = xhr.headers['x-auth-request-access-token'] }) }) }) @@ -104,7 +104,7 @@ describe('Update IDP issuer for shared IDP profile', () => { cy.login(user.credentials.username, user.credentials.password) cy.activateGateway(namespace) cy.get('@login').then(function (xhr: any) { - userSession = xhr.response.headers['x-auth-request-access-token'] + userSession = xhr.headers['x-auth-request-access-token'] }) }) }) diff --git a/e2e/cypress/tests/09-update-product-env/07-kong-public-auth.ts b/e2e/cypress/tests/09-update-product-env/07-kong-public-auth.ts index a596c70b1..70074aec2 100644 --- a/e2e/cypress/tests/09-update-product-env/07-kong-public-auth.ts +++ b/e2e/cypress/tests/09-update-product-env/07-kong-public-auth.ts @@ -45,7 +45,7 @@ describe('Verify for Kong Public Auth', () => { nameSpace = clientCredentials.namespace cy.activateGateway(clientCredentials.namespace) cy.get('@login').then(function (xhr: any) { - userSession = xhr.response.headers['x-auth-request-access-token'] + userSession = xhr.headers['x-auth-request-access-token'] }) }) }) diff --git a/e2e/cypress/tests/09-update-product-env/08-protected-externally.ts b/e2e/cypress/tests/09-update-product-env/08-protected-externally.ts index 449271d3a..de5667207 100644 --- a/e2e/cypress/tests/09-update-product-env/08-protected-externally.ts +++ b/e2e/cypress/tests/09-update-product-env/08-protected-externally.ts @@ -36,7 +36,7 @@ describe('Verify Protected Externally Auth', () => { nameSpace = clientCredentials.namespace cy.activateGateway(clientCredentials.namespace) cy.get('@login').then(function (xhr: any) { - userSession = xhr.response.headers['x-auth-request-access-token'] + userSession = xhr.headers['x-auth-request-access-token'] }) }) }) diff --git a/e2e/cypress/tests/09-update-product-env/09-two-tiered-hidden.cy.ts b/e2e/cypress/tests/09-update-product-env/09-two-tiered-hidden.cy.ts index 8914a0474..b02bf3447 100644 --- a/e2e/cypress/tests/09-update-product-env/09-two-tiered-hidden.cy.ts +++ b/e2e/cypress/tests/09-update-product-env/09-two-tiered-hidden.cy.ts @@ -69,7 +69,7 @@ describe('Verify Two Tiered Hidden', () => { nameSpace = twoTieredHidden.namespace cy.activateGateway(twoTieredHidden.namespace) cy.get('@login').then(function (xhr: any) { - userSession = xhr.response.headers['x-auth-request-access-token'] + userSession = xhr.headers['x-auth-request-access-token'] }) }) }) diff --git a/e2e/cypress/tests/10-clear-resources/01-create-api.cy.ts b/e2e/cypress/tests/10-clear-resources/01-create-api.cy.ts index 7428b97dd..7695b898c 100644 --- a/e2e/cypress/tests/10-clear-resources/01-create-api.cy.ts +++ b/e2e/cypress/tests/10-clear-resources/01-create-api.cy.ts @@ -40,11 +40,10 @@ describe('Create API Spec for Delete Resources', () => { }); }) - it('create namespace using gwa cli command', () => { - var cleanedUrl = Cypress.env('BASE_URL').replace(/^http?:\/\//i, ""); - cy.exec('gwa gateway create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { - assert.isNotNaN(response.stdout) - namespace = response.stdout + it('create namespace', () => { + cy.createGateway().then((response) => { + namespace = response.gatewayId + cy.log('New namespace created: ' + namespace) cy.replaceWordInJsonObject('ns.deleteplatform', 'ns.' + namespace, 'service-clear-resources-gwa.yml') cy.updateJsonValue('common-testdata.json', 'deleteResources.namespace', namespace) // cy.updateJsonValue('apiowner.json', 'clientCredentials.clientIdSecret.product.environment.name.config.serviceName', 'cc-service-for-' + namespace) diff --git a/e2e/cypress/tests/11-activity-feed/02-activity-feed-failure.cy.ts b/e2e/cypress/tests/11-activity-feed/02-activity-feed-failure.cy.ts index c7a764c89..047de8ab6 100644 --- a/e2e/cypress/tests/11-activity-feed/02-activity-feed-failure.cy.ts +++ b/e2e/cypress/tests/11-activity-feed/02-activity-feed-failure.cy.ts @@ -88,7 +88,7 @@ describe('Create API, Product, and Authorization Profiles; Apply Auth Profiles t nameSpace = clientCredentials.namespace cy.activateGateway(clientCredentials.namespace) cy.get('@login').then(function (xhr: any) { - userSession = xhr.response.headers['x-auth-request-access-token'] + userSession = xhr.headers['x-auth-request-access-token'] }) }) }) diff --git a/e2e/cypress/tests/12-access-permission/01-create-api.cy.ts b/e2e/cypress/tests/12-access-permission/01-create-api.cy.ts index f53346bbe..0f37dd9bc 100644 --- a/e2e/cypress/tests/12-access-permission/01-create-api.cy.ts +++ b/e2e/cypress/tests/12-access-permission/01-create-api.cy.ts @@ -40,7 +40,7 @@ describe('Create API Spec', () => { }); }) - it('create namespace using gwa cli command', () => { + it('create namespace', () => { cy.createGateway().then((response) => { namespace = response.gatewayId cy.log('New namespace created: ' + namespace) diff --git a/e2e/cypress/tests/13-namespace-preview-mode/01-create-api.cy.ts b/e2e/cypress/tests/13-namespace-preview-mode/01-create-api.cy.ts index 2fd1ee925..e312a01c0 100644 --- a/e2e/cypress/tests/13-namespace-preview-mode/01-create-api.cy.ts +++ b/e2e/cypress/tests/13-namespace-preview-mode/01-create-api.cy.ts @@ -40,7 +40,7 @@ describe('Create API Spec', () => { }); }) - it('create namespace using gwa cli command', () => { + it('create namespace', () => { cy.createGateway().then((response) => { namespace = response.gatewayId cy.log('New namespace created: ' + namespace) diff --git a/e2e/cypress/tests/14-org-assignment/01-client-cred-team-access.ts b/e2e/cypress/tests/14-org-assignment/01-client-cred-team-access.ts index 2b3384324..df01b3c92 100644 --- a/e2e/cypress/tests/14-org-assignment/01-client-cred-team-access.ts +++ b/e2e/cypress/tests/14-org-assignment/01-client-cred-team-access.ts @@ -48,7 +48,7 @@ describe('Add Organization to publish API', () => { }); }) - it('create namespace using gwa cli command', () => { + it('create namespace', () => { cy.createGateway().then((response) => { namespace = response.gatewayId cy.log('New namespace created: ' + namespace) diff --git a/e2e/cypress/tests/14-org-assignment/03-verify-org-admin-member-org.ts b/e2e/cypress/tests/14-org-assignment/03-verify-org-admin-member-org.ts index 5e8898007..23276daf4 100644 --- a/e2e/cypress/tests/14-org-assignment/03-verify-org-admin-member-org.ts +++ b/e2e/cypress/tests/14-org-assignment/03-verify-org-admin-member-org.ts @@ -42,7 +42,7 @@ describe('Multiple Org Adming for the organization', () => { }); }) - it('create namespace using gwa cli command', () => { + it('create namespace', () => { cy.createGateway().then((response) => { namespace = response.gatewayId cy.log('New namespace created: ' + namespace) diff --git a/e2e/cypress/tests/14-org-assignment/05-verify-org-admin-member-org-unit.ts b/e2e/cypress/tests/14-org-assignment/05-verify-org-admin-member-org-unit.ts index bb8669b08..8c0be9735 100644 --- a/e2e/cypress/tests/14-org-assignment/05-verify-org-admin-member-org-unit.ts +++ b/e2e/cypress/tests/14-org-assignment/05-verify-org-admin-member-org-unit.ts @@ -41,7 +41,7 @@ describe('Multiple Org Admin for the organization', () => { }); }) - it('create namespace using gwa cli command', () => { + it('create namespace', () => { cy.createGateway().then((response) => { namespace = response.gatewayId cy.log('New namespace created: ' + namespace) diff --git a/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts b/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts index edef12e6a..d141d7888 100644 --- a/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts +++ b/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts @@ -40,7 +40,7 @@ describe('Create API Spec', () => { }); }) - it('create namespace using gwa cli command', () => { + it('create namespace', () => { cy.createGateway().then((response) => { namespace = response.gatewayId cy.log('New namespace created: ' + namespace) diff --git a/e2e/cypress/tests/15-aps-api/06-products.cy.ts b/e2e/cypress/tests/15-aps-api/06-products.cy.ts index 9b049dc3c..0f4e07f6a 100644 --- a/e2e/cypress/tests/15-aps-api/06-products.cy.ts +++ b/e2e/cypress/tests/15-aps-api/06-products.cy.ts @@ -33,7 +33,7 @@ describe('Get the user session token to check ', () => { cy.activateGateway(apiTest.namespace) namespace = apiTest.namespace cy.get('@login').then(function (xhr: any) { - userSession = xhr.response.headers['x-auth-request-access-token'] + userSession = xhr.headers['x-auth-request-access-token'] }) }) }) diff --git a/e2e/cypress/tests/16-gwa-cli/01-cli-commands.ts b/e2e/cypress/tests/16-gwa-cli/01-cli-commands.ts index 3b2b484e5..6112a17a2 100644 --- a/e2e/cypress/tests/16-gwa-cli/01-cli-commands.ts +++ b/e2e/cypress/tests/16-gwa-cli/01-cli-commands.ts @@ -79,13 +79,20 @@ describe('Verify CLI commands', () => { it('Check gwa command to create namespace', () => { cy.executeCliCommand('gwa gateway create --generate --host ' + cleanedUrl + ' --scheme http').then((response) => { assert.isNotNaN(response.stdout) - namespace = response.stdout + // Use regex to extract the gateway ID + const match = response.stdout.match(/Gateway ID: ([\w-]+)/); + if (match && match[1]) { + namespace = match[1]; + assert.isNotNull(namespace); + } else { + throw new Error('Failed to extract Gateway ID from response: ' + response.stdout); + } }); }) it('Check gwa gateway list command and verify the created namespace in the list', () => { - cy.executeCliCommand('gwa gatway list --host ' + cleanedUrl + ' --scheme http').then((response) => { + cy.executeCliCommand('gwa gateway list --host ' + cleanedUrl + ' --scheme http').then((response) => { expect(response.stdout).to.contain(namespace); }); }) diff --git a/e2e/cypress/tests/17-delete-application/04-delete-namespace-gwa.ts b/e2e/cypress/tests/17-delete-application/04-delete-namespace-gwa.ts index 5883b05aa..143461f4e 100644 --- a/e2e/cypress/tests/17-delete-application/04-delete-namespace-gwa.ts +++ b/e2e/cypress/tests/17-delete-application/04-delete-namespace-gwa.ts @@ -36,13 +36,20 @@ describe('Verify namespace delete using gwa command', () => { var cleanedUrl = Cypress.env('BASE_URL').replace(/^http?:\/\//i, ""); cy.exec('gwa gateway create --generate --host ' + cleanedUrl + ' --scheme http', { timeout: 3000, failOnNonZeroExit: false }).then((response) => { assert.isNotNaN(response.stdout) - _namespace = response.stdout + // Use regex to extract the gateway ID + const match = response.stdout.match(/Gateway ID: ([\w-]+)/); + if (match && match[1]) { + _namespace = match[1]; + assert.isNotNull(_namespace); + } else { + throw new Error('Failed to extract Gateway ID from response: ' + response.stdout); + } }); - }) + }); it('Check gwa gateway destroy command for soft deleting namespace', () => { cy.executeCliCommand('gwa gateway destroy ' + _namespace).then((response) => { - expect(response.stdout).to.contain('Namespace destroyed: ' + _namespace); + expect(response.stdout).to.contain('Gateway destroyed: ' + _namespace); }); }) From db962d955cf78e4f3dfef5b519d163390c3405f9 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Fri, 12 Jul 2024 12:02:02 -0700 Subject: [PATCH 20/54] update paths to /api/v3 --- .../tests/09-update-product-env/06-shared-idp.cy.ts | 4 ++-- e2e/cypress/tests/15-aps-api/02-organization.cy.ts | 6 +++--- .../tests/15-aps-api/05-authorizationProfiles.cy.ts | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts b/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts index d7a23329e..d1e219b57 100644 --- a/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts +++ b/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts @@ -56,7 +56,7 @@ describe('Apply Shared IDP while creating Authorization Profile', () => { it('Publish the Shared IDP profile', () => { cy.get('@common-testdata').then(({ namespace }: any) => { - cy.makeAPIRequest('ds/api/v2/namespaces/' + namespace + '/issuers', 'PUT').then((response:any) => { + cy.makeAPIRequest('ds/api/v3/gateways/' + namespace + '/issuers', 'PUT').then((response:any) => { expect(response.apiRes.status).to.be.equal(200) expect(response.apiRes.body.result).to.be.contain('created') }) @@ -121,7 +121,7 @@ describe('Update IDP issuer for shared IDP profile', () => { it('Put the resource and verify the success code in the response', () => { cy.get('@common-testdata').then(({ namespace }: any) => { - cy.makeAPIRequest('ds/api/v2/namespaces/' + namespace + '/issuers', 'PUT').then((response:any) => { + cy.makeAPIRequest('ds/api/v3/gateways/' + namespace + '/issuers', 'PUT').then((response:any) => { expect(response.apiRes.status).to.be.equal(200) }) }) diff --git a/e2e/cypress/tests/15-aps-api/02-organization.cy.ts b/e2e/cypress/tests/15-aps-api/02-organization.cy.ts index 0945a38fc..1ff21b83a 100644 --- a/e2e/cypress/tests/15-aps-api/02-organization.cy.ts +++ b/e2e/cypress/tests/15-aps-api/02-organization.cy.ts @@ -36,7 +36,7 @@ describe('API Tests to verify the Organization details in the response', () => { beforeEach(() => { cy.preserveCookies() cy.fixture('api').as('api') - cy.request("ds/api/v2/organizations") + cy.request("ds/api/v3/organizations") }) it('Prepare the Request Specification for the API', () => { @@ -63,7 +63,7 @@ describe('Verify /Organization/{Org} end point', () => { beforeEach(() => { cy.preserveCookies() cy.fixture('api').as('api') - cy.request("ds/api/v2/organizations") + cy.request("ds/api/v3/organizations") }) it('Prepare the Request Specification for the API', () => { @@ -128,7 +128,7 @@ describe('Get the Organization Role', () => { }) it('Get the list of roles and verify the success code in the response', () => { - cy.makeAPIRequest('ds/api/v2/roles', 'GET').then((res:any) => { + cy.makeAPIRequest('ds/api/v3/roles', 'GET').then((res:any) => { expect(res.apiRes.status).to.be.equal(200) response = res.apiRes.body cy.addToAstraScanIdList(res.astraRes.body.status) diff --git a/e2e/cypress/tests/15-aps-api/05-authorizationProfiles.cy.ts b/e2e/cypress/tests/15-aps-api/05-authorizationProfiles.cy.ts index c939409ee..dd916ebf0 100644 --- a/e2e/cypress/tests/15-aps-api/05-authorizationProfiles.cy.ts +++ b/e2e/cypress/tests/15-aps-api/05-authorizationProfiles.cy.ts @@ -128,7 +128,7 @@ describe('API Tests for Authorization Profiles created with inheritFrom attribut it('Put the resource to create shared IDP profile and verify the success code in the response', () => { cy.get('@common-testdata').then(({ apiTest }: any) => { - cy.makeAPIRequest('ds/api/v2/namespaces/' + apiTest.namespace + '/issuers', 'PUT').then((response:any) => { + cy.makeAPIRequest('ds/api/v3/gateways/' + apiTest.namespace + '/issuers', 'PUT').then((response:any) => { expect(response.apiRes.status).to.be.equal(200) cy.addToAstraScanIdList(response.astraRes.body.status) }) @@ -145,7 +145,7 @@ describe('API Tests for Authorization Profiles created with inheritFrom attribut it('Create an authorization profile using inheritFrom attribute and verify the success code in the response', () => { cy.get('@common-testdata').then(({ apiTest }: any) => { - cy.makeAPIRequest('ds/api/v2/namespaces/' + apiTest.namespace + '/issuers', 'PUT').then((response:any) => { + cy.makeAPIRequest('ds/api/v3/gateways/' + apiTest.namespace + '/issuers', 'PUT').then((response:any) => { expect(response.apiRes.status).to.be.equal(200) cy.addToAstraScanIdList(response.astraRes.body.status) expect(response.apiRes.body.result).to.be.equal("created") @@ -155,7 +155,7 @@ describe('API Tests for Authorization Profiles created with inheritFrom attribut it('Get list of authorization profile and verify the success code in the response', () => { cy.get('@common-testdata').then(({ apiTest }: any) => { - cy.makeAPIRequest('ds/api/v2/namespaces/' + apiTest.namespace + '/issuers', 'GET').then((res:any) => { + cy.makeAPIRequest('ds/api/v3/gateways/' + apiTest.namespace + '/issuers', 'GET').then((res:any) => { expect(res.apiRes.status).to.be.equal(200) cy.addToAstraScanIdList(res.astraRes.body.status) response = res.apiRes.body @@ -195,7 +195,7 @@ describe('Published a shared authorization profile', () => { it('Create a shared credential issuer', () => { cy.get('@common-testdata').then(({ apiTest }: any) => { - cy.makeAPIRequest('ds/api/v2/namespaces/' + apiTest.namespace + '/issuers', 'PUT').then((response:any) => { + cy.makeAPIRequest('ds/api/v3/gateways/' + apiTest.namespace + '/issuers', 'PUT').then((response:any) => { expect(response.apiRes.status).to.be.equal(200) cy.addToAstraScanIdList(response.astraRes.body.status) expect(response.apiRes.body.result).to.be.equal("created") @@ -205,7 +205,7 @@ describe('Published a shared authorization profile', () => { it('Get list of authorization profile and verify the success code in the response', () => { cy.get('@common-testdata').then(({ apiTest }: any) => { - cy.makeAPIRequest('ds/api/v2/namespaces/' + apiTest.namespace + '/issuers', 'GET').then((res:any) => { + cy.makeAPIRequest('ds/api/v3/gateways/' + apiTest.namespace + '/issuers', 'GET').then((res:any) => { expect(res.apiRes.status).to.be.equal(200) cy.addToAstraScanIdList(res.astraRes.body.status) response = res.apiRes.body From f71bcfd4522e2c1b6853b970d691e9c6f7439101 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Fri, 12 Jul 2024 12:12:01 -0700 Subject: [PATCH 21/54] remove unused MyProfile page --- e2e/cypress/pageObjects/myProfile.ts | 15 --------------- .../12-access-permission/04-access-manager.cy.ts | 3 --- .../05-namespace-manage.cy.ts | 3 --- .../06-credential-issuer.cy.ts | 3 --- .../12-access-permission/07-namespace-view.cy.ts | 3 --- .../12-access-permission/08-gateway-config.cy.ts | 3 --- 6 files changed, 30 deletions(-) delete mode 100644 e2e/cypress/pageObjects/myProfile.ts diff --git a/e2e/cypress/pageObjects/myProfile.ts b/e2e/cypress/pageObjects/myProfile.ts deleted file mode 100644 index eb34b9f75..000000000 --- a/e2e/cypress/pageObjects/myProfile.ts +++ /dev/null @@ -1,15 +0,0 @@ -class MyProfilePage { - path: string = '/poc/my-profile' - userProfile: string = '[data-testid=my_profile_json]' - - checkScopeOfProfile(expScope : string): void { - var obj: any - let scope : string - cy.get(this.userProfile).then(($ele) => { - obj = JSON.parse($ele.get(0).innerText) - expect(obj.scopes[0]).eq(expScope) - }) - } -} - -export default MyProfilePage \ No newline at end of file diff --git a/e2e/cypress/tests/12-access-permission/04-access-manager.cy.ts b/e2e/cypress/tests/12-access-permission/04-access-manager.cy.ts index 71915ac5a..256459e7a 100644 --- a/e2e/cypress/tests/12-access-permission/04-access-manager.cy.ts +++ b/e2e/cypress/tests/12-access-permission/04-access-manager.cy.ts @@ -1,7 +1,6 @@ import LoginPage from '../../pageObjects/login' import HomePage from '../../pageObjects/home' import NamespaceAccessPage from '../../pageObjects/namespaceAccess' -import MyProfilePage from '../../pageObjects/myProfile' import ConsumersPage from '../../pageObjects/consumers' describe('Grant Access Manager Role', () => { @@ -50,7 +49,6 @@ describe('Verify that Mark is able to view the pending request', () => { const login = new LoginPage() const home = new HomePage() const consumers = new ConsumersPage() - const mp = new MyProfilePage() const na = new NamespaceAccessPage() @@ -73,7 +71,6 @@ describe('Verify that Mark is able to view the pending request', () => { cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') cy.activateGateway(checkPermission.namespace) - cy.visit(mp.path) }) }) }) diff --git a/e2e/cypress/tests/12-access-permission/05-namespace-manage.cy.ts b/e2e/cypress/tests/12-access-permission/05-namespace-manage.cy.ts index 165686df0..24845021a 100644 --- a/e2e/cypress/tests/12-access-permission/05-namespace-manage.cy.ts +++ b/e2e/cypress/tests/12-access-permission/05-namespace-manage.cy.ts @@ -1,7 +1,6 @@ import LoginPage from '../../pageObjects/login' import HomePage from '../../pageObjects/home' import NameSpacePage from '../../pageObjects/namespace' -import MyProfilePage from '../../pageObjects/myProfile' import ToolBar from '../../pageObjects/toolbar' import AuthorizationProfile from '../../pageObjects/authProfile' import NamespaceAccessPage from '../../pageObjects/namespaceAccess' @@ -55,7 +54,6 @@ describe('Verify that Wendy is able to see all the options for the Namespace', ( const login = new LoginPage() const home = new HomePage() const ns = new NameSpacePage() - const mp = new MyProfilePage() const tb = new ToolBar() const authProfile = new AuthorizationProfile() @@ -78,7 +76,6 @@ describe('Verify that Wendy is able to see all the options for the Namespace', ( cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') cy.activateGateway(checkPermission.namespace) - cy.visit(mp.path) }) }) }) diff --git a/e2e/cypress/tests/12-access-permission/06-credential-issuer.cy.ts b/e2e/cypress/tests/12-access-permission/06-credential-issuer.cy.ts index 41edbe719..6710c4f3e 100644 --- a/e2e/cypress/tests/12-access-permission/06-credential-issuer.cy.ts +++ b/e2e/cypress/tests/12-access-permission/06-credential-issuer.cy.ts @@ -2,7 +2,6 @@ import LoginPage from '../../pageObjects/login' import HomePage from '../../pageObjects/home' import NamespaceAccessPage from '../../pageObjects/namespaceAccess' import NameSpacePage from '../../pageObjects/namespace' -import MyProfilePage from '../../pageObjects/myProfile' import ToolBar from '../../pageObjects/toolbar' import AuthorizationProfile from '../../pageObjects/authProfile' @@ -53,7 +52,6 @@ describe('Verify that Wendy is able to generate authorization profile', () => { const login = new LoginPage() const home = new HomePage() const ns = new NameSpacePage() - const mp = new MyProfilePage() const tb = new ToolBar() const authProfile = new AuthorizationProfile() @@ -76,7 +74,6 @@ describe('Verify that Wendy is able to generate authorization profile', () => { cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') cy.activateGateway(checkPermission.namespace) - cy.visit(mp.path) }) }) }) diff --git a/e2e/cypress/tests/12-access-permission/07-namespace-view.cy.ts b/e2e/cypress/tests/12-access-permission/07-namespace-view.cy.ts index 38025ea7c..6d46e831f 100644 --- a/e2e/cypress/tests/12-access-permission/07-namespace-view.cy.ts +++ b/e2e/cypress/tests/12-access-permission/07-namespace-view.cy.ts @@ -1,6 +1,5 @@ import LoginPage from '../../pageObjects/login' import HomePage from '../../pageObjects/home' -import MyProfilePage from '../../pageObjects/myProfile' import NamespaceAccessPage from '../../pageObjects/namespaceAccess' import ConsumersPage from '../../pageObjects/consumers' import ServiceAccountsPage from '../../pageObjects/serviceAccounts' @@ -52,7 +51,6 @@ describe('Verify that Mark is unable to create service account', () => { const login = new LoginPage() const home = new HomePage() - const mp = new MyProfilePage() const consumers = new ConsumersPage() const sa = new ServiceAccountsPage() @@ -76,7 +74,6 @@ describe('Verify that Mark is unable to create service account', () => { cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') cy.activateGateway(checkPermission.namespace) - cy.visit(mp.path) }) }) }) diff --git a/e2e/cypress/tests/12-access-permission/08-gateway-config.cy.ts b/e2e/cypress/tests/12-access-permission/08-gateway-config.cy.ts index e550831f3..badeb3e75 100644 --- a/e2e/cypress/tests/12-access-permission/08-gateway-config.cy.ts +++ b/e2e/cypress/tests/12-access-permission/08-gateway-config.cy.ts @@ -1,6 +1,5 @@ import LoginPage from '../../pageObjects/login' import HomePage from '../../pageObjects/home' -import MyProfilePage from '../../pageObjects/myProfile' import NamespaceAccessPage from '../../pageObjects/namespaceAccess' import ServiceAccountsPage from '../../pageObjects/serviceAccounts' import AuthorizationProfile from '../../pageObjects/authProfile' @@ -56,7 +55,6 @@ describe('Verify that Wendy is able to generate authorization profile', () => { const login = new LoginPage() const home = new HomePage() const ns = new NameSpacePage() - const mp = new MyProfilePage() const tb = new ToolBar() const authProfile = new AuthorizationProfile() @@ -79,7 +77,6 @@ describe('Verify that Wendy is able to generate authorization profile', () => { cy.login(user.credentials.username, user.credentials.password) cy.log('Logged in!') cy.activateGateway(checkPermission.namespace) - cy.visit(mp.path) }) }) }) From e575efafd9e559fac3bbdaf87549224a07ccd4cc Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Fri, 12 Jul 2024 12:39:12 -0700 Subject: [PATCH 22/54] org approval fixes --- e2e/cypress/fixtures/apiowner.json | 4 ++-- e2e/cypress/pageObjects/namespace.ts | 3 ++- .../tests/14-org-assignment/01-client-cred-team-access.ts | 8 +++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/e2e/cypress/fixtures/apiowner.json b/e2e/cypress/fixtures/apiowner.json index d72069948..76339d7a7 100644 --- a/e2e/cypress/fixtures/apiowner.json +++ b/e2e/cypress/fixtures/apiowner.json @@ -361,8 +361,8 @@ } }, "orgAdminNotification": { - "parent": "Your Organization Administrator has been notified to enable API Publishing to the Directory for the orgassignment namespace.", - "child": "New namespaces must be reviewed by your Organization Administrator before you can publish APIs to the Directory. Your APIs are still in preview mode. For status inquiries, contact your Organization Administrator benny@test.com." + "parent": "Your Organization Administrator has been notified to enable API Publishing to the Directory for the gateway orgassignment.", + "child": "New gateways must be reviewed by your Organization Administrator before you can publish APIs to the Directory. Your APIs are still in preview mode. For status inquiries, contact your Organization Administrator benny@test.com." } }, "orgAssignmentMultipleAdmin": { diff --git a/e2e/cypress/pageObjects/namespace.ts b/e2e/cypress/pageObjects/namespace.ts index 549e4e449..8175f6439 100644 --- a/e2e/cypress/pageObjects/namespace.ts +++ b/e2e/cypress/pageObjects/namespace.ts @@ -1,5 +1,6 @@ class NameSpacePage { - path: string = '/manager/namespaces' + path: string = '/manager/gateways' + detailPath: string = '/manager/gateways/detail' gatewayServiceLink: string = '[data-testid="ns-manage-link-Gateway Services"]' productsLink: string = '[data-testid="ns-manage-link-Gateway Services"]' consumersLink: string = '[data-testid="ns-manage-link-Consumers"]' diff --git a/e2e/cypress/tests/14-org-assignment/01-client-cred-team-access.ts b/e2e/cypress/tests/14-org-assignment/01-client-cred-team-access.ts index df01b3c92..4e8e5fcf7 100644 --- a/e2e/cypress/tests/14-org-assignment/01-client-cred-team-access.ts +++ b/e2e/cypress/tests/14-org-assignment/01-client-cred-team-access.ts @@ -9,6 +9,7 @@ import ServiceAccountsPage from '../../pageObjects/serviceAccounts' import MyAccessPage from '../../pageObjects/myAccess' import ConsumersPage from '../../pageObjects/consumers' let namespace: string +let displayName: string describe('Add Organization to publish API', () => { const login = new LoginPage() @@ -51,6 +52,7 @@ describe('Add Organization to publish API', () => { it('create namespace', () => { cy.createGateway().then((response) => { namespace = response.gatewayId + displayName = response.displayName cy.log('New namespace created: ' + namespace) cy.updateJsonValue('common-testdata.json', 'orgAssignment.namespace', namespace) // cy.updateJsonValue('apiowner.json', 'clientCredentials.clientIdSecret.product.environment.name.config.serviceName', 'cc-service-for-' + namespace) @@ -122,7 +124,7 @@ describe('Add Organization to publish API', () => { it('Verify Organization Administrator notification banner', () => { cy.visit(apiDir.path) cy.get('@apiowner').then(({ orgAssignment }: any) => { - cy.replaceWord(orgAssignment.orgAdminNotification.parent, 'orgassignment', namespace).then((updatedNotification: string) => { + cy.replaceWord(orgAssignment.orgAdminNotification.parent, 'orgassignment', displayName).then((updatedNotification: string) => { apiDir.checkOrgAdminNotificationBanner(updatedNotification, orgAssignment.orgAdminNotification.child) }) }) @@ -160,8 +162,8 @@ describe('Org Admin approves the request', () => { cy.activateGateway(namespace) }) - it('Clik on Enable Publishing option from Namespace Page', () => { - cy.visit(ns.path) + it('Click on Enable Publishing option from Namespace Page', () => { + cy.visit(ns.detailPath) cy.wait(2000) cy.contains('a', 'Enable Publishing').click() cy.wait(2000) From df25574e0f847967f302a4b917b017235f2f62b9 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Fri, 12 Jul 2024 13:15:18 -0700 Subject: [PATCH 23/54] remove accidentally kept .only --- e2e/cypress/tests/15-aps-api/01-create-api.cy.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts b/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts index d141d7888..48cbb2175 100644 --- a/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts +++ b/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts @@ -21,7 +21,7 @@ describe('Create API Spec', () => { beforeEach(() => { cy.preserveCookies() cy.fixture('apiowner').as('apiowner') - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') cy.fixture('common-testdata').as('common-testdata') cy.visit(login.path) }) @@ -59,7 +59,7 @@ describe('Create API Spec', () => { cy.get('@api').then(({ organization }: any) => { cy.setHeaders(organization.headers) cy.setAuthorizationToken(userSession) - cy.makeAPIRequest(organization.endPoint + '/' + organization.orgName + '/' + organization.orgExpectedList.name + '/gateways/' + namespace, 'PUT').then((response:any) => { + cy.makeAPIRequest(organization.endPoint + '/' + organization.orgName + '/' + organization.orgExpectedList.name + '/namespaces/' + namespace, 'PUT').then((response:any) => { expect(response.apiRes.status).to.be.equal(200) }) }) From e77f10b25b8f54107c7fdc38ce970c68e8aa06c1 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Fri, 12 Jul 2024 14:07:03 -0700 Subject: [PATCH 24/54] skip astra (additional changes) --- e2e/cypress/support/auth-commands.ts | 1 + e2e/cypress/support/util-commands.ts | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/e2e/cypress/support/auth-commands.ts b/e2e/cypress/support/auth-commands.ts index 22580a5ca..d26565e07 100644 --- a/e2e/cypress/support/auth-commands.ts +++ b/e2e/cypress/support/auth-commands.ts @@ -595,6 +595,7 @@ Cypress.Commands.add('makeAPIRequest', (endPoint: string, methodType: string) => failOnStatusCode: false, }).then((apiResponse) => { const responseData = { + astraRes: { body: { status: null } }, apiRes: apiResponse, } return responseData diff --git a/e2e/cypress/support/util-commands.ts b/e2e/cypress/support/util-commands.ts index c42c1a009..c8d27ffba 100644 --- a/e2e/cypress/support/util-commands.ts +++ b/e2e/cypress/support/util-commands.ts @@ -171,19 +171,23 @@ Cypress.Commands.add('deleteFileInE2EFolder', (fileName: string) => { }); Cypress.Commands.add('addToAstraScanIdList', (item) => { - cy.readFile('cypress/fixtures/state/scanID.json').then((fileContent) => { - // Initialize the list if it doesn't exist - const items = fileContent.items || []; + if (Cypress.env('ASTRA_SCAN_ENABLED') == 'true') { + cy.readFile('cypress/fixtures/state/scanID.json').then((fileContent) => { + // Initialize the list if it doesn't exist + const items = fileContent.items || []; - // Append the new item to the list - items.push(item); + // Append the new item to the list + items.push(item); - // Create an object with the updated list - const updatedData = { items }; + // Create an object with the updated list + const updatedData = { items }; - // Write the updated object back to the file - cy.writeFile('cypress/fixtures/state/scanID.json', updatedData); - }); + // Write the updated object back to the file + cy.writeFile('cypress/fixtures/state/scanID.json', updatedData); + }); + } else { + cy.log('Astra Scan is disabled') + } }); Cypress.Commands.add('replaceWord', (originalString: string, wordToReplace: string, replacementWord: string)=> { From 5e67d715a230cad47918de1b84968efa6fba85d6 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Fri, 12 Jul 2024 14:08:02 -0700 Subject: [PATCH 25/54] preserve API v2 tests --- e2e/cypress/fixtures/api-v2.json | 398 ++++++++++++++++++ e2e/cypress/fixtures/api.json | 21 - .../01-migrate-user-access.cy.ts | 4 +- .../tests/15-aps-api/02-organization.cy.ts | 20 +- .../tests/15-aps-api/03-documentation.cy.ts | 10 +- .../15-aps-api/05-authorizationProfiles.cy.ts | 22 +- .../tests/15-aps-api/06-products.cy.ts | 10 +- .../tests/15-aps-api/07-api-directory.cy.ts | 2 +- .../tests/15-aps-api/08-namespaces.cy.ts | 14 +- 9 files changed, 439 insertions(+), 62 deletions(-) create mode 100644 e2e/cypress/fixtures/api-v2.json diff --git a/e2e/cypress/fixtures/api-v2.json b/e2e/cypress/fixtures/api-v2.json new file mode 100644 index 000000000..91dbdac97 --- /dev/null +++ b/e2e/cypress/fixtures/api-v2.json @@ -0,0 +1,398 @@ +{ + "organization": { + "headers": { + "accept": "application/json", + "content-type": "application/json" + }, + "endPoint": "ds/api/v2/organizations", + "orgExpectedList": { + "name": "planning-and-innovation-division", + "title": "Planning and Innovation Division" + }, + "orgName": "ministry-of-health", + "expectedScope": [ + "Dataset.Manage", + "GroupAccess.Manage", + "Namespace.Assign" + ], + "expectedNamespace": { + "name": "gw-3a443", + "orgUnit": "planning-and-innovation-division", + "enabled": true + }, + "expectedRoles": { + "organization-admin": { + "label": "Organization Administrator", + "permissions": [ + { + "resourceType": "organization", + "scopes": [ + "GroupAccess.Manage", + "Namespace.Assign", + "Dataset.Manage" + ] + }, + { + "resourceType": "namespace", + "scopes": [ + "Namespace.View" + ] + } + ] + } + }, + "body": { + "name": "ministry-of-health", + "parent": "/ca.bc.gov", + "members": [ + { + "member": { + "id": "janis@idir", + "email": "janis@testmail.com" + }, + "roles": [ + "organization-admin" + ] + } + ] + } + }, + "documentation": { + "endPoint": "ds/api/v2/namespaces/apiplatform/contents", + "getDocumentation_endPoint": "ds/api/v2/documentation", + "headers": { + "accept": "application/json", + "content-type": "application/json" + }, + "body": { + "externalLink": "https://externalsite/my_content", + "title": "my_content", + "description": "Summary of Test content", + "content": "Markdown content", + "order": 0, + "isPublic": true, + "isComplete": true, + "tags": [ + "tag1", + "tag2" + ] + } + }, + "apiDirectory": { + "endPoint": "ds/api/v2/namespaces", + "orgEndPoint": "ds/api/v2/organizations", + "directoryEndPoint": "ds/api/v2/directory", + "headers": { + "accept": "application/json", + "content-type": "application/json" + }, + "body": { + "name": "auto-test-product-new", + "license_title": "Open Government Licence - British Columbia", + "security_class": "PUBLIC", + "view_audience": "Government", + "download_audience": "Public", + "notes": "Some notes", + "title": "Dataset for Test API", + "isInCatalog": "false", + "isDraft": "false", + "tags": [ + "gateway", + "kong" + ], + "organization": "ministry-of-health", + "organizationUnit": "planning-and-innovation-division" + }, + "directory": { + "name": "gwa-auto-test-product", + "title": "GWA Auto Test Product", + "notes": "For Test Purpose", + "license_title": "Open Government Licence - British Columbia", + "view_audience": "Public", + "security_class": "PUBLIC", + "record_publish_date": "2017-09-05", + "tags": [ + "tag1", + "tag2" + ], + "organization": { + "name": "ministry-of-health", + "title": "Ministry of Health" + }, + "organizationUnit": { + "name": "planning-and-innovation-division", + "title": "Planning and Innovation Division" + }, + "products": [ + { + "id": "2", + "name": "GWA Auto Test Product", + "environments": [ + { + "name": "dev", + "active": true, + "flow": "kong-api-key-only" + }, + { + "name": "test", + "active": true, + "flow": "client-credentials" + } + ] + } + ] + }, + "namespaceDirectory": { + "name": "client-credentials-test-product", + "title": "Client Credentials Test Product", + "notes": "API Gateway Services provides a way to configure services on the API Gateway, manage access to APIs and get insight into the use of them.", + "license_title": "Access Only", + "view_audience": "Government", + "security_class": "LOW-PUBLIC", + "tags": [ + "gateway", + "kong", + "openapi" + ], + "organization": { + "name": "ministry-of-health", + "title": "Ministry of Health" + }, + "organizationUnit": { + "name": "planning-and-innovation-division", + "title": "Planning and Innovation Division" + }, + "products": [ + { + "id": "2", + "name": "Client Credentials Test Product", + "environments": [ + { + "name": "test", + "active": true, + "flow": "client-credentials" + }, + { + "name": "dev", + "active": true, + "flow": "client-credentials" + }, + { + "name": "sandbox", + "active": true, + "flow": "client-credentials" + } + ] + } + ] + } + }, + "authorizationProfiles": { + "body": { + "name": "my-auth-profile", + "description": "Auth connection to my IdP", + "flow": "client-credentials", + "clientAuthenticator": "client-secret", + "mode": "auto", + "environmentDetails": [ + { + "environment": "dev", + "issuerUrl": "http://keycloak.localtest.me:9081/auth/realms/master", + "clientRegistration": "managed", + "clientId": "cypress-auth-profile", + "clientSecret": "43badfc1-c06f-4bec-bab6-ccdc764071ac" + } + ], + "owner": "janis@idir" + }, + "shared_IDP_update_body": { + "name": "Sample Shared IdP", + "description": "A Shared IdP for Teams to use", + "flow": "client-credentials", + "clientAuthenticator": "client-secret", + "mode": "auto", + "environmentDetails": [ + { + "environment": "test", + "issuerUrl": "http://keycloak.localtest.me:9081/auth/realms/master", + "clientRegistration": "managed", + "clientId": "gwa-api", + "clientSecret": "18900468-3db1-43f7-a8af-e75f079eb742" + } + ], + "isShared": true + }, + "shared_gwa": { + "name": "Gold Shared IdP", + "description": "A Shared IdP for Teams to use", + "flow": "client-credentials", + "clientAuthenticator": "client-secret", + "mode": "auto", + "environmentDetails": [ + { + "environment": "test", + "issuerUrl": "http://keycloak.localtest.me:9081/auth/realms/master", + "clientRegistration": "managed", + "clientId": "gwa-api", + "clientSecret": "18900468-3db1-43f7-a8af-e75f079eb742" + } + ], + "isShared": true + }, + "shared_gwa_publish": { + "name": "Gold Shared IdP", + "description": "A Shared IdP for Teams to use", + "flow": "client-credentials", + "mode": "auto", + "clientAuthenticator": "client-secret", + "environmentDetails": [ + { + "clientId": "gwa-api", + "clientRegistration": "managed", + "clientSecret": "****", + "environment": "test", + "issuerUrl": "http://keycloak.localtest.me:9081/auth/realms/master", + "exists": true + } + ], + "clientRoles": [], + "clientMappers": [], + "availableScopes": [], + "resourceScopes": [], + "isShared": true, + "apiKeyName": "X-API-KEY" + }, + "shared_IDP_body": { + "name": "Sample Shared IdP new", + "description": "A Shared IdP for Teams to use", + "flow": "client-credentials", + "clientAuthenticator": "client-secret", + "mode": "auto", + "environmentDetails": [ + { + "environment": "test", + "issuerUrl": "http://keycloak.localtest.me:9081/auth/realms/master", + "clientRegistration": "managed", + "clientId": "gwa-api", + "clientSecret": "18900468-3db1-43f7-a8af-e75f079eb742" + } + ], + "isShared": true + }, + "shared_IDP_inheritFrom": { + "environmentDetails": [], + "mode": "auto", + "clientRoles": [ + "administrator" + ], + "clientMappers": [ + "test-audience" + ], + "flow": "client-credentials", + "clientAuthenticator": "client-secret", + "name": "my-auth-client-secret-1", + "description": "Auth connection to my IdP", + "owner": "janis@testmail.com", + "inheritFrom": "Sample Shared IdP new" + }, + "shared_IDP_inheritFrom_expectedResponse": { + "name": "my-auth-client-secret-1", + "description": "Auth connection to my IdP", + "flow": "client-credentials", + "mode": "auto", + "clientAuthenticator": "client-secret", + "environmentDetails": [ + { + "exists": true, + "environment": "test", + "issuerUrl": "http://keycloak.localtest.me:9081/auth/realms/master", + "clientRegistration": "shared-idp", + "clientId": "ap-my-auth-client-secret-1-test" + } + ], + "clientRoles": [ + "administrator" + ], + "clientMappers": [ + "test-audience" + ], + "isShared": false, + "apiKeyName": "X-API-KEY", + "inheritFrom": { + "name": "Sample Shared IdP" + }, + "owner": "janis@testmail.com" + }, + "endPoint": "ds/api/v2/namespaces/apiplatform/issuers", + "headers": { + "accept": "application/json", + "content-type": "application/json" + } + }, + "products": { + "headers": { + "accept": "application/json", + "content-type": "application/json" + }, + "endPoint": "ds/api/v2/namespaces/apiplatform/products", + "deleteEnvironmentEndPoint": "ds/api/v2/namespaces/apiplatform/environments", + "body": { + "name": "my-new-product", + "appId": "DRE123456", + "environments": [ + { + "name": "test", + "active": false, + "approval": false, + "flow": "public", + "appId": "6754" + } + ] + } + }, + "namespaces": { + "headers": { + "accept": "application/json", + "content-type": "application/json" + }, + "endPoint": "ds/api/v2/namespaces", + "activity": { + "name": "newplatform", + "scopes": [ + { + "name": "GatewayConfig.Publish" + }, + { + "name": "Namespace.Manage" + }, + { + "name": "Access.Manage" + }, + { + "name": "Content.Publish" + }, + { + "name": "Namespace.View" + }, + { + "name": "CredentialIssuer.Admin" + } + ], + "permDomains": [ + ".api.gov.bc.ca" + ], + "permDataPlane": "local.dataplane", + "permProtectedNs": "deny", + "org": "ministry-of-health", + "orgUnit": "planning-and-innovation-division" + }, + "userDefinedNamespace": { + "name": "gwanelatform", + "displayName": "Test for GWA test" + }, + "inValidNamespace": { + "name": "gwa", + "displayName": "Test for GWA test" + } + } +} \ No newline at end of file diff --git a/e2e/cypress/fixtures/api.json b/e2e/cypress/fixtures/api.json index 36a1787ca..83779b63f 100644 --- a/e2e/cypress/fixtures/api.json +++ b/e2e/cypress/fixtures/api.json @@ -57,27 +57,6 @@ ] } }, - "documentation": { - "endPoint": "ds/api/v2/namespaces/apiplatform/contents", - "getDocumentation_endPoint": "ds/api/v2/documentation", - "headers": { - "accept": "application/json", - "content-type": "application/json" - }, - "body": { - "externalLink": "https://externalsite/my_content", - "title": "my_content", - "description": "Summary of Test content", - "content": "Markdown content", - "order": 0, - "isPublic": true, - "isComplete": true, - "tags": [ - "tag1", - "tag2" - ] - } - }, "apiDirectory": { "endPoint": "ds/api/v3/gateways", "orgEndPoint": "ds/api/v3/gateways", diff --git a/e2e/cypress/tests/05-migrate-user/01-migrate-user-access.cy.ts b/e2e/cypress/tests/05-migrate-user/01-migrate-user-access.cy.ts index ff2a15e09..c298be7c9 100644 --- a/e2e/cypress/tests/05-migrate-user/01-migrate-user-access.cy.ts +++ b/e2e/cypress/tests/05-migrate-user/01-migrate-user-access.cy.ts @@ -96,7 +96,7 @@ describe('Verify that permission of old user is migrated to new user', () => { cy.visit(login.path) }) - it.only('authenticates with new user', () => { + it('authenticates with new user', () => { cy.get('@usermigration').then(({ newUser }: any) => { cy.login(newUser.credentials.username, newUser.credentials.password) cy.log('Logged in!') @@ -109,7 +109,7 @@ describe('Verify that permission of old user is migrated to new user', () => { // }) // }) - it.only('Get the permission of the user', () => { + it('Get the permission of the user', () => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.activateGateway(namespace) cy.getUserSession() diff --git a/e2e/cypress/tests/15-aps-api/02-organization.cy.ts b/e2e/cypress/tests/15-aps-api/02-organization.cy.ts index 1ff21b83a..d1eb2fb56 100644 --- a/e2e/cypress/tests/15-aps-api/02-organization.cy.ts +++ b/e2e/cypress/tests/15-aps-api/02-organization.cy.ts @@ -35,8 +35,8 @@ describe('API Tests to verify the Organization details in the response', () => { beforeEach(() => { cy.preserveCookies() - cy.fixture('api').as('api') - cy.request("ds/api/v3/organizations") + cy.fixture('api-v2').as('api') + cy.request("ds/api/v2/organizations") }) it('Prepare the Request Specification for the API', () => { @@ -62,8 +62,8 @@ describe('Verify /Organization/{Org} end point', () => { beforeEach(() => { cy.preserveCookies() - cy.fixture('api').as('api') - cy.request("ds/api/v3/organizations") + cy.fixture('api-v2').as('api') + cy.request("ds/api/v2/organizations") }) it('Prepare the Request Specification for the API', () => { @@ -99,7 +99,7 @@ describe('Get the Organization Role', () => { var expectedResponse: any = {} beforeEach(() => { - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') }) it('Prepare the Request Specification for the API', () => { @@ -128,7 +128,7 @@ describe('Get the Organization Role', () => { }) it('Get the list of roles and verify the success code in the response', () => { - cy.makeAPIRequest('ds/api/v3/roles', 'GET').then((res:any) => { + cy.makeAPIRequest('ds/api/v2/roles', 'GET').then((res:any) => { expect(res.apiRes.status).to.be.equal(200) response = res.apiRes.body cy.addToAstraScanIdList(res.astraRes.body.status) @@ -151,7 +151,7 @@ describe('Get the Namespace associated with the organization', () => { var expectedResponse: any = {} beforeEach(() => { - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') }) it('Prepare the Request Specification for the API', () => { @@ -189,7 +189,7 @@ describe('Delete the Namespace associated with the organization', () => { var expectedResponse: any = {} beforeEach(() => { - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') cy.fixture('apiowner').as('apiowner') cy.fixture('common-testdata').as('common-testdata') }) @@ -204,7 +204,7 @@ describe('Delete the Namespace associated with the organization', () => { it('Delete the namespace associated with the organization, organization unit and verify the success code in the response', () => { cy.get('@common-testdata').then(({ namespace }: any) => { cy.get('@api').then(({ organization }: any) => { - cy.makeAPIRequest(organization.endPoint + '/' + organization.orgName + '/' + organization.orgExpectedList.name + '/gateways/' + nameSpace, 'DELETE').then((res:any) => { + cy.makeAPIRequest(organization.endPoint + '/' + organization.orgName + '/' + organization.orgExpectedList.name + '/namespaces/' + nameSpace, 'DELETE').then((res:any) => { expect(res.apiRes.status).to.be.equal(200) cy.addToAstraScanIdList(res.astraRes.body.status) response = res.apiRes.body @@ -232,7 +232,7 @@ describe('Add and Get Organization Access', () => { var expectedResponse: any = {} beforeEach(() => { - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') cy.fixture('apiowner').as('apiowner') }) diff --git a/e2e/cypress/tests/15-aps-api/03-documentation.cy.ts b/e2e/cypress/tests/15-aps-api/03-documentation.cy.ts index 08b39b41d..3dd8c5a86 100644 --- a/e2e/cypress/tests/15-aps-api/03-documentation.cy.ts +++ b/e2e/cypress/tests/15-aps-api/03-documentation.cy.ts @@ -38,7 +38,7 @@ describe('API Tests for Updating documentation', () => { const home = new HomePage() beforeEach(() => { - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') }) it('Prepare the Request Specification for the API', () => { @@ -69,7 +69,7 @@ describe('API Tests for Fetching documentation', () => { var response: any beforeEach(() => { - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') }) it('Prepare the Request Specification for the API', () => { @@ -103,7 +103,7 @@ describe('API Tests for Deleting documentation', () => { const home = new HomePage() beforeEach(() => { - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') }) it('Prepare the Request Specification for the API', () => { @@ -137,7 +137,7 @@ describe('API Tests to verify no value in Get call after deleting document conte const home = new HomePage() beforeEach(() => { - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') }) it('Prepare the Request Specification for the API', () => { @@ -164,7 +164,7 @@ describe('API Tests to verify Get documentation content', () => { let slugID: string beforeEach(() => { - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') }) it('Prepare the Request Specification for the API', () => { diff --git a/e2e/cypress/tests/15-aps-api/05-authorizationProfiles.cy.ts b/e2e/cypress/tests/15-aps-api/05-authorizationProfiles.cy.ts index dd916ebf0..32204afe6 100644 --- a/e2e/cypress/tests/15-aps-api/05-authorizationProfiles.cy.ts +++ b/e2e/cypress/tests/15-aps-api/05-authorizationProfiles.cy.ts @@ -49,7 +49,7 @@ testData.forEach((testCase: any) => { var expectedResponse: any = {} beforeEach(() => { - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') }) it('Prepare the Request Specification for the API', () => { @@ -113,7 +113,7 @@ describe('API Tests for Authorization Profiles created with inheritFrom attribut let expectedResponse: any beforeEach(() => { - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') cy.fixture('apiowner').as('apiowner') cy.fixture('common-testdata').as('common-testdata') }) @@ -128,7 +128,7 @@ describe('API Tests for Authorization Profiles created with inheritFrom attribut it('Put the resource to create shared IDP profile and verify the success code in the response', () => { cy.get('@common-testdata').then(({ apiTest }: any) => { - cy.makeAPIRequest('ds/api/v3/gateways/' + apiTest.namespace + '/issuers', 'PUT').then((response:any) => { + cy.makeAPIRequest('ds/api/v2/namespaces/' + apiTest.namespace + '/issuers', 'PUT').then((response:any) => { expect(response.apiRes.status).to.be.equal(200) cy.addToAstraScanIdList(response.astraRes.body.status) }) @@ -145,7 +145,7 @@ describe('API Tests for Authorization Profiles created with inheritFrom attribut it('Create an authorization profile using inheritFrom attribute and verify the success code in the response', () => { cy.get('@common-testdata').then(({ apiTest }: any) => { - cy.makeAPIRequest('ds/api/v3/gateways/' + apiTest.namespace + '/issuers', 'PUT').then((response:any) => { + cy.makeAPIRequest('ds/api/v2/namespaces/' + apiTest.namespace + '/issuers', 'PUT').then((response:any) => { expect(response.apiRes.status).to.be.equal(200) cy.addToAstraScanIdList(response.astraRes.body.status) expect(response.apiRes.body.result).to.be.equal("created") @@ -155,7 +155,7 @@ describe('API Tests for Authorization Profiles created with inheritFrom attribut it('Get list of authorization profile and verify the success code in the response', () => { cy.get('@common-testdata').then(({ apiTest }: any) => { - cy.makeAPIRequest('ds/api/v3/gateways/' + apiTest.namespace + '/issuers', 'GET').then((res:any) => { + cy.makeAPIRequest('ds/api/v2/namespaces/' + apiTest.namespace + '/issuers', 'GET').then((res:any) => { expect(res.apiRes.status).to.be.equal(200) cy.addToAstraScanIdList(res.astraRes.body.status) response = res.apiRes.body @@ -180,7 +180,7 @@ describe('Published a shared authorization profile', () => { let expectedResponse: any beforeEach(() => { - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') cy.fixture('apiowner').as('apiowner') cy.fixture('common-testdata').as('common-testdata') }) @@ -195,7 +195,7 @@ describe('Published a shared authorization profile', () => { it('Create a shared credential issuer', () => { cy.get('@common-testdata').then(({ apiTest }: any) => { - cy.makeAPIRequest('ds/api/v3/gateways/' + apiTest.namespace + '/issuers', 'PUT').then((response:any) => { + cy.makeAPIRequest('ds/api/v2/namespaces/' + apiTest.namespace + '/issuers', 'PUT').then((response:any) => { expect(response.apiRes.status).to.be.equal(200) cy.addToAstraScanIdList(response.astraRes.body.status) expect(response.apiRes.body.result).to.be.equal("created") @@ -205,7 +205,7 @@ describe('Published a shared authorization profile', () => { it('Get list of authorization profile and verify the success code in the response', () => { cy.get('@common-testdata').then(({ apiTest }: any) => { - cy.makeAPIRequest('ds/api/v3/gateways/' + apiTest.namespace + '/issuers', 'GET').then((res:any) => { + cy.makeAPIRequest('ds/api/v2/namespaces/' + apiTest.namespace + '/issuers', 'GET').then((res:any) => { expect(res.apiRes.status).to.be.equal(200) cy.addToAstraScanIdList(res.astraRes.body.status) response = res.apiRes.body @@ -233,7 +233,7 @@ describe('Deleted shared auth profile', () => { beforeEach(() => { cy.preserveCookies() cy.fixture('apiowner').as('apiowner') - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') cy.fixture('common-testdata').as('common-testdata') }) @@ -242,7 +242,7 @@ describe('Deleted shared auth profile', () => { cy.getUserSessionTokenValue(apiTest.namespace).then((value) => { userSession = value namespace = apiTest.namespace - cy.activateGateway(namespace); + home.useNamespace(namespace); }) }) }) @@ -285,7 +285,7 @@ describe('Verify that client ID of deleted shared auth profile in IDP', () => { cy.fixture('apiowner').as('apiowner') cy.fixture('state/regen').as('regen') cy.fixture('admin').as('admin') - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') }) it('Authenticates Admin owner', () => { diff --git a/e2e/cypress/tests/15-aps-api/06-products.cy.ts b/e2e/cypress/tests/15-aps-api/06-products.cy.ts index 0f4e07f6a..f05f4a305 100644 --- a/e2e/cypress/tests/15-aps-api/06-products.cy.ts +++ b/e2e/cypress/tests/15-aps-api/06-products.cy.ts @@ -26,14 +26,14 @@ describe('Get the user session token to check ', () => { }) it('authenticates Janis (api owner) to get the user session token', () => { - cy.getUserSession().then(() => { + cy.interceptUserSession().then(() => { cy.get('@apiowner').then(({ user }: any) => { cy.get('@common-testdata').then(({ apiTest }: any) => { cy.login(user.credentials.username, user.credentials.password) cy.activateGateway(apiTest.namespace) namespace = apiTest.namespace cy.get('@login').then(function (xhr: any) { - userSession = xhr.headers['x-auth-request-access-token'] + userSession = xhr.response.headers['x-auth-request-access-token'] }) }) }) @@ -49,7 +49,7 @@ describe('API Tests for Updating Products', () => { var response: any beforeEach(() => { - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') }) it('Prepare the Request Specification for the API', () => { @@ -104,7 +104,7 @@ describe('Verify that created Product is displayed in UI', () => { beforeEach(() => { cy.preserveCookies() cy.fixture('apiowner').as('apiowner') - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') cy.fixture('common-testdata').as('common-testdata') cy.visit(login.path) }) @@ -124,7 +124,7 @@ describe('API Tests for Delete Products', () => { var response: any beforeEach(() => { - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') }) it('Prepare the Request Specification for the API', () => { diff --git a/e2e/cypress/tests/15-aps-api/07-api-directory.cy.ts b/e2e/cypress/tests/15-aps-api/07-api-directory.cy.ts index 7f235b2f7..273240dfa 100644 --- a/e2e/cypress/tests/15-aps-api/07-api-directory.cy.ts +++ b/e2e/cypress/tests/15-aps-api/07-api-directory.cy.ts @@ -40,7 +40,7 @@ describe('API Tests for Updating dataset', () => { let directoryName: string beforeEach(() => { - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') cy.fixture('apiowner').as('apiowner') cy.fixture('common-testdata').as('common-testdata') }) diff --git a/e2e/cypress/tests/15-aps-api/08-namespaces.cy.ts b/e2e/cypress/tests/15-aps-api/08-namespaces.cy.ts index 433f5fa86..952135bc0 100644 --- a/e2e/cypress/tests/15-aps-api/08-namespaces.cy.ts +++ b/e2e/cypress/tests/15-aps-api/08-namespaces.cy.ts @@ -39,7 +39,7 @@ describe('API Tests for Namespace Report', () => { var response: any beforeEach(() => { - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') }) it('Prepare the Request Specification for the API', () => { @@ -65,7 +65,7 @@ describe('API Tests for Namespace List', () => { var response: any beforeEach(() => { - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') }) it('Prepare the Request Specification for the API', () => { @@ -97,7 +97,7 @@ describe('API Tests for Namespace Activities', () => { var response: any beforeEach(() => { - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') }) it('Prepare the Request Specification for the API', () => { @@ -124,7 +124,7 @@ describe('API Tests for Namespace Summary', () => { var response: any beforeEach(() => { - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') cy.fixture('apiowner').as('apiowner') cy.fixture('common-testdata').as('common-testdata') }) @@ -162,7 +162,7 @@ describe('API Tests for Create Namespace', () => { var response: any beforeEach(() => { - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') cy.fixture('apiowner').as('apiowner') }) @@ -220,7 +220,7 @@ describe('API Tests for Create Namespace', () => { describe('API Tests for invalid namespace name', () => { beforeEach(() => { - cy.fixture('api').as('api') + cy.fixture('api-v2').as('api') cy.fixture('apiowner').as('apiowner') }) @@ -253,7 +253,7 @@ describe('API Tests for invalid namespace name', () => { // beforeEach(() => { -// cy.fixture('api').as('api') +// cy.fixture('api-v2').as('api') // cy.fixture('apiowner').as('apiowner') // }) From 49fa69b34b56549d4fc0d8fbfa049e851e7fb043 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Fri, 12 Jul 2024 16:02:17 -0700 Subject: [PATCH 26/54] disable content tests --- .../09-content-publish.cy.ts | 118 +++++++++--------- 1 file changed, 60 insertions(+), 58 deletions(-) diff --git a/e2e/cypress/tests/12-access-permission/09-content-publish.cy.ts b/e2e/cypress/tests/12-access-permission/09-content-publish.cy.ts index 43f252348..d51a49667 100644 --- a/e2e/cypress/tests/12-access-permission/09-content-publish.cy.ts +++ b/e2e/cypress/tests/12-access-permission/09-content-publish.cy.ts @@ -1,67 +1,69 @@ -import LoginPage from '../../pageObjects/login' -import HomePage from '../../pageObjects/home' - +// import LoginPage from '../../pageObjects/login' +// import HomePage from '../../pageObjects/home' +it('Content publication tests are disabled', () => { + cy.log('Content publication tests are disabled. This feature has been removed.') +}) -describe('Verify Content Publish Permission', () => { - const login = new LoginPage() - const home = new HomePage() - let token: any +// describe('Verify Content Publish Permission', () => { +// const login = new LoginPage() +// const home = new HomePage() +// let token: any - before(() => { - cy.visit('/') - cy.deleteAllCookies() - cy.reload() - }) +// before(() => { +// cy.visit('/') +// cy.deleteAllCookies() +// cy.reload() +// }) - beforeEach(() => { - cy.preserveCookies() - cy.fixture('apiowner').as('apiowner') - cy.fixture('api').as('api') - cy.fixture('common-testdata').as('common-testdata') - cy.visit(login.path) - }) +// beforeEach(() => { +// cy.preserveCookies() +// cy.fixture('apiowner').as('apiowner') +// cy.fixture('api').as('api') +// cy.fixture('common-testdata').as('common-testdata') +// cy.visit(login.path) +// }) - it('authenticates Janis (api owner)', () => { - cy.get('@apiowner').then(({ user }: any) => { - cy.get('@common-testdata').then(({ checkPermission }: any) => { - cy.login(user.credentials.username, user.credentials.password) - cy.activateGateway(checkPermission.namespace) - }) - }) - }) +// it('authenticates Janis (api owner)', () => { +// cy.get('@apiowner').then(({ user }: any) => { +// cy.get('@common-testdata').then(({ checkPermission }: any) => { +// cy.login(user.credentials.username, user.credentials.password) +// cy.activateGateway(checkPermission.namespace) +// }) +// }) +// }) - it('Get the authorization token for the service account created with out "Content.Publish" permission', () => { - cy.readFile('cypress/fixtures/state/store.json').then((store_res) => { - let cc = JSON.parse(store_res.credentials) - cy.getAccessToken(cc.clientId, cc.clientSecret).then(() => { - cy.get('@accessTokenResponse').then((token_res: any) => { - token = token_res.body.access_token - }) - }) - }) - }) +// it('Get the authorization token for the service account created with out "Content.Publish" permission', () => { +// cy.readFile('cypress/fixtures/state/store.json').then((store_res) => { +// let cc = JSON.parse(store_res.credentials) +// cy.getAccessToken(cc.clientId, cc.clientSecret).then(() => { +// cy.get('@accessTokenResponse').then((token_res: any) => { +// token = token_res.body.access_token +// }) +// }) +// }) +// }) - it('Prepare the Request Specification for the API', () => { - cy.get('@api').then(({ documentation }: any) => { - cy.setHeaders(documentation.headers) - cy.setAuthorizationToken(token) - cy.setRequestBody(documentation.body) - }) - }) +// it('Prepare the Request Specification for the API', () => { +// cy.get('@api').then(({ documentation }: any) => { +// cy.setHeaders(documentation.headers) +// cy.setAuthorizationToken(token) +// cy.setRequestBody(documentation.body) +// }) +// }) - it('Verify that the document is not published without "Content.Publish" permission', () => { - cy.get('@api').then(({ documentation }: any) => { - cy.makeAPIRequest(documentation.endPoint, 'PUT').then((response:any) => { - expect(response.apiRes.status).to.be.equal(401) - expect(response.apiRes.body.message).contain('Missing authorization scope') - }) - }) - }) +// it('Verify that the document is not published without "Content.Publish" permission', () => { +// cy.get('@api').then(({ documentation }: any) => { +// cy.makeAPIRequest(documentation.endPoint, 'PUT').then((response:any) => { +// expect(response.apiRes.status).to.be.equal(401) +// expect(response.apiRes.body.message).contain('Missing authorization scope') +// }) +// }) +// }) - after(() => { - cy.logout() - cy.clearLocalStorage({ log: true }) - cy.deleteAllCookies() - }) -}) +// after(() => { +// cy.logout() +// cy.clearLocalStorage({ log: true }) +// cy.deleteAllCookies() +// }) +// }) From 1c867624d16e75d5fca5b45fdaeefd5c76bb43f8 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Fri, 12 Jul 2024 16:02:43 -0700 Subject: [PATCH 27/54] fix visit for detailPath --- e2e/cypress/pageObjects/namespace.ts | 2 +- e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts | 2 +- .../tests/12-access-permission/05-namespace-manage.cy.ts | 2 +- .../tests/12-access-permission/06-credential-issuer.cy.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/e2e/cypress/pageObjects/namespace.ts b/e2e/cypress/pageObjects/namespace.ts index 8175f6439..b38b5227b 100644 --- a/e2e/cypress/pageObjects/namespace.ts +++ b/e2e/cypress/pageObjects/namespace.ts @@ -6,7 +6,7 @@ class NameSpacePage { consumersLink: string = '[data-testid="ns-manage-link-Consumers"]' activityLink: string = '[data-testid="ns-action-link-Activity"]' authorizationProfileLink: string = '[data-testid="ns-action-link-Authorization Profiles"]' - namespaceAccessLink: string = '[data-testid="ns-action-link-Namespace Access"]' + namespaceAccessLink: string = '[data-testid="ns-action-link-Administration Access"]' serviceAccountsLink: string = '[data-testid="ns-action-link-Service Accounts"]' deleteNamespaceLink: string = '[data-testid="ns-action-link-delete"]' diff --git a/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts b/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts index e04d87551..614b291f6 100644 --- a/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts +++ b/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts @@ -59,7 +59,7 @@ describe('Delete created resources', () => { it('Delete Namespace', () => { cy.get('@common-testdata').then(({ deleteResources }: any) => { - cy.visit(ns.path) + cy.visit(ns.detailPath) ns.deleteNamespace(deleteResources.namespace) }) }) diff --git a/e2e/cypress/tests/12-access-permission/05-namespace-manage.cy.ts b/e2e/cypress/tests/12-access-permission/05-namespace-manage.cy.ts index 24845021a..66afc0807 100644 --- a/e2e/cypress/tests/12-access-permission/05-namespace-manage.cy.ts +++ b/e2e/cypress/tests/12-access-permission/05-namespace-manage.cy.ts @@ -81,7 +81,7 @@ describe('Verify that Wendy is able to see all the options for the Namespace', ( }) it('Verify that all the namespace options and activities are displayed', () => { - cy.visit(ns.path) + cy.visit(ns.detailPath) ns.verifyThatAllOptionsAreDisplayed() }) diff --git a/e2e/cypress/tests/12-access-permission/06-credential-issuer.cy.ts b/e2e/cypress/tests/12-access-permission/06-credential-issuer.cy.ts index 6710c4f3e..546f83e40 100644 --- a/e2e/cypress/tests/12-access-permission/06-credential-issuer.cy.ts +++ b/e2e/cypress/tests/12-access-permission/06-credential-issuer.cy.ts @@ -79,7 +79,7 @@ describe('Verify that Wendy is able to generate authorization profile', () => { }) it('Verify that only Authorization Profile option is displayed in Namespace page', () => { - cy.visit(ns.path) + cy.visit(ns.detailPath) ns.verifyThatOnlyAuthorizationProfileLinkIsExist() }) From f708302cd21435d41a138c6d778f3ba1c890deaf Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Fri, 12 Jul 2024 16:37:49 -0700 Subject: [PATCH 28/54] fix test for namespace in org --- e2e/cypress/tests/15-aps-api/01-create-api.cy.ts | 2 +- e2e/cypress/tests/15-aps-api/02-organization.cy.ts | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts b/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts index 48cbb2175..2c3733ddc 100644 --- a/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts +++ b/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts @@ -45,7 +45,7 @@ describe('Create API Spec', () => { namespace = response.gatewayId cy.log('New namespace created: ' + namespace) cy.updateJsonValue('common-testdata.json', 'apiTest.namespace', namespace) - cy.updateJsonValue('api.json', 'organization.expectedNamespace.name', namespace) + cy.updateJsonValue('api-v2.json', 'organization.expectedNamespace.name', namespace) // cy.updateJsonValue('apiowner.json', 'clientCredentials.clientIdSecret.product.environment.name.config.serviceName', 'cc-service-for-' + namespace) cy.executeCliCommand("gwa config set --gateway " + namespace) }); diff --git a/e2e/cypress/tests/15-aps-api/02-organization.cy.ts b/e2e/cypress/tests/15-aps-api/02-organization.cy.ts index d1eb2fb56..98b89c92d 100644 --- a/e2e/cypress/tests/15-aps-api/02-organization.cy.ts +++ b/e2e/cypress/tests/15-aps-api/02-organization.cy.ts @@ -77,7 +77,12 @@ describe('Verify /Organization/{Org} end point', () => { cy.makeAPIRequest(organization.endPoint + '/' + organization.orgName, 'GET').then((response:any) => { expect(response.apiRes.status).to.be.equal(200) cy.addToAstraScanIdList(response.astraRes.body.status) - assert.isTrue(Cypress._.isEqual(response.apiRes.body.orgUnits[0], organization.orgExpectedList)) + assert.isTrue( + response.apiRes.body.orgUnits.some((orgUnit: any) => + Cypress._.isEqual(orgUnit, organization.orgExpectedList) + ), + 'Expected org unit not found in orgUnits' + ); }) }) }) @@ -174,9 +179,8 @@ describe('Get the Namespace associated with the organization', () => { it('Compare the Namespace values in response against the expected values', () => { cy.get('@api').then(({ organization }: any) => { - expectedResponse = organization.expectedNamespace - // assert.isTrue(Cypress._.isEqual(response, expectedResponse)) - cy.compareJSONObjects(response, expectedResponse, true) + expectedResponse = organization.expectedNamespace.name + expect(nameSpace).to.deep.equal(expectedResponse) }) }) From 51bcd29f6a2001b25411512443c05078bbd66fcf Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Fri, 12 Jul 2024 16:56:30 -0700 Subject: [PATCH 29/54] fix more tests --- .../tests/15-aps-api/05-authorizationProfiles.cy.ts | 2 +- e2e/cypress/tests/15-aps-api/08-namespaces.cy.ts | 2 +- e2e/cypress/tests/19-api-v3/02-organization.ts | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/e2e/cypress/tests/15-aps-api/05-authorizationProfiles.cy.ts b/e2e/cypress/tests/15-aps-api/05-authorizationProfiles.cy.ts index 32204afe6..107373d66 100644 --- a/e2e/cypress/tests/15-aps-api/05-authorizationProfiles.cy.ts +++ b/e2e/cypress/tests/15-aps-api/05-authorizationProfiles.cy.ts @@ -242,7 +242,7 @@ describe('Deleted shared auth profile', () => { cy.getUserSessionTokenValue(apiTest.namespace).then((value) => { userSession = value namespace = apiTest.namespace - home.useNamespace(namespace); + cy.activateGateway(namespace); }) }) }) diff --git a/e2e/cypress/tests/15-aps-api/08-namespaces.cy.ts b/e2e/cypress/tests/15-aps-api/08-namespaces.cy.ts index 952135bc0..afaa14800 100644 --- a/e2e/cypress/tests/15-aps-api/08-namespaces.cy.ts +++ b/e2e/cypress/tests/15-aps-api/08-namespaces.cy.ts @@ -178,7 +178,7 @@ describe('API Tests for Create Namespace', () => { cy.makeAPIRequest(namespaces.endPoint, 'POST').then((res:any) => { expect(res.apiRes.status).to.be.equal(200) cy.addToAstraScanIdList(res.astraRes.body.status) - expect(res.apiRes.body.displayName).to.be.equal(null) + expect(res.apiRes.body.displayName).to.be.equal("janis's Gateway") nameSpace = res.apiRes.body.name }) }) diff --git a/e2e/cypress/tests/19-api-v3/02-organization.ts b/e2e/cypress/tests/19-api-v3/02-organization.ts index 23fbaf756..67438850b 100644 --- a/e2e/cypress/tests/19-api-v3/02-organization.ts +++ b/e2e/cypress/tests/19-api-v3/02-organization.ts @@ -53,16 +53,17 @@ describe('Organization', () => { }) it('GET /organizations/{org}/access', () => { + // ignore specific member contents since previous tests will have created members const match = { name: 'ministry-of-health', parent: '/ca.bc.gov', - members: [], - } - + }; + cy.callAPI('ds/api/v3/organizations/ministry-of-health/access', 'GET').then( ({ apiRes: { status, body } }: any) => { - expect(status).to.be.equal(200) - expect(JSON.stringify(body)).to.be.equal(JSON.stringify(match)) + expect(status).to.be.equal(200); + expect(body).to.include(match); + expect(body.members).to.be.an('array'); } ) }) @@ -169,7 +170,7 @@ describe('Organization', () => { resourceType: 'organization', scopes: ['GroupAccess.Manage', 'Namespace.Assign', 'Dataset.Manage'], }, - { resourceType: 'namespace', scopes: ['Gateway.View'] }, + { resourceType: 'namespace', scopes: ['Namespace.View'] }, ], }, } From 9ba282dfa33006ed158394910e367315012724fd Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Mon, 15 Jul 2024 12:57:34 -0700 Subject: [PATCH 30/54] remove unused cmds --- e2e/cypress/tests/15-aps-api/01-create-api.cy.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts b/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts index 2c3733ddc..f479aea8d 100644 --- a/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts +++ b/e2e/cypress/tests/15-aps-api/01-create-api.cy.ts @@ -34,20 +34,12 @@ describe('Create API Spec', () => { }) }) - it('Set token with gwa config command', () => { - cy.exec('gwa config set --token ' + userSession, { timeout: 3000, failOnNonZeroExit: false }).then((response) => { - expect(response.stdout).to.contain("Config settings saved") - }); - }) - it('create namespace', () => { cy.createGateway().then((response) => { namespace = response.gatewayId cy.log('New namespace created: ' + namespace) cy.updateJsonValue('common-testdata.json', 'apiTest.namespace', namespace) cy.updateJsonValue('api-v2.json', 'organization.expectedNamespace.name', namespace) - // cy.updateJsonValue('apiowner.json', 'clientCredentials.clientIdSecret.product.environment.name.config.serviceName', 'cc-service-for-' + namespace) - cy.executeCliCommand("gwa config set --gateway " + namespace) }); }) From 34cedce4c68f0027d1261b58f26fe4ad30d6302e Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Mon, 15 Jul 2024 12:57:48 -0700 Subject: [PATCH 31/54] update cmd name --- e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts b/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts index 614b291f6..8184634be 100644 --- a/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts +++ b/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts @@ -64,7 +64,7 @@ describe('Delete created resources', () => { }) }) - it('Verify that the deleted namespace does not display in namespace list', () => { + it('Verify that the deleted namespace cannot be activated', () => { cy.on('fail', (err, runnable) => { flag = false }) From e7aeb730e2fdaae0dc9328c9ec6bf573ea8b7542 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Mon, 15 Jul 2024 14:56:37 -0700 Subject: [PATCH 32/54] remove unused from home.ts --- e2e/cypress/pageObjects/home.ts | 51 --------------------------------- 1 file changed, 51 deletions(-) diff --git a/e2e/cypress/pageObjects/home.ts b/e2e/cypress/pageObjects/home.ts index de617a848..782a0bcd1 100644 --- a/e2e/cypress/pageObjects/home.ts +++ b/e2e/cypress/pageObjects/home.ts @@ -1,57 +1,6 @@ class HomePage { - nsDropdown: string = '[data-testid=ns-dropdown-btn]' - nsDropdownCreateNsBtn: string = '[data-testid=ns-dropdown-create-btn]' - nsDropdownManageNsBtn: string = '[data-testid=ns-dropdown-manage-btn]' - namespaceNameInput: string = '[data-testid=ns-modal-name-input]' - nsCreateBtn: string = '[data-testid=ns-modal-create-btn]' - nsSelectNamespace: string = '[data-testid=ns-dropdown-item-]' userMenu: string = '[data-testid=auth-menu-user]' - manageNamespace: string = '[data-testid="ns-dropdown-manage-btn"]' - confirmDeleteNamespaceBtn: string = '[data-testid="confirm-delete-namespace-btn"]' - namespaceCancelBtn: string = '[data-testid="ns-modal-cancel-btn"]' gatewaysNavButtom: string = '[data-testid="navbar-link-Gateways"]' - - useNamespace(name: string): Boolean { - var flag = new Boolean(false); - cy.get(this.nsDropdown).click() - cy.get(this.getNamespaceTestId(name)).click() - cy.wait(5000) // wait for dropdown to have latest text - cy.get(this.nsDropdown).then(($el) => { - expect($el.text().trim()).to.eq(name) - flag = true - }) - return flag - } - - getNamespaceTestId(name: string): string { - return '[data-testid=ns-dropdown-item-' + name + ']' - } - - deleteNamespace(name: string) { - cy.get(this.nsDropdown).click() - cy.get(this.manageNamespace).click() - cy.get(`[data-testid=${name}-namespace-delete-btn]`).click() - cy.get(this.confirmDeleteNamespaceBtn).click() - } - - validateNamespaceName(name: any) { - cy.get(this.nsDropdown).click() - cy.get(this.nsDropdownCreateNsBtn).click() - let namespaceName: Array = name - namespaceName.forEach((accessName) => { - cy.get(this.namespaceNameInput).clear() - cy.get(this.namespaceNameInput).type(accessName) - cy.get(this.nsCreateBtn).click() - cy.wait(1000) - cy.get(this.namespaceNameInput).next('div').then(($ele) => { - let validationMessage = $ele.text() - assert.equal(validationMessage,"Namespace name must be between 5 and 15 alpha-numeric lowercase characters and start and end with an alphabet.") - }) - // cy.verifyToastMessage("Namespace create failed") - }) - cy.get(this.namespaceCancelBtn).click() - } - } export default HomePage From 68033cf09768ffbf03a5d599f7c7f458bb6db40c Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Mon, 15 Jul 2024 15:18:51 -0700 Subject: [PATCH 33/54] check nav bar links by user idp --- e2e/cypress/fixtures/apiowner.json | 6 +++ e2e/cypress/pageObjects/home.ts | 4 ++ .../10-identity-provider.cy.ts | 49 +++++++++++++++++++ local/keycloak/master-realm.json | 39 +++++++++++++++ src/nextapp/shared/data/links.ts | 2 +- 5 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 e2e/cypress/tests/12-access-permission/10-identity-provider.cy.ts diff --git a/e2e/cypress/fixtures/apiowner.json b/e2e/cypress/fixtures/apiowner.json index 76339d7a7..8c36109c9 100644 --- a/e2e/cypress/fixtures/apiowner.json +++ b/e2e/cypress/fixtures/apiowner.json @@ -791,5 +791,11 @@ "name": "dev" } } + }, + "githubUser": { + "credentials": { + "username": "janis@github", + "password": "awsummer" + } } } \ No newline at end of file diff --git a/e2e/cypress/pageObjects/home.ts b/e2e/cypress/pageObjects/home.ts index 782a0bcd1..b7092d16c 100644 --- a/e2e/cypress/pageObjects/home.ts +++ b/e2e/cypress/pageObjects/home.ts @@ -1,6 +1,10 @@ class HomePage { userMenu: string = '[data-testid=auth-menu-user]' + apiDirectoryNavButtom: string = '[data-testid="navbar-link-API Directory"]' + accessNavButtom: string = '[data-testid="navbar-link-My Access"]' + applicationsNavButtom: string = '[data-testid="navbar-link-Applications"]' gatewaysNavButtom: string = '[data-testid="navbar-link-Gateways"]' + } export default HomePage diff --git a/e2e/cypress/tests/12-access-permission/10-identity-provider.cy.ts b/e2e/cypress/tests/12-access-permission/10-identity-provider.cy.ts new file mode 100644 index 000000000..bc28ff60a --- /dev/null +++ b/e2e/cypress/tests/12-access-permission/10-identity-provider.cy.ts @@ -0,0 +1,49 @@ +import HomePage from '../../pageObjects/home' +import LoginPage from '../../pageObjects/login' +import NameSpacePage from '../../pageObjects/namespace' + +describe('Confirm users can see the proper nav bar items', () => { + const login = new LoginPage() + const home = new HomePage() + const ns = new NameSpacePage() + + before(() => { + cy.visit('/') + cy.deleteAllCookies() + cy.reload() + }) + + beforeEach(() => { + cy.preserveCookies() + cy.fixture('apiowner').as('apiowner') + cy.fixture('common-testdata').as('common-testdata') + cy.visit(login.path) + }) + + it('authenticates Janis (api owner) - IDIR', () => { + cy.get('@apiowner').then(({ user }: any) => { + cy.login(user.credentials.username, user.credentials.password) + cy.get(home.apiDirectoryNavButtom).should('be.visible') + cy.get(home.accessNavButtom).should('be.visible') + cy.get(home.applicationsNavButtom).should('be.visible') + cy.get(home.gatewaysNavButtom).should('be.visible') + }) + }) + + it('authenticates Janis (api owner) - GitHub', () => { + cy.get('@apiowner').then(({ githubUser }: any) => { + cy.login(githubUser.credentials.username, githubUser.credentials.password, true) + cy.get(home.apiDirectoryNavButtom).should('be.visible') + cy.get(home.accessNavButtom).should('be.visible') + cy.get(home.applicationsNavButtom).should('be.visible') + cy.get(home.gatewaysNavButtom).should('not.exist') + }) + }) + + afterEach(() => { + cy.logout() + cy.clearLocalStorage({ log: true }) + cy.deleteAllCookies() + }) + +}) diff --git a/local/keycloak/master-realm.json b/local/keycloak/master-realm.json index 80e884ff3..338da6ef2 100644 --- a/local/keycloak/master-realm.json +++ b/local/keycloak/master-realm.json @@ -966,6 +966,45 @@ "notBefore": 0, "groups": [] }, + { + "id": "bf498a7b-b6e0-49bb-9ea8-0241d7792fe3", + "createdTimestamp": 1642463435902, + "username": "janis@github", + "enabled": true, + "totp": false, + "emailVerified": false, + "firstName": "Janis", + "lastName": "Smith", + "email": "janis@testmail.com", + "attributes": { + "provider_user_guid": ["220469E037C84A7ABDFAB15204A607C6"], + "identity_provider": ["github"], + "display_name": ["Janis@github"], + "provider_username": ["janis"] + }, + "credentials": [ + { + "id": "6aa0a7ca-c2ad-43f5-9bdb-3f58693b28bd", + "type": "password", + "createdDate": 1642466403247, + "secretData": "{\"value\":\"ltS/DMUYOCSmZZRbf7rYFTpLa9cqQDewFO1jwRPczU99leiyGtOCsbdAPRmSvLVhOLnzqvcaua3B17ej2d6/7w==\",\"salt\":\"ZrR/QMSRwruFRU5FsPUgHQ==\"}", + "credentialData": "{\"hashIterations\":27500,\"algorithm\":\"pbkdf2-sha256\"}" + } + ], + "disableableCredentialTypes": [], + "requiredActions": [], + "realmRoles": [ + "uma_authorization", + "aps-admin", + "offline_access", + "api-owner" + ], + "clientRoles": { + "account": ["manage-account", "view-profile"] + }, + "notBefore": 0, + "groups": [] + }, { "id": "7f9dcdfc-6100-4ec8-ba3f-8bd26d184585", "createdTimestamp": 1623537499547, diff --git a/src/nextapp/shared/data/links.ts b/src/nextapp/shared/data/links.ts index ad80a39c7..e3191da12 100644 --- a/src/nextapp/shared/data/links.ts +++ b/src/nextapp/shared/data/links.ts @@ -49,7 +49,7 @@ const links: NavLink[] = [ { name: 'Gateways', url: '/manager/gateways', - access: ['portal-user'], + access: ['idir-user'], altUrls: [ '/manager/gateways/get-started', '/manager/gateways/detail', From 00c59bcff7c5e7b488786dd5650d7371d0f7ffd7 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Mon, 15 Jul 2024 15:26:31 -0700 Subject: [PATCH 34/54] update test data dependencies --- e2e/test-data-dependencies.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/e2e/test-data-dependencies.md b/e2e/test-data-dependencies.md index 4cff415ea..b813512a5 100644 --- a/e2e/test-data-dependencies.md +++ b/e2e/test-data-dependencies.md @@ -59,8 +59,9 @@ | │   06-shared-idp.cy.ts | Folder 01-api-key and 02-client-credential-flow and 9.1 to 9.5 | | │   07-kong-public-auth.ts | Folder 01-api-key and 02-client-credential-flow and 9.1 to 9.6 | | │   08-protected-externally.ts | Folder 01-api-key and 02-client-credential-flow and 9.1 to 9.7 | +| │   09-two-tiered-hidden.cy.ts | NA | | 10-clear-resources | | -| │   01-create-api.cy.ts | | +| │   01-create-api.cy.ts | NA (CONFIRM: Is this accurate?) | | │   02-team-access.cy.ts | 10.1 | | │   03-rqst-access.cy.ts | 10.1 to 10.2 | | │   04-delete-consumer.ts | 10.1 to 10.3 | @@ -79,6 +80,7 @@ | │   07-namespace-view.cy.ts | 12.1 to 12.2 | | │   08-gateway-config.cy.ts | 12.1 to 12.2 | | │   09-content-publish.cy.ts | 12.1 to 12.2 | +| │   10-identity-provider.cy.ts | NA | | 13-namespace-preview-mode | | | │   01-create-api.cy.ts | NA | | │   02-namespace-preview-mode.cy.ts | 13.1 | @@ -102,8 +104,16 @@ | │   02-cli-generate-config.ts | 16.1 | | 17-delete-application | | | │   01-delete-application-without-access.cy.ts | NA | -| │   02-delete-application-with-pending-request.cy.ts | 17.1 | +| │   02-delete-application-with-pending-request.cy.ts | 17.1 (CONFIRM: requires product, created in 01-api-key?) | | │   03-delete-application-with-approved-request.cy.ts | 17.1 to 17.2 | | │   04-delete-namespace-gwa.ts | 17.1 to 17.3 | | 18-scan-astra-result | | -|     01-store-and-scan-astra-result.ts | NA | \ No newline at end of file +| |   01-store-and-scan-astra-result.ts | NA | +| 19-api-v3 | | +| |   01-api-directory.cy.ts | ? | +| |   02-organization.cy.ts | ? | +| |   03-gateways.cy.ts | ? | +| |   04-products.cy.ts | ? | +| |   05-issuers.cy.ts | ? | +| |   06-identifiers.cy.ts | ? | +| |   07-endpoints.cy.ts | ? | \ No newline at end of file From d7807ec6597f9161a4baac07b98678d4cdf2e3d6 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Mon, 15 Jul 2024 15:56:34 -0700 Subject: [PATCH 35/54] check for My Access instead of Gateways on login --- e2e/cypress/support/auth-commands.ts | 2 +- .../tests/12-access-permission/10-identity-provider.cy.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/cypress/support/auth-commands.ts b/e2e/cypress/support/auth-commands.ts index d26565e07..4bec56630 100644 --- a/e2e/cypress/support/auth-commands.ts +++ b/e2e/cypress/support/auth-commands.ts @@ -61,7 +61,7 @@ Cypress.Commands.add('login', (username: string, password: string, skipFlag = fa } if (!skipFlag) { - cy.get(home.gatewaysNavButtom, { timeout: 6000 }).then(($el) => { + cy.get(home.accessNavButtom, { timeout: 6000 }).then(($el) => { expect($el).to.exist expect($el).to.be.visible }) diff --git a/e2e/cypress/tests/12-access-permission/10-identity-provider.cy.ts b/e2e/cypress/tests/12-access-permission/10-identity-provider.cy.ts index bc28ff60a..2bf1ff884 100644 --- a/e2e/cypress/tests/12-access-permission/10-identity-provider.cy.ts +++ b/e2e/cypress/tests/12-access-permission/10-identity-provider.cy.ts @@ -32,7 +32,7 @@ describe('Confirm users can see the proper nav bar items', () => { it('authenticates Janis (api owner) - GitHub', () => { cy.get('@apiowner').then(({ githubUser }: any) => { - cy.login(githubUser.credentials.username, githubUser.credentials.password, true) + cy.login(githubUser.credentials.username, githubUser.credentials.password) cy.get(home.apiDirectoryNavButtom).should('be.visible') cy.get(home.accessNavButtom).should('be.visible') cy.get(home.applicationsNavButtom).should('be.visible') From c2f342308c42184691c12f7761456e1454dc9ea0 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Mon, 15 Jul 2024 16:28:02 -0700 Subject: [PATCH 36/54] fix user session --- .../09-update-product-env/06-shared-idp.cy.ts | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts b/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts index d1e219b57..1c8fcbdbd 100644 --- a/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts +++ b/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts @@ -14,7 +14,7 @@ describe('Apply Shared IDP while creating Authorization Profile', () => { var nameSpace: string const home = new HomePage() const authProfile = new AuthorizationProfile() - let userSession: string + let userSession: any before(() => { cy.visit('/') @@ -32,19 +32,25 @@ describe('Apply Shared IDP while creating Authorization Profile', () => { cy.visit(login.path) }) - it('authenticates Janis (api owner) to get the user session token', () => { + it('Authenticates api owner', () => { + cy.get('@apiowner').then(({ user }: any) => { + cy.login(user.credentials.username, user.credentials.password) + }) + }) + + it('Activates the namespace', () => { cy.getUserSession().then(() => { - cy.get('@apiowner').then(({ user }: any) => { - cy.get('@common-testdata').then(({ namespace }: any) => { - cy.login(user.credentials.username, user.credentials.password) - cy.activateGateway(namespace) - cy.get('@login').then(function (xhr: any) { - userSession = xhr.headers['x-auth-request-access-token'] - }) + cy.get('@common-testdata').then(({ namespace }: any) => { + nameSpace = namespace + cy.activateGateway(namespace) + cy.get('@login').then(function (xhr: any) { + userSession = xhr.headers['x-auth-request-access-token'] }) }) }) }) + + it('Prepare the Request Specification for the API', () => { cy.get('@api').then(({ authorizationProfiles }: any) => { From ab6873863ce27ab72c97f4f817d862af7b85bed0 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Mon, 15 Jul 2024 19:26:26 -0700 Subject: [PATCH 37/54] fix user session again --- .../09-update-product-env/06-shared-idp.cy.ts | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts b/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts index 1c8fcbdbd..ba7fb01c6 100644 --- a/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts +++ b/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts @@ -49,8 +49,6 @@ describe('Apply Shared IDP while creating Authorization Profile', () => { }) }) }) - - it('Prepare the Request Specification for the API', () => { cy.get('@api').then(({ authorizationProfiles }: any) => { @@ -88,6 +86,7 @@ describe('Update IDP issuer for shared IDP profile', () => { const login = new LoginPage() const home = new HomePage() + var nameSpace: string let userSession: string const authProfile = new AuthorizationProfile() @@ -103,20 +102,26 @@ describe('Update IDP issuer for shared IDP profile', () => { cy.visit(login.path) }) - it('authenticates Janis (api owner) to get the user session token', () => { + it('Activates the namespace', () => { cy.getUserSession().then(() => { - cy.get('@apiowner').then(({ user }: any) => { - cy.get('@common-testdata').then(({ namespace }: any) => { - cy.login(user.credentials.username, user.credentials.password) - cy.activateGateway(namespace) - cy.get('@login').then(function (xhr: any) { - userSession = xhr.headers['x-auth-request-access-token'] - }) + cy.get('@common-testdata').then(({ namespace }: any) => { + nameSpace = namespace + cy.activateGateway(namespace) + cy.get('@login').then(function (xhr: any) { + userSession = xhr.headers['x-auth-request-access-token'] }) }) }) }) + it('Prepare the Request Specification for the API', () => { + cy.get('@api').then(({ authorizationProfiles }: any) => { + cy.setHeaders(authorizationProfiles.headers) + cy.setAuthorizationToken(userSession) + cy.setRequestBody(authorizationProfiles.shared_IDP_body) + }) + }) + it('Prepare the Request Specification for the API', () => { cy.get('@api').then(({ authorizationProfiles }: any) => { cy.setHeaders(authorizationProfiles.headers) From bdb12523aba92a68be03c7e0f958efd6f220b42a Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Tue, 16 Jul 2024 16:20:16 -0700 Subject: [PATCH 38/54] modify redirect for no namespaces --- src/nextapp/shared/services/auth/auth-context.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nextapp/shared/services/auth/auth-context.tsx b/src/nextapp/shared/services/auth/auth-context.tsx index 89a51e16d..8ba742274 100644 --- a/src/nextapp/shared/services/auth/auth-context.tsx +++ b/src/nextapp/shared/services/auth/auth-context.tsx @@ -37,10 +37,11 @@ export const AuthProvider: React.FC = ({ children }) => { route?.access && route?.access.length > 0 && route?.access.indexOf('portal-user') == -1 && + route?.access.indexOf('idir-user') == -1 && !session.user.namespace; if (isUnauthorizedProvider) { - router?.push('/'); + router?.push('/manager/gateways'); return <>; } From f2a89efe4c029d9d196645324a0c2ddfed5ed1fb Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Tue, 16 Jul 2024 16:20:45 -0700 Subject: [PATCH 39/54] add NEXT_PUBLIC_GRAFANA_URL for local --- .env.local | 1 + 1 file changed, 1 insertion(+) diff --git a/.env.local b/.env.local index 2582321bd..f71bb9936 100644 --- a/.env.local +++ b/.env.local @@ -31,6 +31,7 @@ NEXT_PUBLIC_DEVELOPER_IDS=idir,bceid,bcsc,github NEXT_PUBLIC_PROVIDER_IDS=idir NEXT_PUBLIC_ACCOUNT_BCEID_URL=https://www.test.bceid.ca/logon.aspx?returnUrl=/profile_management NEXT_PUBLIC_ACCOUNT_BCSC_URL=https://idtest.gov.bc.ca/account/ +NEXT_PUBLIC_GRAFANA_URL=https://grafana-apps-gov-bc-ca.dev.api.gov.bc.ca # For automated integrated testing TEST_PORTAL_CLIENT_ID=aps-portal From 4dc50bfcbdccf9ca86bf2d3be4ceb0d141736535 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Tue, 16 Jul 2024 16:37:14 -0700 Subject: [PATCH 40/54] change test for namespace deletion --- e2e/cypress/support/auth-commands.ts | 11 ++++++-- e2e/cypress/support/global.d.ts | 5 +++- .../05-delete-resources.cy.ts | 26 +++++++++---------- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/e2e/cypress/support/auth-commands.ts b/e2e/cypress/support/auth-commands.ts index 4bec56630..7fefa1942 100644 --- a/e2e/cypress/support/auth-commands.ts +++ b/e2e/cypress/support/auth-commands.ts @@ -101,7 +101,7 @@ Cypress.Commands.add('createGateway', (gatewayid?: string, displayname?: string) ) }) -Cypress.Commands.add('activateGateway', (gatewayId: string) => { +Cypress.Commands.add('activateGateway', (gatewayId: string, checkNoNamespace: boolean = false) => { const getAllNsQuery = ` query GetNamespaces { allNamespaces { @@ -127,9 +127,16 @@ query GetNamespaces { if (nsdata) { return nsdata.id } else { - throw new Error('Namespace not found') + if (checkNoNamespace) { + return 'Namespace not found' + } else { + throw new Error('Namespace not found') + } } }).then((namespaceId) => { + if (namespaceId === 'Namespace not found') { + return namespaceId; + } // then activate the namespace cy.setHeaders({ 'Content-Type': 'application/json' }) cy.callAPI(`admin/switch/${namespaceId}`, 'PUT') diff --git a/e2e/cypress/support/global.d.ts b/e2e/cypress/support/global.d.ts index 88486ef10..81cac185e 100644 --- a/e2e/cypress/support/global.d.ts +++ b/e2e/cypress/support/global.d.ts @@ -33,7 +33,10 @@ declare namespace Cypress { displayname?: string, ): Chainable - activateGateway(gatewayId: string): Chainable> + activateGateway( + gatewayId: string, + checkNoNamespace?: boolean + ): Chainable> saveState( key: string, diff --git a/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts b/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts index 8184634be..ffba0be3d 100644 --- a/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts +++ b/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts @@ -25,10 +25,11 @@ describe('Delete created resources', () => { cy.visit(login.path) }) - it('authenticates Janis (api owner)', () => { + it.only('authenticates Janis (api owner)', () => { cy.get('@apiowner').then(({ user }: any) => { cy.get('@common-testdata').then(({ deleteResources }: any) => { cy.login(user.credentials.username, user.credentials.password) + cy.createGateway(deleteResources.namespace) cy.activateGateway(deleteResources.namespace); }) }) @@ -57,26 +58,23 @@ describe('Delete created resources', () => { sa.deleteAllServiceAccounts() }) - it('Delete Namespace', () => { + it.only('Delete Namespace', () => { cy.get('@common-testdata').then(({ deleteResources }: any) => { cy.visit(ns.detailPath) ns.deleteNamespace(deleteResources.namespace) + cy.wait(5000) }) }) - it('Verify that the deleted namespace cannot be activated', () => { - cy.on('fail', (err, runnable) => { - flag = false - }) + it.only('Verify that the deleted namespace cannot be activated', () => { cy.get('@common-testdata').then(({ deleteResources }: any) => { - flag = true - cy.activateGateway(deleteResources.namespace) - }) - }) - - it('Verify that the namespace is deleted', () => { - assert.equal(flag, false) - }) + cy.wrap(null).then(() => { + return cy.activateGateway(deleteResources.namespace, true); + }).then((result) => { + expect(result).to.eq('Namespace not found'); + }); + }); + }); after(() => { cy.logout() From abcfd1b813015c9caf292c5b8fd9f8dd313b7929 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Tue, 16 Jul 2024 16:37:39 -0700 Subject: [PATCH 41/54] remove unused namespace var --- e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts b/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts index ba7fb01c6..77d95cf19 100644 --- a/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts +++ b/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts @@ -11,7 +11,6 @@ import Products from '../../pageObjects/products' describe('Apply Shared IDP while creating Authorization Profile', () => { const login = new LoginPage() - var nameSpace: string const home = new HomePage() const authProfile = new AuthorizationProfile() let userSession: any @@ -41,7 +40,6 @@ describe('Apply Shared IDP while creating Authorization Profile', () => { it('Activates the namespace', () => { cy.getUserSession().then(() => { cy.get('@common-testdata').then(({ namespace }: any) => { - nameSpace = namespace cy.activateGateway(namespace) cy.get('@login').then(function (xhr: any) { userSession = xhr.headers['x-auth-request-access-token'] @@ -86,12 +84,12 @@ describe('Update IDP issuer for shared IDP profile', () => { const login = new LoginPage() const home = new HomePage() - var nameSpace: string let userSession: string const authProfile = new AuthorizationProfile() before(() => { cy.visit('/') + cy.reload(true) }) beforeEach(() => { @@ -105,7 +103,6 @@ describe('Update IDP issuer for shared IDP profile', () => { it('Activates the namespace', () => { cy.getUserSession().then(() => { cy.get('@common-testdata').then(({ namespace }: any) => { - nameSpace = namespace cy.activateGateway(namespace) cy.get('@login').then(function (xhr: any) { userSession = xhr.headers['x-auth-request-access-token'] From 5bc1171aa6bb8787699fcb284d818dd013d9713a Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Tue, 16 Jul 2024 18:13:16 -0700 Subject: [PATCH 42/54] minor fixes --- .../tests/09-update-product-env/06-shared-idp.cy.ts | 6 ++++++ .../tests/10-clear-resources/05-delete-resources.cy.ts | 7 +++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts b/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts index 77d95cf19..e6e6adefb 100644 --- a/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts +++ b/e2e/cypress/tests/09-update-product-env/06-shared-idp.cy.ts @@ -100,6 +100,12 @@ describe('Update IDP issuer for shared IDP profile', () => { cy.visit(login.path) }) + it('Authenticates api owner', () => { + cy.get('@apiowner').then(({ user }: any) => { + cy.login(user.credentials.username, user.credentials.password) + }) + }) + it('Activates the namespace', () => { cy.getUserSession().then(() => { cy.get('@common-testdata').then(({ namespace }: any) => { diff --git a/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts b/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts index ffba0be3d..8b0ccb33c 100644 --- a/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts +++ b/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts @@ -25,11 +25,10 @@ describe('Delete created resources', () => { cy.visit(login.path) }) - it.only('authenticates Janis (api owner)', () => { + it('authenticates Janis (api owner)', () => { cy.get('@apiowner').then(({ user }: any) => { cy.get('@common-testdata').then(({ deleteResources }: any) => { cy.login(user.credentials.username, user.credentials.password) - cy.createGateway(deleteResources.namespace) cy.activateGateway(deleteResources.namespace); }) }) @@ -58,7 +57,7 @@ describe('Delete created resources', () => { sa.deleteAllServiceAccounts() }) - it.only('Delete Namespace', () => { + it('Delete Namespace', () => { cy.get('@common-testdata').then(({ deleteResources }: any) => { cy.visit(ns.detailPath) ns.deleteNamespace(deleteResources.namespace) @@ -66,7 +65,7 @@ describe('Delete created resources', () => { }) }) - it.only('Verify that the deleted namespace cannot be activated', () => { + it('Verify that the deleted namespace cannot be activated', () => { cy.get('@common-testdata').then(({ deleteResources }: any) => { cy.wrap(null).then(() => { return cy.activateGateway(deleteResources.namespace, true); From c7680dc0c936c453813f0bb7b02c51bc693fd874 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Tue, 16 Jul 2024 18:43:26 -0700 Subject: [PATCH 43/54] revert orgs/ns comparison --- e2e/cypress/tests/15-aps-api/02-organization.cy.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/cypress/tests/15-aps-api/02-organization.cy.ts b/e2e/cypress/tests/15-aps-api/02-organization.cy.ts index 98b89c92d..48f115569 100644 --- a/e2e/cypress/tests/15-aps-api/02-organization.cy.ts +++ b/e2e/cypress/tests/15-aps-api/02-organization.cy.ts @@ -179,8 +179,8 @@ describe('Get the Namespace associated with the organization', () => { it('Compare the Namespace values in response against the expected values', () => { cy.get('@api').then(({ organization }: any) => { - expectedResponse = organization.expectedNamespace.name - expect(nameSpace).to.deep.equal(expectedResponse) + expectedResponse = organization.expectedNamespace + cy.compareJSONObjects(response, expectedResponse, true) }) }) From 58e8ea5134017292dee295caf4ab1b685373e830 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Tue, 16 Jul 2024 20:09:57 -0700 Subject: [PATCH 44/54] improve test output format in GHA --- .github/workflows/aps-cypress-e2e.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/aps-cypress-e2e.yaml b/.github/workflows/aps-cypress-e2e.yaml index 05f74427d..9876d3d0d 100644 --- a/.github/workflows/aps-cypress-e2e.yaml +++ b/.github/workflows/aps-cypress-e2e.yaml @@ -106,7 +106,7 @@ jobs: run: | FAILURE_COUNT=$(cat ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json | jq '.stats.failures') if [[ "$FAILURE_COUNT" -gt 0 ]]; then - FAILED_TESTS=$(cat ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json | jq '.results | .[] | .suites | .[].tests | .[] | select(.fail==true) | .title') + FAILED_TESTS=$(jq -r '.results[] | {file: .file, suites: .suites[]} | .suites as $suite | {file: .file, failed_tests: ($suite.tests[] | select(.fail == true) | {title})} | select(.failed_tests != null) | "- " + (.file | split("/") | .[2:] | join("/")) + " - " + .failed_tests.title' ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json) STATS=$(cat ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json | jq '.stats') echo -e "Stats: $STATS\n\nFailed Tests:\n$FAILED_TESTS\n\nRun Link: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" > msg export MSG=$(cat msg) From afa61fa590cd527a27881e3cce048847baac818c Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Wed, 17 Jul 2024 09:31:40 -0700 Subject: [PATCH 45/54] check deletion w/ API response --- e2e/cypress/pageObjects/namespace.ts | 13 +++++++++++++ .../10-clear-resources/05-delete-resources.cy.ts | 6 +++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/e2e/cypress/pageObjects/namespace.ts b/e2e/cypress/pageObjects/namespace.ts index b38b5227b..a5d8483c0 100644 --- a/e2e/cypress/pageObjects/namespace.ts +++ b/e2e/cypress/pageObjects/namespace.ts @@ -35,8 +35,21 @@ class NameSpacePage { } deleteNamespace(name: string) { + cy.intercept('POST', 'gql/api', (req) => { + if (req.body.query.includes('DeleteNamespace')) { + req.alias = 'delete-namespace'; + } + }); cy.get(this.deleteNamespaceLink).click() cy.contains('button', 'Yes, Delete').click() + cy.wait('@delete-namespace').then((interception) => { + const response = interception.response; + console.log(response); + if (response) { + expect(response.statusCode).to.eq(200); + expect(response.body.data.forceDeleteNamespace).to.eq(true); + } + }); } } diff --git a/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts b/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts index 8b0ccb33c..2a3032c0a 100644 --- a/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts +++ b/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts @@ -61,9 +61,9 @@ describe('Delete created resources', () => { cy.get('@common-testdata').then(({ deleteResources }: any) => { cy.visit(ns.detailPath) ns.deleteNamespace(deleteResources.namespace) - cy.wait(5000) - }) - }) + }); + }); + it('Verify that the deleted namespace cannot be activated', () => { cy.get('@common-testdata').then(({ deleteResources }: any) => { From 878dd458e8d55b6d4315b46571b03c0cad667f8d Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Wed, 17 Jul 2024 16:05:11 -0700 Subject: [PATCH 46/54] verify ns deletion via allNamepsaces gql --- e2e/cypress/pageObjects/namespace.ts | 13 ----------- e2e/cypress/support/auth-commands.ts | 22 +++++++++++++++++++ e2e/cypress/support/global.d.ts | 7 ++++++ .../05-delete-resources.cy.ts | 10 +++++---- 4 files changed, 35 insertions(+), 17 deletions(-) diff --git a/e2e/cypress/pageObjects/namespace.ts b/e2e/cypress/pageObjects/namespace.ts index a5d8483c0..b38b5227b 100644 --- a/e2e/cypress/pageObjects/namespace.ts +++ b/e2e/cypress/pageObjects/namespace.ts @@ -35,21 +35,8 @@ class NameSpacePage { } deleteNamespace(name: string) { - cy.intercept('POST', 'gql/api', (req) => { - if (req.body.query.includes('DeleteNamespace')) { - req.alias = 'delete-namespace'; - } - }); cy.get(this.deleteNamespaceLink).click() cy.contains('button', 'Yes, Delete').click() - cy.wait('@delete-namespace').then((interception) => { - const response = interception.response; - console.log(response); - if (response) { - expect(response.statusCode).to.eq(200); - expect(response.body.data.forceDeleteNamespace).to.eq(true); - } - }); } } diff --git a/e2e/cypress/support/auth-commands.ts b/e2e/cypress/support/auth-commands.ts index 7fefa1942..2c52f515f 100644 --- a/e2e/cypress/support/auth-commands.ts +++ b/e2e/cypress/support/auth-commands.ts @@ -147,6 +147,28 @@ query GetNamespaces { }) }) +Cypress.Commands.add('getGateways', () => { + const getAllNsQuery = ` +query GetNamespaces { + allNamespaces { + id + name + } +} +` + cy.log('< Getting namespaces - ') + // get the (true) id for the namespace + cy.setHeaders({ 'Content-Type': 'application/json' }) + return cy.gqlQuery(getAllNsQuery).then((response) => { + const allNamespaces = response.apiRes.body.data.allNamespaces + if (allNamespaces) { + return allNamespaces + } else { + throw new Error('Namespaces could not be retrieved') + } + }) +}) + Cypress.Commands.add('getLastConsumerID', () => { let id: any cy.get('[data-testid="all-consumer-control-tbl"]') diff --git a/e2e/cypress/support/global.d.ts b/e2e/cypress/support/global.d.ts index 81cac185e..a96743847 100644 --- a/e2e/cypress/support/global.d.ts +++ b/e2e/cypress/support/global.d.ts @@ -2,6 +2,11 @@ /// declare namespace Cypress { + interface Namespace { + id: string; + name: string; + } + interface Chainable { login(username: string, password: string, skipFlag?: boolean): Chainable @@ -38,6 +43,8 @@ declare namespace Cypress { checkNoNamespace?: boolean ): Chainable> + getGateways(): Chainable + saveState( key: string, value: string, diff --git a/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts b/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts index 2a3032c0a..80699d7c4 100644 --- a/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts +++ b/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts @@ -64,13 +64,15 @@ describe('Delete created resources', () => { }); }); - - it('Verify that the deleted namespace cannot be activated', () => { + it('Verify that namespace is no longer available', () => { cy.get('@common-testdata').then(({ deleteResources }: any) => { cy.wrap(null).then(() => { - return cy.activateGateway(deleteResources.namespace, true); + return cy.getGateways(); }).then((result) => { - expect(result).to.eq('Namespace not found'); + console.log(result); + const namespaceNames = result.map((ns: { name: any }) => ns.name); + console.log(namespaceNames); + expect(namespaceNames).to.not.include(deleteResources.namespace); }); }); }); From aa0b6352e98cafef29b41f306d79a81b838fc5ad Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Wed, 17 Jul 2024 16:10:34 -0700 Subject: [PATCH 47/54] make stats prettier --- .github/workflows/aps-cypress-e2e.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/aps-cypress-e2e.yaml b/.github/workflows/aps-cypress-e2e.yaml index 9876d3d0d..7ecef4a37 100644 --- a/.github/workflows/aps-cypress-e2e.yaml +++ b/.github/workflows/aps-cypress-e2e.yaml @@ -107,7 +107,7 @@ jobs: FAILURE_COUNT=$(cat ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json | jq '.stats.failures') if [[ "$FAILURE_COUNT" -gt 0 ]]; then FAILED_TESTS=$(jq -r '.results[] | {file: .file, suites: .suites[]} | .suites as $suite | {file: .file, failed_tests: ($suite.tests[] | select(.fail == true) | {title})} | select(.failed_tests != null) | "- " + (.file | split("/") | .[2:] | join("/")) + " - " + .failed_tests.title' ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json) - STATS=$(cat ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json | jq '.stats') + STATS=$(cat ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json | jq -r '.stats | to_entries | map("\(.key)\t\(.value)") | .[]' | column -t) echo -e "Stats: $STATS\n\nFailed Tests:\n$FAILED_TESTS\n\nRun Link: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" > msg export MSG=$(cat msg) gh issue create --title "FAILED: Automated Tests($FAILURE_COUNT)" --body "$MSG" --label "automation" --assignee "${{ env.GIT_COMMIT_AUTHOR }}" From 63645684799bfde8fafb91fd42fe42c826e193ec Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Wed, 17 Jul 2024 16:11:08 -0700 Subject: [PATCH 48/54] bump version for upload-artifact --- .github/workflows/aps-cypress-e2e.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/aps-cypress-e2e.yaml b/.github/workflows/aps-cypress-e2e.yaml index 7ecef4a37..d1b1399b1 100644 --- a/.github/workflows/aps-cypress-e2e.yaml +++ b/.github/workflows/aps-cypress-e2e.yaml @@ -71,7 +71,7 @@ jobs: path: ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json - name: Upload E2E Code Coverage Report - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: code-coverage path: ${{ github.workspace }}/e2e/coverage From 12b4ba63ee5504f754e6be3cf2f8e3c572b3f6e3 Mon Sep 17 00:00:00 2001 From: Russell Vinegar <38586679+rustyjux@users.noreply.github.com> Date: Thu, 18 Jul 2024 06:45:17 -0700 Subject: [PATCH 49/54] Add wait after delete ns --- e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts b/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts index 80699d7c4..9b534c679 100644 --- a/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts +++ b/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts @@ -61,6 +61,7 @@ describe('Delete created resources', () => { cy.get('@common-testdata').then(({ deleteResources }: any) => { cy.visit(ns.detailPath) ns.deleteNamespace(deleteResources.namespace) + cy.wait(5000) }); }); From 99e2c99993f48771deef0317e758e51d0b62c775 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Thu, 18 Jul 2024 08:09:02 -0700 Subject: [PATCH 50/54] extend wait --- e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts b/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts index 9b534c679..23fb01161 100644 --- a/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts +++ b/e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts @@ -61,12 +61,13 @@ describe('Delete created resources', () => { cy.get('@common-testdata').then(({ deleteResources }: any) => { cy.visit(ns.detailPath) ns.deleteNamespace(deleteResources.namespace) - cy.wait(5000) + cy.wait(10000) }); }); it('Verify that namespace is no longer available', () => { cy.get('@common-testdata').then(({ deleteResources }: any) => { + cy.visit('/') cy.wrap(null).then(() => { return cy.getGateways(); }).then((result) => { From d30b4a641dd89c4be791913f4f493c6969ef349b Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Thu, 18 Jul 2024 12:26:24 -0700 Subject: [PATCH 51/54] yml --> yaml in cli --- e2e/cypress/tests/16-gwa-cli/02-cli-generate-config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/cypress/tests/16-gwa-cli/02-cli-generate-config.ts b/e2e/cypress/tests/16-gwa-cli/02-cli-generate-config.ts index 845bb4f19..8f0e0a1aa 100644 --- a/e2e/cypress/tests/16-gwa-cli/02-cli-generate-config.ts +++ b/e2e/cypress/tests/16-gwa-cli/02-cli-generate-config.ts @@ -46,12 +46,12 @@ describe('Verify CLI commands for generate/apply config', () => { it('Check gwa command to generate config for client credential template', () => { cy.executeCliCommand('gwa generate-config --template client-credentials-shared-idp --service my-service --upstream https://httpbin.org --org ministry-of-health --org-unit planning-and-innovation-division').then((response) => { - expect(response.stdout).to.contain("File gw-config.yml created") + expect(response.stdout).to.contain("File gw-config.yaml created") }); }) it('Check gwa command to apply generated config', () => { - cy.executeCliCommand('gwa apply -i gw-config.yml').then((response) => { + cy.executeCliCommand('gwa apply -i gw-config.yaml').then((response) => { let wordOccurrences = (response.stdout.match(/\bcreated\b/g) || []).length; expect(wordOccurrences).to.equal(3) namespace = response.stdout.match(/\bgw-\w+/g)[0] From 551dcc6f404906a5cdd0e5dc4e352f4abf26b124 Mon Sep 17 00:00:00 2001 From: Russell Vinegar Date: Mon, 22 Jul 2024 13:35:14 -0700 Subject: [PATCH 52/54] remove isDisabled from help menu --- src/nextapp/components/auth-action/help-menu.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/nextapp/components/auth-action/help-menu.tsx b/src/nextapp/components/auth-action/help-menu.tsx index 72434d4f5..5de7dedad 100644 --- a/src/nextapp/components/auth-action/help-menu.tsx +++ b/src/nextapp/components/auth-action/help-menu.tsx @@ -33,7 +33,6 @@ const HelpMenu: React.FC = () => { > Date: Mon, 22 Jul 2024 13:42:00 -0700 Subject: [PATCH 53/54] add keys to avoid lack of unique key React warning --- src/nextapp/pages/manager/gateways/list.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nextapp/pages/manager/gateways/list.tsx b/src/nextapp/pages/manager/gateways/list.tsx index 6d71f29cb..22bbea2ed 100644 --- a/src/nextapp/pages/manager/gateways/list.tsx +++ b/src/nextapp/pages/manager/gateways/list.tsx @@ -211,7 +211,7 @@ const MyGatewaysPage: React.FC = () => { {actions.map((action) => ( - + @@ -273,6 +273,7 @@ const MyGatewaysPage: React.FC = () => { ) .map((namespace) => ( Date: Mon, 22 Jul 2024 13:55:05 -0700 Subject: [PATCH 54/54] eliminate svg size attribute errors --- src/nextapp/components/auth-action/auth-action.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/nextapp/components/auth-action/auth-action.tsx b/src/nextapp/components/auth-action/auth-action.tsx index 9bf11837d..c47884f3c 100644 --- a/src/nextapp/components/auth-action/auth-action.tsx +++ b/src/nextapp/components/auth-action/auth-action.tsx @@ -142,7 +142,6 @@ const Signin: React.FC = ({ site }) => {