diff --git a/cypress.json b/cypress.json index 65de70e5..576afbe4 100644 --- a/cypress.json +++ b/cypress.json @@ -5,7 +5,7 @@ "video": false, "env": { "username": "administrator", - "password": "passw0rd", + "password": "passW0rd", "region": "RegionOne", "domain": "Default", "sessionKey": "X-Auth-Token", diff --git a/docs/en/test/3-0-how-to-edit-e2e-case.md b/docs/en/test/3-0-how-to-edit-e2e-case.md index 85574344..41b15146 100644 --- a/docs/en/test/3-0-how-to-edit-e2e-case.md +++ b/docs/en/test/3-0-how-to-edit-e2e-case.md @@ -17,7 +17,7 @@ Generally, when testing the corresponding functions of a resource, follow the fo const uuid = Cypress._.random(0, 1e6); const name = `e2e-instance-${uuid}`; const newname = `${name}-1`; - const password = 'passw0rd_1'; + const password = 'passW0rd_1'; const volumeName = `e2e-instance-attach-volume-${uuid}`; const networkName = `e2e-network-for-instance-${uuid}`; const routerName = `e2e-router-for-instance-${uuid}`; diff --git a/docs/zh/test/3-0-how-to-edit-e2e-case.md b/docs/zh/test/3-0-how-to-edit-e2e-case.md index 46f2ec97..3617f568 100644 --- a/docs/zh/test/3-0-how-to-edit-e2e-case.md +++ b/docs/zh/test/3-0-how-to-edit-e2e-case.md @@ -17,7 +17,7 @@ const uuid = Cypress._.random(0, 1e6); const name = `e2e-instance-${uuid}`; const newname = `${name}-1`; - const password = 'passw0rd_1'; + const password = 'passW0rd_1'; const volumeName = `e2e-instance-attach-volume-${uuid}`; const networkName = `e2e-network-for-instance-${uuid}`; const routerName = `e2e-router-for-instance-${uuid}`; diff --git a/test/e2e/config/config.yaml b/test/e2e/config/config.yaml index 8b0c133f..ca373e9a 100644 --- a/test/e2e/config/config.yaml +++ b/test/e2e/config/config.yaml @@ -3,10 +3,13 @@ baseUrl: http://localhost:8081 env: switchToAdminProject: false username: e2e - password: passw0rdY_ + password: passW0rdY_ usernameAdmin: e2e-admin - passwordAdmin: passw0rdY_ + passwordAdmin: passW0rdY_ userIsRegisted: true + imageName: cirros-0.5.2-x86_64-disk + imageType: Others + imageDownloadUrl: http://download.cirros-cloud.net/0.5.1/cirros-0.5.1-x86_64-disk.img testFiles: - pages/login.spec.js - pages/error.spec.js diff --git a/test/e2e/integration/pages/compute/baremetal.spec.js b/test/e2e/integration/pages/compute/baremetal.spec.js index e98e8e32..3583a614 100644 --- a/test/e2e/integration/pages/compute/baremetal.spec.js +++ b/test/e2e/integration/pages/compute/baremetal.spec.js @@ -21,7 +21,7 @@ describe('The Bare Metal Page', () => { const ip = `10.10.${Cypress._.random(50, 100)}.${Cypress._.random(5, 250)}`; const newname = `${name}-1`; const username = 'admin'; - const password = 'passw0rd_1'; + const password = 'passW0rd_1'; const nodeName = 'node-0'; const portGroupName = `e2e-node-port-group-${uuid}`; const macPort = `AD:78:BE:AF:${Cypress._.random(10, 99)}:${Cypress._.random( diff --git a/test/e2e/integration/pages/compute/instance.spec.js b/test/e2e/integration/pages/compute/instance.spec.js index e57858e2..3331f567 100644 --- a/test/e2e/integration/pages/compute/instance.spec.js +++ b/test/e2e/integration/pages/compute/instance.spec.js @@ -19,10 +19,12 @@ describe('The Instance Page', () => { const uuid = Cypress._.random(0, 1e6); const name = `e2e-instance-${uuid}`; const newname = `${name}-1`; - const password = 'passw0rd_1'; + const password = 'passW0rd_1'; const volumeName = `e2e-instance-attach-volume-${uuid}`; const networkName = `e2e-network-for-instance-${uuid}`; const routerName = `e2e-router-for-instance-${uuid}`; + const imageName = Cypress.env('imageName'); + const imageType = Cypress.env('imageType'); beforeEach(() => { cy.login(listUrl); @@ -41,7 +43,8 @@ describe('The Instance Page', () => { .should('include', `${listUrl}/create`) .wait(5000) .formTableSelect('flavor') - .formTableSelect('image') + .formRadioChooseByLabel('image', imageType) + .formTableSelectBySearch('image', imageName) .formSelect('systemDisk') .formAddSelectAdd('dataDisk') .formSelect('dataDisk') diff --git a/test/e2e/integration/pages/compute/ironic.spec.js b/test/e2e/integration/pages/compute/ironic.spec.js index 5039a299..1d51c97a 100644 --- a/test/e2e/integration/pages/compute/ironic.spec.js +++ b/test/e2e/integration/pages/compute/ironic.spec.js @@ -19,10 +19,11 @@ describe('The Ironic Page', () => { const uuid = Cypress._.random(0, 1e6); const name = `e2e-ironic-${uuid}`; const newname = `${name}-1`; - const password = 'passw0rd_1'; + const password = 'passW0rd_1'; const networkName = `e2e-network-for-ironic-${uuid}`; const routerName = `e2e-router-for-ironic-${uuid}`; - const imageName = `e2e-image-for-ironic-${uuid}`; + const imageName = Cypress.env('imageName'); + const imageType = Cypress.env('imageType'); beforeEach(() => { cy.login(listUrl); @@ -32,13 +33,13 @@ describe('The Ironic Page', () => { cy.createNetwork({ name: networkName }); cy.createRouter({ name: routerName, network: networkName }); cy.createFip(); - cy.createIronicImage({ name: imageName }); }); it('successfully create', () => { cy.clickHeaderButton(2) .wait(5000) .formTableSelect('flavor') + .formRadioChooseByLabel('image', imageType) .formTableSelectBySearch('image', imageName) .clickStepActionNextButton() .wait(5000) @@ -178,6 +179,5 @@ describe('The Ironic Page', () => { cy.deleteAll('fip'); cy.deleteRouter(routerName, networkName); cy.deleteAll('network', networkName); - cy.deleteAll('image', imageName); }); }); diff --git a/test/e2e/integration/pages/compute/server-group.spec.js b/test/e2e/integration/pages/compute/server-group.spec.js index 3b959bfa..237f15d4 100644 --- a/test/e2e/integration/pages/compute/server-group.spec.js +++ b/test/e2e/integration/pages/compute/server-group.spec.js @@ -17,9 +17,11 @@ import { serverGroupListUrl } from '../../../support/constants'; describe('The Server Group Page', () => { const listUrl = serverGroupListUrl; const uuid = Cypress._.random(0, 1e6); - const name = `e2e-server-group-${Cypress._.random(0, 1e6)}`; + const name = `e2e-server-group-${uuid}`; const instanceName = `e2e-instance-by-server-group-${uuid}`; const networkName = `e2e-network-for-server-group-${uuid}`; + const imageName = Cypress.env('imageName'); + const imageType = Cypress.env('imageType'); beforeEach(() => { cy.login(listUrl); @@ -45,12 +47,13 @@ describe('The Server Group Page', () => { }); it('successfully create instance', () => { - const password = 'passw0rd_1'; + const password = 'passW0rd_1'; cy.tableSearchText(name) .goToDetail() .clickHeaderButton(1) .formTableSelect('flavor') - .formTableSelect('image') + .formRadioChooseByLabel('image', imageType) + .formTableSelectBySearch('image', imageName) .formSelect('systemDisk') .clickStepActionNextButton() .wait(5000) @@ -75,9 +78,9 @@ describe('The Server Group Page', () => { }); it('successfully delete', () => { - cy.clickFirstActionDisabled(); + cy.tableSearchText(name).clickFirstActionDisabled(); cy.forceDeleteInstance(instanceName); - cy.wait(5000); + cy.wait(10000); cy.visitPage(listUrl) .tableSearchText(name) .clickConfirmActionInFirst() diff --git a/test/e2e/integration/pages/identity/user.spec.js b/test/e2e/integration/pages/identity/user.spec.js index 06624b66..107505a8 100644 --- a/test/e2e/integration/pages/identity/user.spec.js +++ b/test/e2e/integration/pages/identity/user.spec.js @@ -21,7 +21,7 @@ describe('The User Page', () => { const newname = `${name}-1`; const email = `${name}@example.com`; const phone = '18500000000'; - const password = 'passw0rd_'; + const password = 'passW0rd_'; const tmpPassword = `${password}1`; const projectName = `e2e-project-for-user-${uuid}`; const projectName2 = `e2e-project2-for-user-${uuid}`; diff --git a/test/e2e/integration/pages/network/floatingip.spec.js b/test/e2e/integration/pages/network/floatingip.spec.js index f3b960e6..a54296a2 100644 --- a/test/e2e/integration/pages/network/floatingip.spec.js +++ b/test/e2e/integration/pages/network/floatingip.spec.js @@ -37,6 +37,7 @@ describe('The Floating IP Page', () => { }); it('successfully create', () => { + cy.wait(2000); cy.intercept('GET', '/networks').as('networks'); cy.clickHeaderButton(1) .wait('@networks') @@ -45,6 +46,7 @@ describe('The Floating IP Page', () => { }); it('successfully batch create', () => { + cy.wait(2000); cy.intercept('GET', '/networks').as('networks'); cy.clickHeaderButton(1) .wait('@networks') diff --git a/test/e2e/integration/pages/network/vpn.spec.js b/test/e2e/integration/pages/network/vpn.spec.js index 1a1baa9b..b16e34de 100644 --- a/test/e2e/integration/pages/network/vpn.spec.js +++ b/test/e2e/integration/pages/network/vpn.spec.js @@ -99,8 +99,8 @@ describe('The VPN Page', () => { .wait(2000) .formInput('peer_address', '192.168.1.1') .formSelect('peer_ep_group_id', endpointPeer) - .formInput('password', 'passw0rd') - .formInput('confirmPassword', 'passw0rd') + .formInput('password', 'passW0rd') + .formInput('confirmPassword', 'passW0rd') .formButtonClick('more') .clickModalActionSubmitButton(); }); diff --git a/test/e2e/integration/pages/storage/backup.spec.js b/test/e2e/integration/pages/storage/backup.spec.js index e65c2e01..86135f92 100644 --- a/test/e2e/integration/pages/storage/backup.spec.js +++ b/test/e2e/integration/pages/storage/backup.spec.js @@ -19,11 +19,7 @@ describe('The Volume Backup Page', () => { const uuid = Cypress._.random(0, 1e6); const name = `e2e-backup-${uuid}`; const nameInc = `${name}-inc`; - const nameIns = `e2e-backup-ins-${uuid}`; - const nameInsInc = `${nameIns}-inc`; const volumeName = `e2e-volume-for-backup-${uuid}`; - const networkName = `e2e-network-for-backup-${uuid}`; - const instanceName = `e2e-instance-for-backup-${uuid}`; const volumeNameByBackup = `e2e-volume-by-backup-${uuid}`; const newname = `${name}-1`; @@ -33,8 +29,6 @@ describe('The Volume Backup Page', () => { it('successfully prepair resource', () => { cy.createVolume(volumeName); - cy.createNetwork({ name: networkName }); - cy.createInstance({ name: instanceName, networkName }); }); it('successfully create full bakcup', () => { @@ -45,11 +39,6 @@ describe('The Volume Backup Page', () => { .wait(5000) .waitTableLoading(); - cy.clickHeaderButton(1, 5000) - .formInput('name', nameIns) - .formTableSelectBySearchOption('volume', 'Status', 'In-use') - .clickModalActionSubmitButton(); - cy.wait(30000); }); @@ -61,12 +50,6 @@ describe('The Volume Backup Page', () => { .clickModalActionSubmitButton() .wait(5000) .waitTableLoading(); - - cy.clickHeaderButton(1, 5000) - .formInput('name', nameInsInc) - .formRadioChoose('incremental', 1) - .formTableSelectBySearchOption('volume', 'Status', 'In-use') - .clickModalActionSubmitButton(); }); it('successfully detail', () => { @@ -110,15 +93,9 @@ describe('The Volume Backup Page', () => { cy.tableSearchText(newname) .clickConfirmActionInMore('Delete') .tableSearchText(newname); - - cy.tableSearchText(nameIns) - .clickConfirmActionInMore('Delete') - .tableSearchText(nameIns); }); it('successfully delete related resources', () => { - cy.forceDeleteInstance(instanceName); - cy.deleteAll('network', networkName); cy.deleteAll('volume', volumeName); cy.deleteAll('volume', volumeNameByBackup); }); diff --git a/test/e2e/integration/pages/storage/volume.spec.js b/test/e2e/integration/pages/storage/volume.spec.js index 253f249b..76fdb86e 100644 --- a/test/e2e/integration/pages/storage/volume.spec.js +++ b/test/e2e/integration/pages/storage/volume.spec.js @@ -23,11 +23,9 @@ describe('The Volume Page', () => { 0, 1e6 )}`; - // eslint-disable-next-line no-unused-vars const imageName = `e2e-image-by-volume-${uuid}`; const snapshotName = `e2e-snapshot-by-volume-${uuid}`; const backupName = `e2e-backup-by-volume-${uuid}`; - // eslint-disable-next-line no-unused-vars const backupIncName = `e2e-backup-inc-by-volume-${uuid}`; const cloneVolumeName = `e2e-clone-volume-${uuid}`; @@ -57,6 +55,7 @@ describe('The Volume Page', () => { .url() .should('include', creatUrl) .wait(5000) + .formInput('size', 1) .formInput('name', name) .clickFormActionSubmitButton() .wait(2000) @@ -80,13 +79,6 @@ describe('The Volume Page', () => { cy.goBackToList(listUrl); }); - it('successfully extend volume', () => { - cy.tableSearchText(name) - .clickActionInMore('Extend Volume') - .clickModalActionSubmitButton(); - cy.tableSearchText(name).waitStatusActiveByRefresh(); - }); - it('successfully create snapshot', () => { cy.tableSearchText(name).clickFirstActionButton(); cy.wait(2000) @@ -113,16 +105,17 @@ describe('The Volume Page', () => { .waitStatusActiveByRefresh(); }); - // it("successfully create backup inc", () => { - // cy.tableSearchText(name) - // .clickActionInMore("Create Backup") - // .formInput("name", backupIncName) - // .formRadioChoose("incremental", 1) - // .clickModalActionSubmitButton() - // .tableSearchText(name) - // .waitStatusActive(); - // cy.deleteAll("backup"); - // }); + it('successfully create backup inc', () => { + cy.tableSearchText(name) + .clickActionInMore('Create Backup') + .formInput('name', backupIncName) + .formRadioChoose('incremental', 1) + .clickModalActionSubmitButton() + .tableSearchText(name) + .waitStatusActive(); + cy.deleteAll('backup', backupIncName); + cy.wait(5000).deleteAll('backup', backupName); + }); it('successfully clone volume', () => { cy.tableSearchText(name) @@ -147,21 +140,23 @@ describe('The Volume Page', () => { .wait(5000) .formTableSelect('instance') .clickModalActionSubmitButton(); - - cy.tableSearchText(name).checkColumnValue(3, 'Available'); + cy.tableSearchText(name).waitStatusActiveByRefresh(); }); - // it('successfully create image', () => { - // cy.tableSearchText(name) - // .clickActionInMore('Create Image') - // .formInput('image_name', imageName) - // .clickModalActionSubmitButton() - // .waitStatusActiveByRefresh(); + it('successfully create image', () => { + cy.tableSearchText(name) + .clickActionInMore('Create Image') + .formInput('image_name', imageName) + .clickModalActionSubmitButton(); + cy.tableSearchText(name).waitStatusActiveByRefresh(); + }); - // cy.clearTableSearch() - // .tableSearchSelect('Status', 'In-use') - // .checkActionDisabled('Create Image'); - // }); + it('successfully extend volume', () => { + cy.tableSearchText(name) + .clickActionInMore('Extend Volume') + .clickModalActionSubmitButton(); + cy.tableSearchText(name).waitStatusActiveByRefresh(); + }); it('successfully change type', () => { cy.tableSearchText(name) @@ -183,11 +178,11 @@ describe('The Volume Page', () => { }); it('successfully delete related resources', () => { + cy.deleteAll('image', imageName); cy.deleteAll('volume', cloneVolumeName); cy.forceDeleteInstance(instanceName); cy.deleteAll('network', networkName); cy.loginAdmin().wait(5000); cy.deleteAll('volumeType', volumeTypeName); - // cy.deleteAll('image', imageName); }); }); diff --git a/test/e2e/support/form-commands.js b/test/e2e/support/form-commands.js index accbe2f3..8ba1dca9 100644 --- a/test/e2e/support/form-commands.js +++ b/test/e2e/support/form-commands.js @@ -255,6 +255,15 @@ Cypress.Commands.add('formRadioChoose', (formItemName, itemIndex = 0) => { .click(); }); +Cypress.Commands.add('formRadioChooseByLabel', (formItemName, label) => { + const realName = getTitle(label); + cy.get(getId(formItemName)) + .find('.ant-radio-button-wrapper') + .contains(realName) + .first() + .click(); +}); + Cypress.Commands.add('formAttachFile', (formItemName, filename) => { cy.get(getId(formItemName)).find('input').attachFile(filename).wait(2000); }); diff --git a/test/e2e/support/resource-commands.js b/test/e2e/support/resource-commands.js index 287792fe..879b26bb 100644 --- a/test/e2e/support/resource-commands.js +++ b/test/e2e/support/resource-commands.js @@ -28,12 +28,15 @@ import urlMap, { } from './constants'; Cypress.Commands.add('createInstance', ({ name, networkName }) => { - const password = 'passw0rd_1'; + const password = 'passW0rd_1'; + const imageName = Cypress.env('imageName'); + const imageType = Cypress.env('imageType'); cy.visitPage(instanceListUrl) .clickHeaderButton(1) - .wait(5000) + .wait(8000) .formTableSelect('flavor') - .formTableSelect('image') + .formRadioChooseByLabel('image', imageType) + .formTableSelectBySearch('image', imageName) .formSelect('systemDisk') .clickStepActionNextButton() .wait(5000) @@ -127,7 +130,11 @@ Cypress.Commands.add('deleteInstance', (name, deleteRecycleBin = true) => { Cypress.Commands.add('forceDeleteInstance', (name) => { cy.visitPage(instanceListUrl) .tableSearchText(name) - .clickConfirmActionInMore('Delete'); + .clickActionInMore('Delete'); + cy.get('.ant-modal-confirm-content') + .find('.ant-checkbox-input') + .click() + .clickConfirmActionSubmitButton(); }); Cypress.Commands.add('deleteAllAvailableVolume', () => { @@ -140,7 +147,7 @@ Cypress.Commands.add('deleteAllAvailableVolume', () => { Cypress.Commands.add( 'createInstanceByResource', ({ name, networkName, resource }) => { - const password = 'passw0rd_1'; + const password = 'passW0rd_1'; cy.formTableSelect('flavor') .formTableSelect(resource) .formSelect('systemDisk') @@ -183,6 +190,7 @@ Cypress.Commands.add('createSecurityGrouop', ({ name }) => { Cypress.Commands.add('createFip', () => { cy.intercept('GET', '/networks').as('networks'); cy.visitPage(fipListUrl) + .wait(2000) .clickHeaderButton(1) .wait('@networks') .formSelect('floating_network_id') @@ -199,7 +207,7 @@ Cypress.Commands.add('createUserGroup', ({ name }) => { Cypress.Commands.add('createUser', ({ name }) => { const email = `${name}@example.com`; const phone = '18500000000'; - const password = 'passw0rd_'; + const password = 'passW0rd_'; cy.visitPage(userListUrl) .clickHeaderButton(1) .wait(2000)