Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adjust Cypress tests #3553

Merged
merged 11 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .github/workflows/pull-integration-cluster-k3d.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,11 @@ jobs:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- name: Install Chrome # this step could be removed after https://github.com/cypress-io/cypress/issues/30374 is resolved
shell: bash
run: |
wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_127.0.6533.119-1_amd64.deb
sudo apt install --allow-downgrades -y /tmp/chrome.deb
rm /tmp/chrome.deb
- uses: gardenlinux/workflow-telemetry-action@v2
with:
comment_on_pr: false
- uses: actions/checkout@v4
- uses: ./.github/actions/rebase
#- uses: ./.github/actions/rebase # TODO UNCOMMENT BEFORE FEATURE BRANCH MERGE!
- name: Create Single Cluster
uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79 #v2.4.0
with:
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/pull-integration-namespace-k3d.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,11 @@ jobs:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- name: Install Chrome
shell: bash
run: |
wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_127.0.6533.119-1_amd64.deb
sudo apt install --allow-downgrades -y /tmp/chrome.deb
rm /tmp/chrome.deb
- uses: gardenlinux/workflow-telemetry-action@v2
with:
comment_on_pr: false
- uses: actions/checkout@v4
- uses: ./.github/actions/rebase
#- uses: ./.github/actions/rebase # TODO UNCOMMENT BEFORE FEATURE BRANCH MERGE!
- name: Create Single Cluster
uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79 #v2.4.0
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-kyma-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
with:
comment_on_pr: false
- uses: actions/checkout@v4
- uses: ./.github/actions/rebase
#- uses: ./.github/actions/rebase # TODO UNCOMMENT BEFORE FEATURE BRANCH MERGE!
- name: Install k3d
env:
K3D_URL: https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-lighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
comment_on_pr: false
- uses: actions/checkout@v4
- uses: ./.github/actions/rebase
#- uses: ./.github/actions/ # TODO UNCOMMENT BEFORE FEATURE BRANCH MERGE!
- name: Create Single Cluster
uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79 #v2.4.0
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-smoke-test-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
with:
comment_on_pr: false
- uses: actions/checkout@v4
- uses: ./.github/actions/rebase
#- uses: ./.github/actions/ # TODO UNCOMMENT BEFORE FEATURE BRANCH MERGE!
- name: Install k3d
env:
K3D_URL: https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-smoke-test-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
with:
comment_on_pr: false
- uses: actions/checkout@v4
- uses: ./.github/actions/rebase
#- uses: ./.github/actions/ # TODO UNCOMMENT BEFORE FEATURE BRANCH MERGE!
- name: Install k3d
env:
K3D_URL: https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh
Expand Down
2 changes: 1 addition & 1 deletion src/command-pallette/CommandPaletteProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const CommandPaletteProvider = ({
>();

const setShowDialog = (value: boolean) => {
const modalPresent = document.querySelector('ui5-dialog[open="true"]');
const modalPresent = document.querySelector('ui5-dialog[open]');
// disable opening palette if other modal is present
if (!modalPresent || !value) {
_setShowDialog(value);
Expand Down
2 changes: 1 addition & 1 deletion src/header/NamespaceChooser/NamespaceChooser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function NamespaceChooser() {
/>,
];

allNamespaces.map(ns =>
allNamespaces?.map(ns =>
namespaces.push(
<SideNavigationSubItem
text={ns}
Expand Down
8 changes: 6 additions & 2 deletions src/hooks/useAvailableNamespaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export function useAvailableNamespaces() {
const { data: allNamespaces, error, refetch, silentRefetch } = useGetList()(
'/api/v1/namespaces',
{
skip: false,
pollingInterval: 3000,
onDataReceived: () => {},
skip: false,
},
) as {
loading: boolean;
Expand All @@ -37,7 +37,10 @@ export function useAvailableNamespaces() {
if (showHiddenNamespaces) return true;
return !hiddenNamespaces.includes(n);
});
if (filteredNamespaces) {
if (
filteredNamespaces &&
JSON.stringify(filteredNamespaces) !== JSON.stringify(namespaces)
) {
setNamespaces(filteredNamespaces);
}
}, [
Expand All @@ -46,6 +49,7 @@ export function useAvailableNamespaces() {
hiddenNamespaces,
setNamespaces,
showHiddenNamespaces,
namespaces,
]);

return { namespaces, refetch, silentRefetch, setNamespaces };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from '@ui5/webcomponents-react';
import { Toolbar } from '@ui5/webcomponents-react-compat/dist/components/Toolbar/index.js';
import { ToolbarSpacer } from '@ui5/webcomponents-react-compat/dist/components/ToolbarSpacer/index.js';
import { ToolbarSeparator } from '@ui5/webcomponents-react-compat/dist/components/ToolbarSeparator/index.js';

import './DynamicPageComponent.scss';
import { useEffect, useState, useRef } from 'react';
Expand Down Expand Up @@ -169,7 +170,7 @@ export const DynamicPageComponent = ({
(!window.location.search.includes('layout') &&
layoutColumn?.showCreate?.resourceType)) &&
layoutNumber !== 'StartColumn' ? (
<span className="separator" />
<ToolbarSeparator />
) : null}
</>
)}
Expand Down Expand Up @@ -327,44 +328,46 @@ export const DynamicPageComponent = ({
hidePinButton={true}
titleArea={headerTitle}
headerArea={customHeaderContent ?? headerContent}
selectedSectionId={selectedSectionIdState}
onSelectedSectionChange={e => {
if (isFormOpen.formOpen) {
e.preventDefault();
}

handleActionIfFormOpen(
isResourceEdited,
setIsResourceEdited,
isFormOpen,
setIsFormOpen,
() => {
setSelectedSectionIdState(e.detail.selectedSectionId);
setIsResourceEdited({
isEdited: false,
});
},
);

if (e.detail.selectedSectionI === 'edit') {
setIsFormOpen({ formOpen: true });
}
}}
ref={dynamicPage => handlePageRef(dynamicPage)}
>
<TabContainer
className="tab-container"
style={{ top: `${headerHeight}px` }}
ref={tabContainerRef}
onTabSelect={event => {
const mode = event.detail.tab.getAttribute('data-mode');
setSelectedSectionIdState(mode);
onTabSelect={e => {
if (isFormOpen.formOpen) {
e.preventDefault();
}

handleActionIfFormOpen(
isResourceEdited,
setIsResourceEdited,
isFormOpen,
setIsFormOpen,
() => {
setSelectedSectionIdState(
e.detail.tab.getAttribute('data-mode'),
);
setIsResourceEdited({
isEdited: false,
});
},
);

if (e.detail.tab.getAttribute('data-mode') === 'edit') {
setIsFormOpen({ formOpen: true });
}
}}
>
<Tab data-mode="view" text={t('common.tabs.view')}></Tab>
<Tab
data-mode="view"
text={t('common.tabs.view')}
selected={selectedSectionIdState === 'view'}
></Tab>
<Tab
data-mode="edit"
text={showYamlTab ? t('common.tabs.yaml') : t('common.tabs.edit')}
selected={selectedSectionIdState === 'edit'}
></Tab>
</TabContainer>

Expand Down
2 changes: 2 additions & 0 deletions src/shared/components/Labels/Labels.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const Labels = ({
style = null,
displayLabelForLabels = false,
disableMarginBottom = false,
hideIcon = true,
}) => {
const { t } = useTranslation();
if (!labels || Object.keys(labels).length === 0) {
Expand Down Expand Up @@ -54,6 +55,7 @@ export const Labels = ({
className={`sap-margin-end-tiny ${
disableMarginBottom ? '' : 'sap-margin-bottom-tiny'
}`}
hideStateIcon={hideIcon}
>
{shortenLongLabels && label.length > SHORTENING_TRESHOLD
? shortenLabel(label)
Expand Down
2 changes: 1 addition & 1 deletion src/shared/hooks/BackendAPI/useGet.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const ERROR_TOLERANCY = 2;
const useGetHook = processDataFn =>
function(
path,
{ pollingInterval, onDataReceived, skip, errorTolerancy = undefined } = {},
{ pollingInterval, onDataReceived, skip, errorTolerancy } = {},
) {
const authData = useRecoilValue(authDataState);
const lastAuthData = useRef(null);
Expand Down
2 changes: 1 addition & 1 deletion src/state/useAfterInitHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function useAfterInitHook(handledKubeconfigId: KubeconfigIdHandleState) {
}

// cluster not yet loaded
if (!cluster === undefined) {
if (cluster === undefined) {
return;
}

Expand Down
13 changes: 7 additions & 6 deletions tests/integration/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ Cypress.Commands.add(
Cypress.Commands.add('checkItemOnGenericListLink', resourceName => {
cy.get('ui5-table-row')
.find('ui5-table-cell')
.contains('span', resourceName)
.contains('ui5-text', resourceName)
.should('be.visible');
});

Cypress.Commands.add('clickGenericListLink', resourceName => {
cy.get('ui5-table-row')
.find('ui5-table-cell')
.contains('span', resourceName)
.contains('ui5-text', resourceName)
.click();
});

Expand All @@ -61,6 +61,7 @@ Cypress.Commands.add('filterWithNoValue', { prevSubject: true }, $elements =>
Cypress.Commands.add('goToNamespaceDetails', () => {
// Go to the details of namespace
cy.getLeftNav()
.find('ui5-side-navigation-item')
.contains('Namespaces')
.click();

Expand Down Expand Up @@ -177,8 +178,8 @@ Cypress.Commands.add(
cy.wait(1000);

if (selectSearchResult) {
cy.get('ui5-li-suggestion-item:visible')
.contains(resourceName)
cy.get('ui5-suggestion-item:visible')
.contains('li', resourceName)
.click();
}

Expand Down Expand Up @@ -233,7 +234,7 @@ Cypress.Commands.add(

cy.get('ui5-table-row')
.find('ui5-table-cell')
.contains('span', resourceName)
.contains('ui5-text', resourceName)
.should('not.be.visible');

cy.getMidColumn()
Expand All @@ -255,7 +256,7 @@ Cypress.Commands.add(

cy.get('ui5-table-row')
.find('ui5-table-cell')
.contains('span', resourceName)
.contains('ui5-text', resourceName)
.should('not.be.visible');

cy.getEndColumn()
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/support/inspect-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ Cypress.Commands.add('inspectList', (resourceName, hiddenButtons = false) => {
.wait(1000)
.type(`${resourceName}{enter}`);

cy.contains('span', resourceName).should('be.visible');
cy.contains('ui5-text', resourceName).should('be.visible');
});
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ context('Accessibility test Custom Resources', () => {

cy.navigateTo('Configuration', 'Custom Resource Definitions');

cy.openCreate().click();
cy.openCreate();

cy.wrap(loadFile(FILE_NAME)).then(CRD_CONFIG => {
const CRD = JSON.stringify(CRD_CONFIG);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ context('Accessibility test Cluster list and overview', () => {
it('Acc test with performance panel open', () => {
cy.get('[title="Profile"]').click();

cy.get('ui5-menu-li:visible')
cy.get('ui5-menu-item:visible')
.contains('Preferences')
.click({ force: true });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ context('Test Cluster configuration', () => {

cy.get('[title="Profile"]').click();

cy.get('ui5-menu-li:visible')
cy.get('ui5-menu-item:visible')
.contains('Preferences')
.click({ force: true });

Expand All @@ -77,7 +77,7 @@ context('Test Cluster configuration', () => {
.contains('20')
.click();

cy.get('ui5-list:visible')
cy.get('ui5-option:visible')
.contains('10')
.click();

Expand Down
13 changes: 9 additions & 4 deletions tests/integration/tests/cluster/test-cluster-overview.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ context('Test Cluster Overview', () => {
.get('.radial-chart')
.contains('text.progress-label', '50%')
.get('.radial-chart')
.contains('span.additional-info', 'test1233456');
.contains('ui5-text.additional-info', 'test1233456');

// test injected statistical card exists and works
cy.contains(
Expand All @@ -62,7 +62,8 @@ context('Test Cluster Overview', () => {
.find('ui5-link.counting-card__link')
.click();

cy.get('ui5-title')
cy.get('ui5-dynamic-page-title')
.find('ui5-title')
.contains('Hpatest')
.should('be.visible');

Expand Down Expand Up @@ -93,13 +94,17 @@ context('Test Cluster Overview', () => {

cy.loginAndSelectCluster();

cy.get('[name="feedback"]').should('exist');
cy.get('ui5-shellbar')
.find('[name="feedback"]')
.should('exist');

cy.setBusolaFeature('FEEDBACK', false);

cy.loginAndSelectCluster();

cy.get('[name="feedback"]').should('not.exist');
cy.get('ui5-shellbar')
.find('[name="feedback"]')
.should('not.exist');
});

it('Go to Node details', () => {
Expand Down
Loading
Loading