Skip to content

Commit

Permalink
feat(ESSNTL-4365): Select rows in the groups table (#1775)
Browse files Browse the repository at this point in the history
  • Loading branch information
gkarat authored Mar 1, 2023
1 parent 72e017e commit 2d81ac7
Show file tree
Hide file tree
Showing 11 changed files with 534 additions and 62 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ Inventory frontend has support for https://github.com/stoplightio/prism CLI. The

1. Verify package.json `config` section for the correct URL to OpenAPI schema (contains remote URL by default).
2. Verify dev.webpack.config.js `customProxy` settings. There you can specify which endpoints to proxy and modify request/response headers.
3. Run `npm run start:mock` to start the mock server and webpack server in parallel.
3. Run `npm run mock-server` to start the mock server. The fist output must list the endpoints that are generated by the localhost server.
4. In another terminal, run `npm run start:mock` or `npm run start:mock:beta` to start the webpack server either in stage-stable or stabe-beta environment. The scripts set the MOCK variable to true and the customProxy is enabled.

## Inventory table and detail

Expand Down
27 changes: 14 additions & 13 deletions config/cypress.webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@ const webpack = require('webpack');
const config = require('@redhat-cloud-services/frontend-components-config');

const { config: webpackConfig, plugins } = config({
rootFolder: resolve(__dirname, '../')
/* Uncomment when working with local mock server:
customProxy: [
{
context: ['/api/inventory/v1/groups'], // you can adjust the `context` value to redirect only specific endpoints
target: 'http://localhost:4010', // default prism port
secure: false,
changeOrigin: true,
pathRewrite: { '^/api/inventory/v1': '' },
onProxyReq: (proxyReq) => {
proxyReq.setHeader('x-rh-identity', 'foobar'); // avoid 401 errors by providing neccessary security header
rootFolder: resolve(__dirname, '../'),
...process.env.MOCK && {
customProxy: [
{
context: ['/api/inventory/v1/groups'], // you can adjust the `context` value to redirect only specific endpoints
target: 'http://localhost:4010', // default prism port
secure: false,
changeOrigin: true,
pathRewrite: { '^/api/inventory/v1': '' },
onProxyReq: (proxyReq) => {
proxyReq.setHeader('x-rh-identity', 'foobar'); // avoid 401 errors by providing neccessary security header
}
}
}
] */
]
}
});

plugins.push(new webpack.DefinePlugin({
Expand Down
57 changes: 25 additions & 32 deletions cypress/fixtures/groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -907,39 +907,32 @@
"host_ids": null
},
{
"updated_at": "1987-05-08T22:00:00.0Z",
"name": "do",
"id": "3ECf99c9842A81cA47Cd7A5380E64Fb8",
"host_ids": null,
"created_at": "1988-09-18T22:00:00.0Z"
},
{
"name": "sunt sed dolore anim",
"id": "A2b64d6Db97b08eF4ACBae16EACceA5D",
"created_at": "1971-10-22T00:00:00.0Z",
"name": "magna deserunt esse",
"id": "BB2DF02D-9EeF-ABB0-B2D9-cFe21Cef6B88",
"updated_at": "2019-03-21T23:00:00.0Z",
"created_at": "2018-03-27T22:00:00.0Z",
"host_ids": [
"f57d7dfFfBC9DCfda554dc4fF24d95aB",
"F2C5c2df-Dc37-efDb-1754-CE03A0812cAa",
"EAeFf0De-Eb4B-fEAA-D427-DaEA31dABdDb",
"e9EA62CC102BDfDeE6B02C8cbe652a03",
"6eEd6Bc1cFDdAB547DBA0B7eD5da6715",
"eE6315d6F26Af0EDb25eAC1Dc2f82348",
"EEEC2AB5-de5b-284e-E2a7-07F7c2feDed1",
"2D5Dc09201C413ecB58a0DaAdbbDeb93",
"B496aE97-B57C-32ee-3d85-aCfFed52fEfA",
"7CD7dDee8F4F4D0179a8D6ec66d4Db28",
"238CEea5-7cdA-b9C7-976E-1Bd8a4ec2b94",
"75BdeeEd-c04F-DcaC-aeA7-b74AB2AEFF1f",
"32D9FCA9-beF3-fD1E-54A7-b59326D7Fa10",
"bbfCe27AAAE0C396Ef25aafE68E64ddB",
"53Dd9a5134DcF5989Ad01260E38EDE75",
"33fBF1Ec-FA1D-d1A8-6dd3-F57de513A8Fa",
"F584Cb3C-C64A-c58D-B3C2-88FbaD9Cb6Be",
"16E5FABcDee394BCAedbBE2Ea9BDb789",
"abE6a1A5bAA28dBf748ffa292F500247",
"1b5acfDECa9eCD9dCC2eE51b68Cb8faE"
],
"updated_at": "1961-06-19T23:00:00.0Z"
"00fcC027-F4e3-aB4D-3eB9-392B09E4E9eC",
"82c882beA274db74bA79Dad9695CDdcD",
"374ECeB4-4aA6-637a-A5d8-eBD40A51EED8",
"12f6cdf2-fBcA-EF8A-3cC1-739627825F5B",
"37F4D8D9-A1Bd-cEE7-1Bcc-A03A20589B1B",
"ab29a822dA3259bf4a80A586Bd2e16E0",
"0ed9cfebEb3bfdB9A6F51757008dFB2F",
"4ddCF8Ee4a5DF968CBCaaaed16F5c55f",
"3cfF3e49-35Af-fD3E-62eb-c4eBDa0Ac3fF",
"8ce37289-4B8f-cECF-a3db-94f9F9ACB45a",
"Fd60B4f79D74507bDE8be6913caFDa8e",
"Ba8B79ab5adC8E41e255D5f8aDb8f1F3",
"BbEAB14B-9A1f-eDFB-9c3B-eF0C6b6CB4dF",
"14FA22F08BBFf6f9738cBED71aFf66eE",
"fcF870cc-8C3C-8ba9-FcdA-dff79Ba0e2dE",
"38B60BDf17c9E6C9Cdd11840aCb4e804",
"C306bEc5EAF6BfD025fa6f48b3BeAF43",
"83CE42Eadccd8b2e5E5Aca1eaBAB55aa",
"4da9f2C5d6C1Ce6EE2f3D7BBC974E7c3",
"CaaE8C2e-C67c-41b3-5EB8-5Fd233eC9FdC"
]
}
],
"total": 60
Expand Down
141 changes: 141 additions & 0 deletions cypress/fixtures/groupsSecondPage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"count": 10,
"page": 2,
"per_page": 50,
"results": [
{
"updated_at": "1987-05-08T22:00:00.0Z",
"name": "do",
"id": "3ECf99c9842A81cA47Cd7A5380E64Fb8",
"host_ids": null,
"created_at": "1988-09-18T22:00:00.0Z"
},
{
"host_ids": [
"4BebFdcc-C4Ff-b33a-919c-1BF6881cbFaD",
"c2C02181-a7dF-21F8-3fd1-a46df62A3899",
"fcE0E6e1E6a18170ceab3CF6CaCA919a",
"994151FAE74dC8FB131CaDfa5E21ebfa",
"2F43e9D5bE9b5Bca58EB9d4eded20cEc",
"b1347a78640A2Fe04FBb8d988fA4Ff07",
"Ca7a74De1d87aFAd9cE5DE2dcAc907Da",
"51AdFfbCd4E56Ed3EF6b8F4eA0F1c898",
"9dfeEC0e-8B1f-5D13-2Fd4-485eD034670B",
"Ba75cD3FCEf38EAeA3Df99EE63FAcBfD",
"8238a28d-CD64-BfdE-9cA6-725B5e7E0fBE",
"af34016BC98Bc2Ab9bC1BAaFcD88dD9d",
"cDEEe3B1-0b1A-0Cfb-F9cB-f1d5dD28adEc",
"cdAFed185E199D90a5f651B39Bd055FB",
"94373fbAbEb5e579882Edf6606E3bFB6",
"ecfc6c9b-5cec-A7b3-6f59-4c8CaDC4f0D9",
"DfC5C1d1AF5D95D2D0fACf5A82ecd7c3",
"d1EabD24-9b40-ee6F-e4ee-Ede7cB1A9CCF",
"5a7AeAf8b831146DEeC711F7B78c1c4E",
"d5aBb0b3-B6c5-bbaE-5F53-e2FA3FBa167c"
],
"updated_at": "1951-09-11T23:00:00.0Z",
"name": "a",
"id": "97dCc7a0-95C9-3B58-b3Ca-E7ef9CE1d2F3",
"created_at": "1994-03-31T22:00:00.0Z"
},
{
"id": "FF5d81BD-9fC7-dcA0-fEdc-5f1abAfDFc10",
"created_at": "2002-04-20T22:00:00.0Z",
"updated_at": "1968-05-24T23:00:00.0Z",
"host_ids": null,
"name": "sed aliqua id"
},
{
"name": "laboris tempor",
"updated_at": "1943-08-23T22:00:00.0Z",
"host_ids": [
"68e9105C-B9ec-4B46-4444-e6bbDAa17d91",
"FD41eDD1-B301-1ABA-10FD-8701e5fC24E2",
"aA8a5BF8-14c0-Ba2B-B6DC-e9aCDCF33D7A",
"B0FC00FE6aB8FF1CDf6CD0F6aA46B5aF",
"13dEB2dB-C780-C5eA-D616-AFeF8ACB35cC",
"f5732cbf5337Bc38fBf24ABc0C8e08EB",
"9dCddCada5c6a9E84B3b54e7e6BB76Db",
"E08095ceDcD902a8e65bbAeAda1ddcF5",
"E562cD7144381bbb1b22bcC52aE33E01",
"EfCB50CD-cEb8-0BE1-0a7A-4A7D3FbB5370",
"66BA41C6-3a93-6D56-cD87-5cCBfc3fEDF0",
"fb04fd2F-61aA-39c0-b091-AcadA51Ab4cc",
"BFACF89cc9A31cD405789999B1Ecda0C",
"342a6934-941C-3d5f-8fDb-0Cd8172Bb6Fe",
"cFC8704dD4FCBAaA1cD4A44FB6AEDd68",
"B7EC0a53BDF86E7De9f15E4686C3fdBc",
"F0455C0928d63CC4B6871c810f4204a4",
"4ea8E3c0-eDEa-CCb8-D9a0-6dF26fbD93af",
"1b7028E2CF6dd9A0CDCCde47D16302ec",
"aAc253AA-5d38-a5f3-108F-8B7571314ad6"
],
"created_at": "2001-01-28T23:00:00.0Z",
"id": "da23F7B06DA2A52e670e9d162cC03F62"
},
{
"id": "89a07eC7-C6Ed-2Fc7-D414-7518f6169D03",
"name": "in sed aliquip ullamco",
"updated_at": "2020-04-24T22:00:00.0Z",
"created_at": "2020-03-06T23:00:00.0Z",
"host_ids": null
},
{
"host_ids": null,
"name": "Duis culpa labore incididunt",
"updated_at": "1979-04-19T22:00:00.0Z",
"created_at": "2017-02-12T23:00:00.0Z",
"id": "7bdE6521-4ed6-41bc-BEf7-fD03dD7E8aeC"
},
{
"created_at": "2013-11-23T00:00:00.0Z",
"updated_at": "2019-02-22T23:00:00.0Z",
"id": "Be5415b9-0ecE-7DF1-f2BA-382CaBA21Fca",
"name": "culpa dolor in ipsum",
"host_ids": null
},
{
"name": "eiusmod culpa exercitation deserunt cupidatat",
"host_ids": [
"F14482ee-C99f-cF6f-AEd1-e11A3409F07e",
"81F19F47a9ed61EE7eF8a5fE22c2c610",
"BfDb1d6cFDaEc2502B06f1E07DF560dF",
"DA7CAfF9-f105-CfE2-0Ac5-11C7e77343B4",
"3aCdE735EE81C5F24F3bF28fB2c5ACB8",
"DfE5dB4D-bea2-Ecf9-fAFD-aED7AcAebb5C",
"fcAC90d9512afA72C7ad152Dfff41b6D",
"D99fE5B31611447b1EcDa4fADC4a4835",
"9e6DB70c709de879C7Fc52AAC0E2ff74",
"94bCccCf-dda0-39eF-e1A8-6D0AF053F3Dd",
"1FEF51FaBDBA2a3F9f6fEc0cA65B37Ea",
"2CE6986F-64ea-DcdC-b2C3-FBbFeB89FFc0",
"cafa4Cfd-66ac-7aB4-F3Eb-a9bEEA636e1d",
"1412ffAF-2A6C-d9Aa-BcFc-e2A52826FAFF",
"0D54ABaF-Db2f-07E3-AE71-E3cA8aCEe5E0",
"efCBC90FAc19423f2afB24cf2add7A42",
"AEed41eA7c9d2FB18FFBCE3cbD98ADa0",
"F84d35a7-21Ae-7EB9-fEfF-Bc26f3df7Fa1",
"eb2aDbAC-2CAd-0EA0-FAA1-Ee3a888E1dF0",
"B5a5ffB84c0073f2a25D364e8F7e902f"
],
"id": "7625Eea9De3C5f0C13f2BbA4F20196fD",
"updated_at": "2000-10-14T00:00:00.0Z",
"created_at": "1971-08-04T23:00:00.0Z"
},
{
"updated_at": "1949-11-14T00:00:00.0Z",
"host_ids": null,
"created_at": "1951-11-13T00:00:00.0Z",
"id": "0042eB156eF4EA0Dcc2dbD4AF6FdC401",
"name": "quis"
},
{
"id": "7b4BFE1F-A9AC-F7Bf-c565-dD5E4E2AD7c6",
"name": "laboris",
"updated_at": "2003-01-24T23:00:00.0Z",
"host_ids": null,
"created_at": "1977-05-14T23:00:00.0Z"
}
],
"total": 60
}
3 changes: 3 additions & 0 deletions cypress/support/interceptors.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
/* eslint-disable camelcase */
import { DEFAULT_ROW_COUNT } from '@redhat-cloud-services/frontend-components-utilities';
import fixtures from '../fixtures/groups.json';
import groupsSecondPage from '../fixtures/groupsSecondPage.json';
import groupDetailFixtures from '../fixtures/groups/620f9ae75A8F6b83d78F3B55Af1c4b2C.json';

export const groupsInterceptors = {
'successful with some items': () =>
cy.intercept('GET', '/api/inventory/v1/groups*', fixtures).as('getGroups'),
'successful with some items second page': () =>
cy.intercept('GET', '/api/inventory/v1/groups?*page=2&perPage=50*', groupsSecondPage).as('getGroupsSecond'),
'successful empty': () =>
cy
.intercept('GET', '/api/inventory/v1/groups*', {
Expand Down
Loading

0 comments on commit 2d81ac7

Please sign in to comment.