From ac17d6ae389a05a7384bf4434e117d5f46ff0e4c Mon Sep 17 00:00:00 2001 From: Aleksandr Voznesenskii Date: Mon, 13 Mar 2023 15:35:30 +0100 Subject: [PATCH 1/2] feat(inventory groups): group detail info + tests --- .../GroupDetailInfo.cy.js | 47 +++++++++++++++++++ .../InventoryGroupDetail/GroupDetailInfo.js | 37 ++++++++++----- 2 files changed, 72 insertions(+), 12 deletions(-) create mode 100644 src/components/InventoryGroupDetail/GroupDetailInfo.cy.js diff --git a/src/components/InventoryGroupDetail/GroupDetailInfo.cy.js b/src/components/InventoryGroupDetail/GroupDetailInfo.cy.js new file mode 100644 index 000000000..0d6382490 --- /dev/null +++ b/src/components/InventoryGroupDetail/GroupDetailInfo.cy.js @@ -0,0 +1,47 @@ +import { mount } from '@cypress/react'; +import React from 'react'; +import { Provider } from 'react-redux'; +import { MemoryRouter } from 'react-router-dom'; +import { getStore } from '../../store'; +import GroupDetailInfo from './GroupDetailInfo'; + +const mountPage = () => + mount( + + + + + + ); + +before(() => { + cy.window().then( + (window) => + (window.insights = { + chrome: { + isProd: false, + auth: { + getUser: () => { + return Promise.resolve({}); + } + } + } + }) + ); +}); + +describe('group detail information page', () => { + it('Title is rendered', () => { + mountPage(); + cy.get('div[class="pf-c-card__title pf-c-title pf-m-md card-title"]').should('have.text', 'User access configuration'); + }); + it('button is present', () => { + mountPage(); + cy.get('button[class="pf-c-button pf-m-secondary pf-m-small"]').should('have.text', 'Manage access'); + }); + it('card text is present', () => { + mountPage(); + cy.get('div[class="pf-c-card__body"]').should + ('have.text', 'Manage your inventory group access configuration under Identity & Access Management > User Access.'); + }); +}); diff --git a/src/components/InventoryGroupDetail/GroupDetailInfo.js b/src/components/InventoryGroupDetail/GroupDetailInfo.js index 01a935077..d88891610 100644 --- a/src/components/InventoryGroupDetail/GroupDetailInfo.js +++ b/src/components/InventoryGroupDetail/GroupDetailInfo.js @@ -1,19 +1,32 @@ -import { EmptyState, EmptyStateBody, Spinner } from '@patternfly/react-core'; -import { InvalidObject } from '@redhat-cloud-services/frontend-components'; +import { + Button, + Card, + CardTitle, + CardBody, + CardHeader, + CardActions } from '@patternfly/react-core'; import React from 'react'; -import { useSelector } from 'react-redux'; const GroupDetailInfo = () => { - const { uninitialized, loading } = useSelector((state) => state.groupDetail); - - // TODO: implement according to mocks - return ( - - - {uninitialized || loading ? : } - - + + + + + + User access configuration + + + Manage your inventory group access configuration under + Identity & Access Management {'>'} User Access. + + ); }; From ce7668bc68a1d42549e1946768cd404fabe4d7f4 Mon Sep 17 00:00:00 2001 From: Aleksandr Voznesenskii Date: Tue, 14 Mar 2023 18:04:13 +0100 Subject: [PATCH 2/2] feat(inventory groups): fixes after review --- .../InventoryGroupDetail/GroupDetailInfo.cy.js | 15 ++++----------- .../InventoryGroupDetail/GroupDetailInfo.js | 10 ++++++---- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/components/InventoryGroupDetail/GroupDetailInfo.cy.js b/src/components/InventoryGroupDetail/GroupDetailInfo.cy.js index 0d6382490..539acb02c 100644 --- a/src/components/InventoryGroupDetail/GroupDetailInfo.cy.js +++ b/src/components/InventoryGroupDetail/GroupDetailInfo.cy.js @@ -1,17 +1,10 @@ import { mount } from '@cypress/react'; import React from 'react'; -import { Provider } from 'react-redux'; -import { MemoryRouter } from 'react-router-dom'; -import { getStore } from '../../store'; import GroupDetailInfo from './GroupDetailInfo'; const mountPage = () => mount( - - - - - + ); before(() => { @@ -33,15 +26,15 @@ before(() => { describe('group detail information page', () => { it('Title is rendered', () => { mountPage(); - cy.get('div[class="pf-c-card__title pf-c-title pf-m-md card-title"]').should('have.text', 'User access configuration'); + cy.get('div[class="pf-c-card__title pf-c-title pf-m-lg card-title"]').should('have.text', 'User access configuration'); }); it('button is present', () => { mountPage(); - cy.get('button[class="pf-c-button pf-m-secondary pf-m-small"]').should('have.text', 'Manage access'); + cy.get('button[class="pf-c-button pf-m-secondary"]').should('have.text', 'Manage access'); }); it('card text is present', () => { mountPage(); cy.get('div[class="pf-c-card__body"]').should - ('have.text', 'Manage your inventory group access configuration under Identity & Access Management > User Access.'); + ('have.text', 'Manage your inventory group user access configuration under Identity & Access Management > User Access.'); }); }); diff --git a/src/components/InventoryGroupDetail/GroupDetailInfo.js b/src/components/InventoryGroupDetail/GroupDetailInfo.js index d88891610..24229e050 100644 --- a/src/components/InventoryGroupDetail/GroupDetailInfo.js +++ b/src/components/InventoryGroupDetail/GroupDetailInfo.js @@ -8,22 +8,24 @@ import { import React from 'react'; const GroupDetailInfo = () => { + const address = window.location.href.includes('beta') ? '/beta/iam/user-access' : '/iam/user-access'; + return ( - - User access configuration + User access configuration - Manage your inventory group access configuration under + Manage your inventory group user access configuration under Identity & Access Management {'>'} User Access.