Skip to content

Commit 3553228

Browse files
committed
Merge branch 'improvement/replace-form-components' into q/124.0
2 parents 04e37b2 + 43173b5 commit 3553228

File tree

18 files changed

+2138
-2720
lines changed

18 files changed

+2138
-2720
lines changed

shell-ui/package-lock.json

Lines changed: 746 additions & 833 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

shell-ui/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"@fortawesome/fontawesome-svg-core": "^1.2.36",
5151
"@fortawesome/free-solid-svg-icons": "^5.15.4",
5252
"@fortawesome/react-fontawesome": "^0.2.0",
53-
"@scality/core-ui": "github:scality/core-ui#v0.46.0",
53+
"@scality/core-ui": "github:scality/core-ui#v0.55.0",
5454
"@scality/module-federation": "github:scality/module-federation.git#1.1.0",
5555
"canvas": "^2.9.3",
5656
"oidc-client": "^1.11.3",
@@ -70,6 +70,7 @@
7070
"react-to-webcomponent": "^1.5.1",
7171
"react-virtualized": "^9.22.3",
7272
"styled-components": "^5.2.1",
73+
"styled-system": "^5.1.5",
7374
"vega": "^5.17.3",
7475
"vega-embed": "^6.0.0",
7576
"vega-lite": "^5.0.0",

shell-ui/webpack.common.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ module.exports = {
105105
eager: true,
106106
requiredVersion: deps['styled-components'],
107107
},
108+
'styled-system': {
109+
singleton: true,
110+
eager: true,
111+
requiredVersion: deps['styled-system'],
112+
},
108113
'react-dom': {
109114
singleton: true,
110115
eager: true,

ui/cypress/integration/e2e/Volumes/steps.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { And, Then, When } from 'cypress-cucumber-preprocessor/steps';
2+
import '@testing-library/cypress/add-commands';
23

34
And('I am on the volume creation page', () => {
45
cy.visit('/volumes');
@@ -21,14 +22,23 @@ When('I fill out the volume creation form using:', (dataTable) => {
2122
cy.get('[data-cy=add-volume-labels-button]').click();
2223

2324
// node name
24-
cy.get('.sc-select').eq(0).click();
25-
cy.get('.sc-select__menu').eq(0).click();
26-
27-
cy.get('.sc-select').eq(1).click();
28-
cy.get('.sc-select__menu').find('[data-cy=storageClass-metalk8s]').click();
29-
30-
cy.get('.sc-select').eq(2).click();
31-
cy.get('.sc-select__menu').find(`[data-cy="type-${volumeType}"]`).click();
25+
cy.findByText(/node \*/i)
26+
.closest('label')
27+
.invoke('attr', 'for')
28+
.then((htmlFor) => cy.get(`#${htmlFor}`).click());
29+
cy.findAllByRole('option').then(options => options[0].click());
30+
31+
cy.findByText(/storage class \*/i)
32+
.closest('label')
33+
.invoke('attr', 'for')
34+
.then((htmlFor) => cy.get(`#${htmlFor}`).click());
35+
cy.findByRole('option', { name: new RegExp(`metalk8s`, 'i') }).click();
36+
37+
cy.findByText(/type \*/i)
38+
.closest('label')
39+
.invoke('attr', 'for')
40+
.then((htmlFor) => cy.get(`#${htmlFor}`).click());
41+
cy.findByRole('option', { name: new RegExp(`${volumeType}`, 'i') }).click();
3242

3343
cy.get('input[name=sizeInput]').type(volumeSize);
3444
});

ui/cypress/integration/volume/volume_creation_form.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ describe('the create button when creating sparseloop volume', () => {
1818
});
1919

2020
it('should be disabled before adding the valid label', () => {
21-
cy.findByPlaceholderText(/Enter label name/i).type(VOLUME_LABEL_NAME);
22-
cy.findByPlaceholderText(/Enter label value/i).type(VOLUME_LABEL_VALUE);
21+
cy.findByPlaceholderText(/Example: name/i).type(VOLUME_LABEL_NAME);
22+
cy.findByPlaceholderText(/Example: value/i).type(VOLUME_LABEL_VALUE);
2323

2424
cy.findByRole('button', { name: /create/i }).should('be.disabled');
2525
cy.findByRole('button', { name: /add/i }).should('be.enabled');
2626
});
2727

2828
it('should be disabled as well as the Add button if labelName is not valid', () => {
29-
cy.findByPlaceholderText(/Enter label name/i).type(VOLUME_LABEL_INVALID);
30-
cy.findByPlaceholderText(/Enter label value/i).type(VOLUME_LABEL_VALUE);
29+
cy.findByPlaceholderText(/Example: name/i).type(VOLUME_LABEL_INVALID);
30+
cy.findByPlaceholderText(/Example: value/i).type(VOLUME_LABEL_VALUE);
3131

3232
cy.findByRole('button', { name: /create/i }).should('be.disabled');
3333
cy.findByRole('button', { name: /add/i }).should('be.disabled');

ui/cypress/support/commands.js

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -262,22 +262,27 @@ const VOLUME_SIZE = '1 GiB';
262262
Cypress.Commands.add('fillVolumeCreationForm', (volume_type) => {
263263
// The following steps are to fill the required fields of create volume form
264264
cy.get('input[name=name]').type(VOLUME_NAME);
265-
cy.findByText(/node\*/i)
266-
.next('.sc-input-wrapper')
267-
.click();
268265

269-
cy.get('.sc-select__menu').find(`[data-cy=node-${NODE_NAME}]`).click();
270-
cy.findByText(/storage class\*/i)
271-
.next('.sc-input-wrapper')
272-
.click();
273-
/* we use `data-cy` is because the name of storageClass may display in both the select list and selected item,
274-
so we must use unique selector to make sure to choose the item in the list. */
275-
cy.get('.sc-select__menu')
276-
.find(`[data-cy=storageClass-${STORAGECLASS}]`)
277-
.click();
278-
cy.findByText(/type\*/i)
279-
.next('.sc-input-wrapper')
280-
.click();
281-
cy.get('.sc-select__menu').find(`[data-cy="type-${volume_type}"]`).click();
266+
cy.findByText(/node \*/i)
267+
.closest('label')
268+
.invoke('attr', 'for')
269+
.then((htmlFor) => cy.get(`#${htmlFor}`).click());
270+
271+
cy.findByRole('option', {name: new RegExp(`${NODE_NAME}`, 'i')}).click();
272+
273+
cy.findByText(/storage class \*/i)
274+
.closest('label')
275+
.invoke('attr', 'for')
276+
.then((htmlFor) => cy.get(`#${htmlFor}`).click());
277+
278+
cy.findByRole('option', {name: new RegExp(`${STORAGECLASS}`, 'i')}).click();
279+
280+
cy.findByText(/type \*/i)
281+
.closest('label')
282+
.invoke('attr', 'for')
283+
.then((htmlFor) => cy.get(`#${htmlFor}`).click());
284+
285+
cy.findByRole('option', {name: new RegExp(`${volume_type}`, 'i')}).click();
286+
282287
cy.get('input[name=sizeInput]').type(VOLUME_SIZE);
283288
});

0 commit comments

Comments
 (0)