github.com/rancher/elemental/tests@v0.0.0-20240517125144-ae048c615b3f/cypress/latest/e2e/unit_tests/reset.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 * as utils 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'], () => { 26 Cypress.config(); 27 describe('Reset testing', () => { 28 const clusterName = "mycluster" 29 const elementalUser = "elemental-user" 30 const k8sDownstreamVersion = Cypress.env('k8s_downstream_version'); 31 const proxy = "http://172.17.0.1:3128" 32 const uiAccount = Cypress.env('ui_account'); 33 const uiPassword = "rancherpassword" 34 const vmNumber = 3; 35 36 beforeEach(() => { 37 (uiAccount == "user") ? cy.login(elementalUser, uiPassword) : cy.login(); 38 cy.visit('/'); 39 cypressLib.burgerMenuToggle(); 40 cypressLib.accesMenu('OS Management'); 41 }); 42 43 if (utils.isK8sVersion('rke')) { 44 qase(54, 45 it('Enable reset in machine inventory', () => { 46 cy.clickNavMenu(["Inventory of Machines"]); 47 for (let i = 0; i < vmNumber; i++) { 48 cy.getBySel(`sortable-table-${i}-action-button`).click(); 49 cy.contains('Edit YAML').click(); 50 cy.contains('annotations').as('anno') 51 cy.get('@anno').click(0,0) 52 cy.get('@anno').type('{end}{enter} elemental.cattle.io/resettable: \'true\''); 53 cy.getBySel('action-button-async-button') 54 .contains('Save') 55 .click(); 56 } 57 })); 58 }; 59 60 qase(['54', '55'], 61 it('Reset node by deleting the cluster', () => { 62 cy.viewport(1920, 1080); 63 cy.getBySel('button-manage-elemental-clusters').click(); 64 cy.getBySel('sortable-cell-0-0').click(); 65 cy.clickButton('Delete'); 66 cy.getBySel('prompt-remove-input') 67 .type('mycluster'); 68 cy.getBySel('prompt-remove-confirm-button').click(); 69 cypressLib.burgerMenuToggle(); 70 cypressLib.accesMenu('OS Management'); 71 cy.clickNavMenu(["Inventory of Machines"]); 72 cy.contains('There are no rows to show.'); 73 for (let i = 0; i < vmNumber; i++) { 74 cy.getBySel(`sortable-table-${i}-row`, { timeout: 180000 }) 75 .contains('Active', { timeout: 180000 }); 76 } 77 })); 78 79 qase(30, 80 it('Create Elemental cluster', () => { 81 utils.createCluster(clusterName, k8sDownstreamVersion, proxy); 82 })); 83 }); 84 });