diff --git a/tests/integration/cypress.config.js b/tests/integration/cypress.config.js index d2d56fc59f..a0acb29814 100644 --- a/tests/integration/cypress.config.js +++ b/tests/integration/cypress.config.js @@ -30,6 +30,7 @@ module.exports = defineConfig({ }, specPattern: [ 'tests/cluster/test-download-a-kubeconfig.spec.js', + 'tests/cluster/test-edit-cluster.spec.js', 'tests/cluster/test-cluster-overview.spec.js', 'tests/cluster/test-cluster-role-bindings.spec.js', 'tests/cluster/test-cluster-validation.spec.js', diff --git a/tests/integration/tests/cluster/test-cluster-configuration.spec.js b/tests/integration/tests/cluster/test-cluster-configuration.spec.js index aebbf2f383..8b74b75f6c 100644 --- a/tests/integration/tests/cluster/test-cluster-configuration.spec.js +++ b/tests/integration/tests/cluster/test-cluster-configuration.spec.js @@ -45,12 +45,6 @@ context('Test Cluster configuration', () => { cy.loginAndSelectCluster(); cy.url().should('match', /overview$/); - // TODO: Bring back the overwritten message - // cluster storage message should be visible - // cy.contains(/The chosen storage type has been overwritten/).should( - // 'be.visible', - // ); - // custom category should be added cy.contains('Category from target cluster').should('be.visible'); @@ -58,9 +52,6 @@ context('Test Cluster configuration', () => { cy.getLeftNav() .contains('Cluster Details') .click(); - - // Uncomment after resolving https://github.com/kyma-project/busola/issues/2511 - // cy.contains(/session storage/i).should('be.visible'); }); it('Test pagination', () => { diff --git a/tests/integration/tests/cluster/test-edit-cluster.spec.js b/tests/integration/tests/cluster/test-edit-cluster.spec.js index 8e7969c715..1113bce6b3 100644 --- a/tests/integration/tests/cluster/test-edit-cluster.spec.js +++ b/tests/integration/tests/cluster/test-edit-cluster.spec.js @@ -1,4 +1,6 @@ /// <reference types="cypress" /> +import config from '../../config'; + const DESC = 'beautiful, pretty cluster for all our test needs'; const TEMP_NAME = 'clustered'; @@ -12,44 +14,48 @@ context('Test edit cluster', () => { }); it('Changes cluster name and adds description', () => { - cy.get('.ui5-shellbar-menu-button').click(); - cy.contains('Clusters Overview').click(); + cy.visit(`${config.clusterAddress}/clusters`); cy.get('ui5-table-cell') .eq(0) .then(el => (originalName = el.text())); - cy.get('button[data-testid="edit"]').click(); + cy.get('ui5-button[data-testid="edit"]').click(); - cy.get('input[data-testid="cluster-description"]') + cy.get('ui5-input[data-testid="cluster-description"]') + .find('input') .click() .type(DESC); - cy.get('input[date-testid="cluster-name"]') + cy.get('ui5-input[date-testid="cluster-name"]') .first() + .find('input') .type(`{selectall}{backspace}`) .type(TEMP_NAME); - cy.contains('button', 'Update').click(); + cy.contains('ui5-button', 'Update').click(); - cy.contains(TEMP_NAME) + cy.get('.header') + .find('button') + .contains(TEMP_NAME) .should('be.visible') .click(); - cy.contains('Clusters Overview').click(); + cy.visit(`${config.clusterAddress}/clusters`); cy.contains(DESC).should('be.visible'); }); it('Restores previous settings', () => { - cy.get('button[data-testid="edit"]').click(); + cy.get('ui5-button[data-testid="edit"]').click(); - cy.get('input[date-testid="cluster-name"]') + cy.get('ui5-input[date-testid="cluster-name"]') .first() + .find('input') .type(`{selectall}{backspace}`) .type(originalName); - cy.contains('button', 'Update').click(); + cy.contains('ui5-button', 'Update').click(); cy.contains(originalName) .should('be.visible') diff --git a/tests/integration/tests/cluster/test-login-kubeconfigID.spec.js b/tests/integration/tests/cluster/test-login-kubeconfigID.spec.js index 2b907eb73d..8288db2daa 100644 --- a/tests/integration/tests/cluster/test-login-kubeconfigID.spec.js +++ b/tests/integration/tests/cluster/test-login-kubeconfigID.spec.js @@ -72,6 +72,51 @@ context('Test login - kubeconfigID', () => { }); }); + it('Handles default kubeconfig', () => { + // mock defaultKubeconfig on + cy.intercept( + { + method: 'GET', + url: '/config/config.yaml*', + }, + jsyaml.dump({ + config: { + features: { + KUBECONFIG_ID: { + isEnabled: true, + config: { + kubeconfigUrl: '/kubeconfig', + defaultKubeconfig: 'mock-kubeconfig.yaml', + }, + }, + }, + }, + }), + ); + + cy.wrap(loadFile('kubeconfig.yaml')).then(kubeconfig => { + cy.intercept( + { + method: 'GET', + url: `${kubeconfigIdAddress}/*`, + }, + kubeconfig, + ); + cy.visit(`${config.clusterAddress}/clusters`); + + cy.get('ui5-button[data-testid="delete"]').click(); + cy.contains('ui5-button', 'Delete').click(); + + cy.contains('Load default cluster') + .should('be.visible') + .click(); + + cy.url().should('match', /overview$/); + + cy.contains('Session Storage').should('be.visible'); + }); + }); + it('Gracefully fails on invalid input', () => { cy.intercept( { @@ -86,47 +131,4 @@ context('Test login - kubeconfigID', () => { expect(alertContent).to.include('Error loading kubeconfig ID'), ); }); - - // Uncomment after resolving https://github.com/kyma-project/busola/issues/2511 - // it('Handles default kubeconfig', () => { - // // mock defaultKubeconfig on - // cy.intercept( - // { - // method: 'GET', - // url: '/config/config.yaml*', - // }, - // jsyaml.dump({ - // config: { - // features: { - // KUBECONFIG_ID: { - // isEnabled: true, - // config: { - // kubeconfigUrl: '/kubeconfig', - // defaultKubeconfig: 'mock-kubeconfig.yaml', - // }, - // }, - // }, - // }, - // }), - // ); - - // cy.wrap(loadFile('kubeconfig.yaml')).then(kubeconfig => { - // cy.intercept( - // { - // method: 'GET', - // url: `${kubeconfigIdAddress}/*`, - // }, - // kubeconfig, - // ); - // cy.visit(`${config.clusterAddress}/clusters`); - - // cy.contains('Load default cluster') - // .should('be.visible') - // .click(); - - // cy.url().should('match', /overview$/); - - // cy.contains('Session Storage').should('be.visible'); - // }); - // }); }); diff --git a/tests/integration/tests/cluster/test-other-login-options.spec.js b/tests/integration/tests/cluster/test-other-login-options.spec.js index 0cb5838b26..9a97a375bb 100644 --- a/tests/integration/tests/cluster/test-other-login-options.spec.js +++ b/tests/integration/tests/cluster/test-other-login-options.spec.js @@ -1,8 +1,6 @@ /// <reference types="cypress" /> import 'cypress-file-upload'; import config from '../../config'; -import { loadFile } from '../../support/loadFile'; -import jsyaml from 'js-yaml'; context('Test other login options', () => { Cypress.skipAfterFail(); @@ -11,47 +9,6 @@ context('Test other login options', () => { cy.handleExceptions(); }); - // Uncomment after resolving https://github.com/kyma-project/busola/issues/2511 - // it('Kubeconfig and token separately', () => { - // cy.wrap(loadFile('kubeconfig.yaml')).then(kubeconfig => { - // const token = kubeconfig.users[0].user.token; - // kubeconfig.users[0].user.token = null; - - // cy.visit(`${config.clusterAddress}/clusters`); - - // cy.contains('Connect cluster').click(); - - // cy.contains('Drag your file here or click to upload').attachFile( - // { - // fileContent: jsyaml.dump(kubeconfig), - // filePath: 'kubeconfig.yaml', - // }, - // { - // subjectType: 'drag-n-drop', - // }, - // ); - - // cy.contains('Next').click(); - - // cy.contains( - // '[role=alert]', - // "We couldn't find enough authentication information", - // ).should('be.visible'); - - // cy.contains('Token') - // .parent() - // .next() - // .type(token); - - // cy.contains('Next').click(); - - // cy.contains('[role="dialog"] button', 'Connect cluster').click(); - - // cy.url().should('match', /overview$/); - // cy.contains('Cluster Details').should('be.visible'); - // }); - // }); - it('Reset endpoint', () => { cy.loginAndSelectCluster(); cy.url().should('match', /overview$/);