diff --git a/cypress/cypress.config.ts b/cypress/cypress.config.ts index dbd37f023..45bc03812 100644 --- a/cypress/cypress.config.ts +++ b/cypress/cypress.config.ts @@ -5,10 +5,10 @@ export default defineConfig({ fixturesFolder: './fixtures', viewportWidth: 1920, viewportHeight: 1080, - numTestsKeptInMemory: 5, - defaultCommandTimeout: 30000, - requestTimeout: 20000, - responseTimeout: 20000, + numTestsKeptInMemory: 0, + defaultCommandTimeout: 60000, + requestTimeout: 30000, + responseTimeout: 30000, env: { NODE_ENV: 'production', username: 'admin', @@ -24,8 +24,8 @@ export default defineConfig({ ], }, image: { - name: 'openSUSE-Leap-15.3-3-DVD-x86_64-Build38.1-Media.iso', - url: 'https://mirrors.bfsu.edu.cn/opensuse/distribution/leap/15.3/iso/openSUSE-Leap-15.3-3-DVD-x86_64-Build38.1-Media.iso', + name: 'openSUSE-Leap-15.3-3-NET-x86_64.qcow2', + url: 'https://download.opensuse.org/pub/opensuse/distribution/leap/15.3/appliances/openSUSE-Leap-15.3-JeOS.x86_64-15.3-OpenStack-Cloud-Current.qcow2', }, nfsEndPoint: 'nfs://ip', }, diff --git a/cypress/cypress.json b/cypress/cypress.json deleted file mode 100644 index 80e4397aa..000000000 --- a/cypress/cypress.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "pageLoadTimeout": 120000, - "experimentalSessionSupport": true, - "modifyObstructiveCode": false, - "integrationFolder": "./testcases", - "fixturesFolder": "./fixtures", - "pluginsFile": "./plugins/index.js", - "supportFile": "./support/index.js", - "testFiles": [ - "dashboard/*.ts", - "settings/*.ts", - "namespaces/*.ts", - "volume/*.ts", - "image/*.ts", - "networks/*.ts", - "virtualmachines/*.ts", - "backups/*.ts", - "VM settings/*.ts", - "templates/*.ts" - ], - "viewportWidth": 1920, - "viewportHeight": 1080, - "numTestsKeptInMemory": 5, - "defaultCommandTimeout": 30000, - "requestTimeout": 20000, - "responseTimeout": 20000, - "env": { - "NODE_ENV": "production", - "username": "admin", - "password": "admin", - "baseUrl": "https://online-server", - "host": { - "name": "", - "disks": [{ - "name": "", - "devPath": "" - }] - }, - "image": { - "name": "openSUSE-Leap-15.3-3-DVD-x86_64-Build38.1-Media.iso", - "url": "https://download.opensuse.org/distribution/leap/15.3/iso/openSUSE-Leap-15.3-3-DVD-x86_64-Build38.1-Media.iso" - }, - "nfsEndPoint": "nfs://ip", - "vlans": ["namespace/vlanID1", "namespace/vlanID2"] - }, - "retries": { - "runMode": 1, - "openMode": 0 - }, - "reporter": "mochawesome", - "reporterOptions": { - "reportDir": "cypress/results", - "overwrite": false, - "html": false, - "json": true - } -} diff --git a/cypress/pageobjects/virtualmachine.po.ts b/cypress/pageobjects/virtualmachine.po.ts index 64cde2fa3..9a74ec7b0 100644 --- a/cypress/pageobjects/virtualmachine.po.ts +++ b/cypress/pageobjects/virtualmachine.po.ts @@ -156,7 +156,7 @@ export class VmsPage extends CruResourcePo { const imageEnv = Cypress.env('image'); - const name = imageEnv.name + const name = Cypress._.toLower(imageEnv.name) const url = imageEnv.url const imageFound = images.find((i:any) => i?.spec?.displayName === name) diff --git a/cypress/testcases/image/images.spec.ts b/cypress/testcases/image/images.spec.ts index b2abfd869..3327ea97b 100644 --- a/cypress/testcases/image/images.spec.ts +++ b/cypress/testcases/image/images.spec.ts @@ -1,4 +1,3 @@ -import YAML from 'js-yaml' import { VmsPage } from "@/pageobjects/virtualmachine.po"; import { ImagePage } from "@/pageobjects/image.po"; import { generateName } from '@/utils/utils'; @@ -10,7 +9,7 @@ const image = new ImagePage(); describe('Auto setup image from cypress environment', () => { it('Auto setup image from cypress environment', () => { const imageEnv = Cypress.env('image'); - const IMAGE_NAME = imageEnv.name; + const IMAGE_NAME = Cypress._.toLower(imageEnv.name); const IMAGE_URL = imageEnv.url; const value = { @@ -29,11 +28,7 @@ describe('Auto setup image from cypress environment', () => { expect(res?.status, 'Check Image list').to.equal(200); const images = res?.body?.data || [] - const imageEnv = Cypress.env('image'); - - const name = imageEnv.name - const url = imageEnv.url - const imageFound = images.find((i:any) => i?.spec?.displayName === name) + const imageFound = images.find((i:any) => i?.spec?.displayName === IMAGE_NAME) if (imageFound) { return @@ -116,7 +111,7 @@ describe('Create an image with valid image URL', () => { * 1. Image state show as Failed */ describe('Create image with invalid URL', () => { - const IMAGE_NAME = 'auto-image-invalid-url-test'; + const IMAGE_NAME = generateName('auto-image-invalid-url-test'); it('Create image with invalid URL', () => { cy.login(); @@ -161,7 +156,7 @@ describe('Delete VM with exported image', () => { name: VM_NAME, cpu: '2', memory: '4', - image: imageEnv.name, + image: Cypress._.toLower(imageEnv.name), namespace, } @@ -169,7 +164,6 @@ describe('Delete VM with exported image', () => { // check VM state vms.goToConfigDetail(VM_NAME); - vms.goToYamlDetail(VM_NAME); // export IMAGE image.exportImage(VM_NAME, IMAGE_NAME); @@ -207,7 +201,7 @@ describe('Update image labels after deleting source VM', () => { name: VM_NAME, cpu: '2', memory: '4', - image: imageEnv.name, + image: Cypress._.toLower(imageEnv.name), namespace, } @@ -216,7 +210,6 @@ describe('Update image labels after deleting source VM', () => { // check VM state vms.goToConfigDetail(VM_NAME); - vms.goToYamlDetail(VM_NAME); // export IMAGE image.exportImage(VM_NAME, IMAGE_NAME); @@ -346,12 +339,12 @@ describe('Create a ISO image via upload', () => { // check VM state vms.goToConfigDetail(VM_NAME); - vms.goToYamlDetail(VM_NAME); // delete VM vms.delete(namespace, VM_NAME) // delete IMAGE - image.delete(IMAGE_NAME) + // TODO: Delete image should check volume is deleted + // image.delete(IMAGE_NAME) }); }); diff --git a/cypress/testcases/virtualmachines/advanced.spec.ts b/cypress/testcases/virtualmachines/advanced.spec.ts index 55316cec1..33b2d7a2d 100644 --- a/cypress/testcases/virtualmachines/advanced.spec.ts +++ b/cypress/testcases/virtualmachines/advanced.spec.ts @@ -25,7 +25,7 @@ describe('Create a new VM and add Enable USB tablet option', () => { name: VM_NAME, cpu: '2', memory: '4', - image: imageEnv.name, + image: Cypress._.toLower(imageEnv.name), usbTablet: true, namespace: NAMESPACE, } @@ -74,7 +74,7 @@ describe("Create a new VM and add Install guest agent option", () => { name: VM_NAME, cpu: '2', memory: '4', - image: imageEnv.name, + image: Cypress._.toLower(imageEnv.name), guestAgent: true, namespace: NAMESPACE, } @@ -106,7 +106,7 @@ describe("Verify Booting in EFI mode checkbox", () => { name: VM_NAME, cpu: '2', memory: '4', - image: imageEnv.name, + image: Cypress._.toLower(imageEnv.name), efiEnabled: true, namespace: NAMESPACE, } diff --git a/cypress/testcases/virtualmachines/cpu-overcommit.spec.ts b/cypress/testcases/virtualmachines/cpu-overcommit.spec.ts index 9b1b71308..c51e4b221 100644 --- a/cypress/testcases/virtualmachines/cpu-overcommit.spec.ts +++ b/cypress/testcases/virtualmachines/cpu-overcommit.spec.ts @@ -42,7 +42,7 @@ describe('Update Overcommit configuration', () => { name: VM_NAME, cpu: '2', memory: '4', - image: imageEnv.name, + image: Cypress._.toLower(imageEnv.name), namespace: NAMESPACE, } diff --git a/cypress/testcases/virtualmachines/network.spec.ts b/cypress/testcases/virtualmachines/network.spec.ts index ee010cdb4..8a6f94042 100644 --- a/cypress/testcases/virtualmachines/network.spec.ts +++ b/cypress/testcases/virtualmachines/network.spec.ts @@ -25,7 +25,7 @@ describe('Add a network to an existing VM with only 1 network', () => { name: VM_NAME, cpu: '2', memory: '4', - image: imageEnv.name, + image: Cypress._.toLower(imageEnv.name), networks: [{ network: NETWORK_1, }], diff --git a/cypress/testcases/virtualmachines/virtual-machine.spec.ts b/cypress/testcases/virtualmachines/virtual-machine.spec.ts index d8d1f6f50..0373da413 100644 --- a/cypress/testcases/virtualmachines/virtual-machine.spec.ts +++ b/cypress/testcases/virtualmachines/virtual-machine.spec.ts @@ -29,7 +29,7 @@ describe('Create a vm with all the default values', () => { name: VM_NAME, cpu: '2', memory: '4', - image: imageEnv.name, + image: Cypress._.toLower(imageEnv.name), namespace, } @@ -62,7 +62,7 @@ describe('Create VM without memory provided', () => { const value = { name: VM_NAME, cpu: '2', - image: imageEnv.name, + image: Cypress._.toLower(imageEnv.name), namespace, }