github.com/rancher/elemental/tests@v0.0.0-20240517125144-ae048c615b3f/cypress/latest/e2e/unit_tests/elemental_plugin.spec.ts (about)

     1  /*
     2  Copyright © 2022 - 2024 SUSE LLC
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7      http://www.apache.org/licenses/LICENSE-2.0
     8  Unless required by applicable law or agreed to in writing, software
     9  distributed under the License is distributed on an "AS IS" BASIS,
    10  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    11  See the License for the specific language governing permissions and
    12  limitations under the License.
    13  */
    14  
    15  import '~/support/commands';
    16  import filterTests from '~/support/filterTests.js';
    17  import { isRancherManagerVersion, isUIVersion } from '../../support/utils';
    18  import * as cypressLib from '@rancher-ecp-qa/cypress-library';
    19  import { qase } from 'cypress-qase-reporter/dist/mocha';
    20  import { slowCypressDown } from 'cypress-slow-down'
    21  
    22  // slow down each command by 500ms
    23  slowCypressDown(500)
    24  
    25  filterTests(['main', 'upgrade'], () => {
    26    Cypress.config();
    27    describe('Install Elemental plugin', () => {
    28    
    29      beforeEach(() => {
    30        cy.login();
    31        cy.visit('/');
    32        cypressLib.burgerMenuToggle();
    33      });
    34    
    35      qase(11,
    36        it('Add elemental-ui repo', () => {
    37          !isUIVersion('stable') ? cypressLib.addRepository('elemental-ui', 'https://github.com/rancher/elemental-ui.git', 'git', 'gh-pages') : null;
    38        })
    39      );
    40  
    41      // Add rancher-ui-plugin-charts repo because its part of Rancher Prime in 2.8 and 2.9-head
    42      it('Add rancher-ui-plugin-charts repo', () => {
    43        isRancherManagerVersion('2.8') || isRancherManagerVersion('2.9') ? cypressLib.addRepository('rancher-ui-plugin-charts', 'https://github.com/rancher/ui-plugin-charts.git', 'git', 'main') : null;
    44      });
    45      
    46      qase(12,
    47        it('Enable extension support', () => {
    48          isUIVersion('stable') ? cypressLib.enableExtensionSupport(true) : cypressLib.enableExtensionSupport(false);
    49        })
    50      );
    51    
    52      qase(13,
    53        it('Install Elemental plugin', () => {
    54          // TODO: create a function to install any plugin and not elemental only
    55          cy.contains('Extensions')
    56            .click();
    57          cy.contains('elemental');
    58          cy.get('.plugin')
    59            .contains('Install')
    60            .click();
    61          cy.clickButton('Install');
    62          cy.contains('Installing');
    63          cy.contains('Extensions changed - reload required', {timeout: 40000});
    64          cy.clickButton('Reload');
    65          cy.get('.plugins')
    66            .children()
    67            .should('contain', 'elemental')
    68            .and('contain', 'Uninstall');
    69        })
    70      );
    71    });
    72  });