github.com/rancher/elemental/tests@v0.0.0-20240517125144-ae048c615b3f/cypress/latest/support/e2e.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 './commands'; 16 17 declare global { 18 // In Cypress functions should be declared with 'namespace' 19 // eslint-disable-next-line @typescript-eslint/no-namespace 20 namespace Cypress { 21 interface Chainable { 22 // Functions declared in commands.ts 23 addMachInvAnnotation(annotationName: string, annotationValue: string):Chainable<Element>; 24 addMachInvLabel(labelName: string, labelValue: string, useHardwareLabels?: boolean):Chainable<Element>; 25 addMachRegAnnotation(annotationName: string, annotationValue: string):Chainable<Element>; 26 addMachRegLabel(labelName: string, labelValue: string):Chainable<Element>; 27 addOsVersionChannel(channelVersion: string): Chainable<Element>; 28 checkFilter(filterName: string, testFilterOne: boolean, testFilterTwo: boolean, shouldNotMatch: boolean): Chainable<Element>; 29 checkLabelSize(sizeToCheck: string): Chainable<Element>; 30 checkMachInvLabel(machRegName: string, labelName: string, labelValue: string, afterBoot: boolean, useHardwareLabels?: boolean):Chainable<Element>; 31 checkMachRegAnnotation(machRegName: string, annotationName: string, annotationValue: string):Chainable<Element>; 32 checkMachRegLabel(machRegName: string, labelName: string, labelValue: string):Chainable<Element>; 33 clickElementalMenu(label: string,): Chainable<Element>; 34 createMachReg(machRegName: string, namespace?: string, checkLabels?: boolean, checkAnnotations?: boolean, checkInventoryLabels?: boolean, 35 checkInventoryAnnotations?: boolean, checkIsoBuilding?: boolean, customCloudConfig?: string, checkDefaultCloudConfig?: boolean): Chainable<Element>; 36 deleteMachReg(machRegName: string): Chainable<Element>; 37 editMachReg(machRegName: string, addLabel?: boolean, addAnnotation?: boolean, withYAML?: boolean): Chainable<Element>; 38 importMachineInventory(machineInventoryFile: string, machineInventoryName: string): Chainable<Element>; 39 } 40 } 41 } 42 43 // TODO handle redirection errors better? 44 // we see a lot of 'error navigation cancelled' uncaught exceptions that don't actually break anything; ignore them here 45 Cypress.on('uncaught:exception', (err) => { 46 // returning false here prevents Cypress from failing the test 47 if (err.message.includes('navigation guard')) { 48 return false; 49 } 50 }); 51 52 require('cypress-dark'); 53 // eslint-disable-next-line @typescript-eslint/no-var-requires 54 require('cy-verify-downloads').addCustomCommand(); 55 require('cypress-plugin-tab'); 56 require('@rancher-ecp-qa/cypress-library');