diff --git a/ui/cypress.config.ts b/ui/cypress.config.ts index 7afd0bf6fe..112d429372 100644 --- a/ui/cypress.config.ts +++ b/ui/cypress.config.ts @@ -1,4 +1,4 @@ -import { defineConfig } from 'cypress' +import { defineConfig } from 'cypress'; export default defineConfig({ env: { @@ -20,14 +20,13 @@ export default defineConfig({ viewportWidth: 1440, viewportHeight: 900, defaultCommandTimeout: 30000, - experimentalNetworkStubbing: true, experimentalFetchPolyfill: true, e2e: { // We've imported your old cypress plugins here. // You may want to clean this up later by importing these. setupNodeEvents(on, config) { - return require('./cypress/plugins/index.js')(on, config) + return require('./cypress/plugins/index.js')(on, config); }, baseUrl: 'http://localhost:8084', }, -}) +}); diff --git a/ui/cypress/support/commands.js b/ui/cypress/support/commands.js index 957810907c..8243e70e5e 100644 --- a/ui/cypress/support/commands.js +++ b/ui/cypress/support/commands.js @@ -32,7 +32,6 @@ import { genValues, } from './mockUtils'; - Cypress.config({ retries: { runMode: 2, @@ -64,7 +63,9 @@ Cypress.Commands.add( cy.intercept('GET', '/config.json', stubConfig); } if (stubUIDiscovery) { - cy.intercept('GET', '/shell/deployed-ui-apps.json', {...stubUIDiscovery }); + cy.intercept('GET', '/shell/deployed-ui-apps.json', { + ...stubUIDiscovery, + }); } cy.intercept('GET', '**/.well-known/runtime-app-configuration*', { @@ -89,7 +90,9 @@ Cypress.Commands.add( statusCode: 500, }); }); - cy.intercept('POST', '**/api/salt/login', { fixture: 'salt-api/login.json' }); + cy.intercept('POST', '**/api/salt/login', { + fixture: 'salt-api/login.json', + }); cy.intercept('GET', '**/api/salt/events*', (req) => req.reply(`data: ${JSON.stringify({})} \n\n`, { 'content-type': 'text/event-stream', @@ -106,7 +109,9 @@ Cypress.Commands.add( { fixture: 'kubernetes/namespace-kube-system.json' }, ); cy.fixture('kubernetes/nodes.json').then((nodes) => { - cy.intercept('GET', '**/api/kubernetes/api/v1/nodes', { body: nodes }); + cy.intercept('GET', '**/api/kubernetes/api/v1/nodes', { body: nodes }).as( + 'getNodes', + ); cy.intercept( 'GET', @@ -267,11 +272,10 @@ const NODE_NAME = 'bootstrap'; const VOLUME_SIZE = '1 GiB'; Cypress.Commands.add('fillVolumeCreationForm', (volume_type) => { + cy.wait('@getNodes'); // The following steps are to fill the required fields of create volume form cy.get('input[name=name]').type(VOLUME_NAME); - cy.findByText(new RegExp(`${NODE_NAME}`, 'i')); - // Force click is because the input element is not visiable cy.findByLabelText(/node \*/i) .focus() diff --git a/ui/src/FederableApp.tsx b/ui/src/FederableApp.tsx index 6831593e38..12e7311325 100644 --- a/ui/src/FederableApp.tsx +++ b/ui/src/FederableApp.tsx @@ -18,6 +18,7 @@ import { useBasenameRelativeNavigate, useShellHooks, } from './ShellHooksContext'; +import { FederatedAppProps } from '../@mf-types/shell/App'; const composeEnhancers = // @ts-expect-error - FIXME when you are working on it @@ -116,7 +117,7 @@ export const AppConfigProvider = ({ ); }; -export default function FederableApp(props) { +export default function FederableApp(props: FederatedAppProps) { return ( { useEffect(() => { if (volumeListData.length > 0) { const firstVolumeName = volumeListData[0]?.name; - if (firstVolumeName && !location.pathname.includes(firstVolumeName)) { + if ( + firstVolumeName && + !location.pathname.includes(firstVolumeName) && + location.pathname.endsWith('/volumes') + ) { navigate(`/volumes/${firstVolumeName}/overview`, { replace: true }); } } diff --git a/ui/tsconfig.json b/ui/tsconfig.json index 5ce9613fb1..7642e65f4e 100644 --- a/ui/tsconfig.json +++ b/ui/tsconfig.json @@ -79,5 +79,6 @@ "@testing-library/jest-dom", "@scality/core-ui/types/styled.d.ts" ] - } + }, + "exclude": ["cypress.config.ts", "cypress", "node_modules"] }