github.com/rancher/elemental/tests@v0.0.0-20240517125144-ae048c615b3f/cypress/latest/support/elemental.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 import { isCypressTag, isOperatorVersion } from '~/support/utils'; 15 export class Elemental { 16 // Go into the cluster creation menu 17 accessClusterMenu() { 18 cy.contains('Dashboard') 19 .click(); 20 cy.getBySel('elemental-main-title') 21 .should('exist'); 22 cy.getBySel('card-clusters') 23 .contains('Create Elemental Cluster') 24 .should('exist'); 25 cy.getBySel('button-create-elemental-cluster') 26 .click(); 27 } 28 29 // Make sure we get all menus 30 checkElementalNav() { 31 // Open advanced accordion 32 cy.get('div.header > i') 33 .eq(0) 34 .click() 35 cy.get('div.header') 36 .contains('Advanced') 37 .should('be.visible') 38 // Check all listed options once accordion is opened 39 cy.get('li.child.nav-type') 40 .should(($lis) => { 41 expect($lis).to.have.length(7); 42 expect($lis.eq(0)).to.contain('Dashboard'); 43 expect($lis.eq(1)).to.contain('Registration Endpoints'); 44 expect($lis.eq(2)).to.contain('Inventory of Machines'); 45 expect($lis.eq(3)).to.contain('Update Groups'); 46 expect($lis.eq(4)).to.contain('OS Versions'); 47 expect($lis.eq(5)).to.contain('OS Version Channels'); 48 expect($lis.eq(6)).to.contain('Seed Images'); 49 }) 50 } 51 52 installElementalOperator(upgrade_from_version: string) { 53 cy.contains('local') 54 .click(); 55 cy.get('.nav').contains('Apps') 56 .click(); 57 if (isCypressTag('main') && !isOperatorVersion('marketplace')) { 58 cy.contains('.item.has-description.color1', 'Elemental', {timeout:30000}) 59 .click(); 60 } else { 61 cy.contains('Elemental', {timeout:30000}) 62 .click(); 63 } 64 cy.contains('Charts: Elemental', {timeout:30000}); 65 if (isCypressTag('upgrade') && isOperatorVersion('marketplace')) { 66 cy.contains(upgrade_from_version, {timeout:30000}) 67 .click(); 68 } 69 cy.clickButton('Install'); 70 cy.contains('.outer-container > .header', 'Elemental'); 71 cy.clickButton('Next'); 72 cy.clickButton('Install'); 73 cy.contains('SUCCESS: helm', {timeout:120000}); 74 cy.reload; 75 cy.contains('Only User Namespaces') // eslint-disable-line cypress/unsafe-to-chain-command 76 .click() 77 .type('cattle-elemental-system{enter}{esc}'); 78 cy.get('.outlet').contains('Deployed elemental-operator cattle-elemental-system', {timeout: 120000}); 79 } 80 }