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 e2e tests #3552

Closed
Closed
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
6 changes: 0 additions & 6 deletions .github/workflows/pull-integration-cluster-k3d.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ 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
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/pull-integration-namespace-k3d.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ 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
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
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
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ context('Test Cluster Role Bindings', () => {
cy.clickGenericListLink(CRB_NAME);

cy.getMidColumn()
.contains('User')
.contains('ui5-table-cell', 'User')
.should('be.visible');

cy.getMidColumn()
.contains(USER_NAME)
.contains('ui5-table-cell', USER_NAME)
.should('be.visible');

cy.getMidColumn()
Expand All @@ -71,7 +71,7 @@ context('Test Cluster Role Bindings', () => {

cy.contains('[role="combobox"]', 'User').click();

cy.get('ui5-li:visible')
cy.get('ui5-option:visible')
.contains('ServiceAccount')
.find('li')
.click({ force: true });
Expand All @@ -96,6 +96,7 @@ context('Test Cluster Role Bindings', () => {
cy.inspectTab('View');

cy.getMidColumn()
.find('ui5-table-cell')
.contains('Group')
.should('be.visible');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,8 @@ context('Test Command Palette navigation', () => {
getQueryInput().type('pref');

// autocomplete
cy.get('body')
.tab()
.type('{enter}', { force: true });
cy.get('body').tab();
getQueryInput().type('{enter}', { force: true });

cy.contains('Cluster interaction').should('be.visible');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ context('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 Expand Up @@ -92,6 +92,7 @@ context('Test Custom Resources', () => {
});

it('Test column layout and remove CRD', () => {
cy.reload();
cy.getLeftNav()
.contains('Custom Resources')
.click();
Expand All @@ -114,15 +115,15 @@ context('Test Custom Resources', () => {
cy.getMidColumn()
.get('ui5-table-row')
.find('ui5-table-cell')
.contains('span', 'tcluster-test')
.contains('ui5-text', 'tcluster-test')
.click();

cy.testEndColumnLayout('tcluster-test', false);

cy.getMidColumn()
.get('ui5-table-row')
.find('ui5-table-cell')
.contains('span', 'tcluster-test')
.contains('ui5-text', 'tcluster-test')
.click();

cy.getMidColumn()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ context('Test Kyma Dashboard Version link', () => {
it('Check Kyma Dashboard Version link', () => {
cy.get('[title="Profile"]').click();

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

cy.get('ui5-responsive-popover[placement-type="Right"]')
.find('ui5-menu-li:visible')
cy.get('li:visible')
.contains('Kyma Dashboard version:')
.should('be.visible');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,27 @@ context('Test multiple context kubeconfig', () => {
.contains(kubeconfig['current-context'])
.click();

cy.get('ui5-li:visible').contains(kubeconfig.contexts[1].name);
cy.get('ui5-option:visible').contains(kubeconfig.contexts[1].name);

cy.get('ui5-li:visible')
cy.wait(3000);

cy.get('ui5-option:visible')
.contains('All contexts')
.click();
cy.wait(3000);

cy.contains('Next').click({ force: true });
cy.wait(3000);

cy.get('ui5-button:visible')
.contains('Next step')
.click();
cy.wait(3000);

cy.get(`[accessible-name="last-step"]:visible`)
.contains('Connect cluster')
.click({ force: true });
cy.wait(3000);

cy.contains('Cluster Details').should('exist');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,17 @@ context('Test navigation features', () => {
.wait(1000)
.type('cronjob-controller');

cy.get('ui5-li-suggestion-item:visible')
.contains('cronjob-controller')
cy.get('ui5-suggestion-item:visible')
.contains('li', /cronjob-controller/)
.click();

cy.contains('cronjob-controller (SA)') // link wrapper
.contains('cronjob-controller') // link itself
cy.wait(1000);

cy.contains('ui5-text', 'system:controller:cronjob-controller').click();

cy.getMidColumn()
.contains('ui5-Panel', 'Subjects')
.contains('ui5-link', 'cronjob-controller')
.click();

cy.contains('disabled').should('exist');
Expand Down
Loading
Loading