From e77d6fdbf68b258f69db03b77675541944d28ba5 Mon Sep 17 00:00:00 2001 From: Ilya Melnikov <70610034+melil02@users.noreply.github.com> Date: Wed, 9 Jun 2021 13:04:30 -0700 Subject: [PATCH] 5.0.2 release (#23) --- cypress/integration/applications.js | 139 ++++++- packages/example/src/layout/AppBar.js | 2 +- packages/example/src/layout/HomePage.js | 3 +- packages/layer7-apihub-mock/src/data/index.js | 45 +++ .../layer7-apihub-mock/src/defaultData.json | 33 +- .../src/handlers/apiKeys.js | 44 +++ .../src/handlers/apiPlans.js | 9 +- packages/layer7-apihub-mock/src/index.js | 17 +- .../applications/ApiSelector/ApiSelector.js | 109 ++++- .../SelectionList/ApiSelectionListItem.js | 148 +++++-- .../SelectionList/SelectionList.js | 48 ++- .../src/applications/ApplicationActions.js | 171 -------- .../src/applications/ApplicationApisList.js | 16 +- .../src/applications/ApplicationDetails.js | 186 +++++---- .../ApplicationDetailsKeyClient.js | 342 ++++++++++++++++ .../ApplicationDetailsKeyClient.test.js | 134 +++++++ .../src/applications/ApplicationEditView.js | 1 + .../src/applications/ApplicationKeyClient.js | 24 +- .../src/applications/ApplicationList.js | 2 - .../src/applications/ApplicationNew.js | 31 +- .../src/applications/ApplicationShow.js | 21 +- .../AccountSetup/useAccountData.js | 4 +- .../layer7-apihub/src/dataProvider/apiKeys.js | 34 ++ .../layer7-apihub/src/dataProvider/index.js | 2 + packages/layer7-apihub/src/i18n/en.js | 8 +- packages/layer7-apihub/src/i18n/es.js | 6 + packages/layer7-apihub/src/i18n/fr.js | 6 + packages/layer7-apihub/src/i18n/it.js | 6 + packages/layer7-apihub/src/ui/List.js | 6 +- .../layer7-apihub/src/ui/LoadingDialog.js | 45 +++ pom.xml | 2 +- remote-hosting/.gitignore | 2 + remote-hosting/README.md | 13 + remote-hosting/index.js | 26 ++ remote-hosting/package-lock.json | 374 ++++++++++++++++++ remote-hosting/package.json | 13 + yarn.lock | 24 +- 37 files changed, 1674 insertions(+), 422 deletions(-) create mode 100755 packages/layer7-apihub-mock/src/handlers/apiKeys.js delete mode 100755 packages/layer7-apihub/src/applications/ApplicationActions.js create mode 100755 packages/layer7-apihub/src/applications/ApplicationDetailsKeyClient.js create mode 100755 packages/layer7-apihub/src/applications/ApplicationDetailsKeyClient.test.js create mode 100755 packages/layer7-apihub/src/dataProvider/apiKeys.js create mode 100755 packages/layer7-apihub/src/ui/LoadingDialog.js create mode 100755 remote-hosting/.gitignore create mode 100755 remote-hosting/README.md create mode 100755 remote-hosting/index.js create mode 100755 remote-hosting/package-lock.json create mode 100755 remote-hosting/package.json diff --git a/cypress/integration/applications.js b/cypress/integration/applications.js index fa9077566..b03c5ff51 100755 --- a/cypress/integration/applications.js +++ b/cypress/integration/applications.js @@ -61,14 +61,16 @@ describe('Applications', () => { 'Self-enabling global workforce' ); + cy.findByText('JSON Chief Directives').click(); + cy.findByLabelText('API Key / Client ID').should( 'contain', - 'b43b8e38-511a-4234-b533-4264a8fcaa26' + 'l7286a421be91244e79a43faf333fbdd14' ); cy.findByLabelText('Shared Secret / Client Secret').should( 'contain', - 'cf4f15ea-b8c5-453c-8072-9b5115db5eb9' + '********' ); cy.findByLabelText('Callback/Redirect URL(s)').should( @@ -78,10 +80,10 @@ describe('Applications', () => { cy.findByLabelText('Scope').should('contain', 'OOB'); - cy.findByLabelText('Type').should('contain', 'confidential'); + cy.findByLabelText('Type').should('contain', 'public'); }); - it.skip('should show generate secret ', () => { + it('should NOT show Generate New Secret when Application status is APPLICATION_PENDING_APPROVAL for an org user', () => { login('orgPublisher', 'Password@1'); cy.findAllByText('Applications') @@ -90,14 +92,107 @@ describe('Applications', () => { cy.findByTitle('Display as list').click(); - cy.findByTitle('CSS Human Intranet').click({ force: true }); + cy.findByTitle('GB Future Response').click({ force: true }); - cy.findByText('Edit').click(); + // Details + cy.findByLabelText('Generate New Secret').should('not.exist'); + }); - cy.findByLabelText('Generate New Secret').should('exist'); + context('when editing an application', () => { + it('should allow the changing of an API plan on a selected API', () => { + cy.loadData(); + login('orgAdmin', 'Password@1'); + cy.findAllByText('Applications') + .first() + .click(); + + cy.findByTitle('Display as list').click(); + cy.findByTitle('CSS Human Intranet').click({ force: true }); + + // Ignore any errors in the console + cy.on('uncaught:exception', (err, runnable) => { + cy.findByText('Edit').click({ force: true }); + + // Click the first selected API from the selector widget to open the accordion + cy.findByText('SMTP Chief Accounts').click({ force: true }); + + // Click to edit the API plan + cy.findByText('API Plan: API Plan 1'); + cy.findByTitle('Edit').click({ force: true }); + + // Choose a different API plan from the modal + cy.findByText('Select an API Plan (Required)'); + cy.findByText('API Plan 3').click({ force: true }); + + // Accept the terms and conditions of the new API plan + cy.findByText('Lorem ipsum dolor sit amet'); + cy.findByText('I Accept the Terms & Conditions').click({ + force: true, + }); + + // The first API plan should be replaced with the new one chosen + cy.findByText('API Plan: API Plan 3'); + return false; + }); + }); + + it('should show the API key as the default key', () => { + cy.loadData(); + login('orgAdmin', 'Password@1'); + cy.findAllByText('Applications') + .first() + .click(); + + cy.findByTitle('Display as list').click(); + cy.findByTitle('CSS Human Intranet').click({ force: true }); + + // Ignore any errors in the console + cy.on('uncaught:exception', (err, runnable) => { + cy.findByText('Edit').click({ force: true }); + + // Click the first selected API from the selector widget to open the accordion + cy.findByText('SMTP Chief Accounts').click({ force: true }); + + // Click to edit the API plan + cy.findByText('API Plan: API Plan 1'); + cy.findByTitle('Edit').click({ force: true }); + + expect( + cy.findByText('API Key / Client ID').next().innerHTML + ).toEqual('Default'); + + return false; + }); + }); + + it('should display a progress dialog when deleting', () => { + cy.loadData(); + login('orgAdmin', 'Password@1'); + cy.findAllByText('Applications') + .first() + .click(); + + cy.findByTitle('Display as list').click(); + cy.findByTitle('ADP Dynamic Integration').click({ force: true }); + cy.on('uncaught:exception', (err, runnable) => { + cy.findByText('Delete').click({ force: true }); + + cy.findByText( + 'You are about to delete this application. Are you sure?' + ); + + cy.findByText('Delete').click({ force: true }); + + cy.findByText( + 'Undeploying keys and deleting application. This may take several minutes.' + ); + + return false; + }); + }); }); - it('should NOT show Generate New Secret when Application status is APPLICATION_PENDING_APPROVAL for an org user', () => { + it.skip('should show generate secret ', () => { login('orgPublisher', 'Password@1'); cy.findAllByText('Applications') @@ -106,10 +201,11 @@ describe('Applications', () => { cy.findByTitle('Display as list').click(); - cy.findByTitle('GB Future Response').click({ force: true }); + cy.findByTitle('CSS Human Intranet').click({ force: true }); - // Details - cy.findByLabelText('Generate New Secret').should('not.exist'); + cy.findByText('Edit').click(); + + cy.findByLabelText('Generate New Secret').should('exist'); }); it.skip('should show Generate New Secret when Application status is APPLICATION_PENDING_APPROVAL for a portal admin', () => { @@ -126,4 +222,25 @@ describe('Applications', () => { // Details cy.findByLabelText('Generate New Secret').should('exist'); }); + + it.skip('should change the page size', () => { + login('portalAdmin', 'Password@1'); + + cy.findAllByText('Applications') + .first() + .click(); + + cy.get('p.MuiTablePagination-caption').should( + 'have.text', + 'Items per page:1-12 of 25' + ); + cy.get('div.MuiTablePagination-input') + .first() + .click({ force: true }); + cy.findByText('24').click({ force: true }); + cy.get('p.MuiTablePagination-caption').should( + 'have.text', + 'Items per page:1-24 of 25' + ); + }); }); diff --git a/packages/example/src/layout/AppBar.js b/packages/example/src/layout/AppBar.js index c2a1d0bdf..323b13439 100755 --- a/packages/example/src/layout/AppBar.js +++ b/packages/example/src/layout/AppBar.js @@ -36,7 +36,7 @@ export const AppBar = ({ diff --git a/packages/example/src/layout/HomePage.js b/packages/example/src/layout/HomePage.js index 455600f42..3e80349c8 100755 --- a/packages/example/src/layout/HomePage.js +++ b/packages/example/src/layout/HomePage.js @@ -2,7 +2,7 @@ import React from 'react'; import { HomePageContent } from 'layer7-apihub'; import { makeStyles } from '@material-ui/core/styles'; -import { ContentLogo, Footer } from '../ui'; +import { Footer } from '../ui'; export const HomePage = () => { const classes = useStyles(); @@ -11,7 +11,6 @@ export const HomePage = () => { <>
-