From b3d0e1f83fd3e26368cd0fbf36e2061d4d0fac72 Mon Sep 17 00:00:00 2001 From: "Jingwei.Zhang" Date: Thu, 30 Sep 2021 22:23:34 +0800 Subject: [PATCH] test: Fix e2e case 1. Fix flavor case: require flavor types 2. Fix keypaire case: delete keypair created by file 3. Fix security group case: fix delete 4. Fix instance case: fix delete volume twice, wait longer for attaching volume 5. Fix virtual adapter case: fix disassociate floating IP in detail page 6. Fix fip case: remove edit case until front-end fix fip edit with qos service enabled 7. Fix volume case: wait longer for delete instance 8. Fix image case: fix disk format select value when create image 9. Fix server group case: wait longer after delete instance when delete server group 10. Update image config: support image file when download failed to run image case successfully Change-Id: I8321f31086ad660d1fe950bedf144af7f008f6b1 --- test/e2e/config/config.yaml | 1 + .../integration/pages/compute/flavor.spec.js | 4 ++++ .../integration/pages/compute/image.spec.js | 19 +++++++++------ .../pages/compute/instance.spec.js | 6 +---- .../integration/pages/compute/keypair.spec.js | 3 +++ .../pages/compute/server-group.spec.js | 2 +- .../pages/network/floatingip.spec.js | 18 +++++++-------- .../pages/network/security-group.spec.js | 3 ++- .../pages/network/virtual-adapter.spec.js | 6 +++-- .../integration/pages/storage/volume.spec.js | 2 +- test/e2e/support/resource-commands.js | 23 +++++++++++-------- 11 files changed, 51 insertions(+), 36 deletions(-) diff --git a/test/e2e/config/config.yaml b/test/e2e/config/config.yaml index 2dff397f..7db1e87c 100644 --- a/test/e2e/config/config.yaml +++ b/test/e2e/config/config.yaml @@ -9,6 +9,7 @@ env: userIsRegisted: true imageName: cirros-0.5.2-x86_64-disk imageType: Others + imageFile: null imageDownloadUrl: http://download.cirros-cloud.net/0.5.1/cirros-0.5.1-x86_64-disk.img imageCanChangePassword: false extensions: diff --git a/test/e2e/integration/pages/compute/flavor.spec.js b/test/e2e/integration/pages/compute/flavor.spec.js index e702f4a8..8b2d3cc5 100644 --- a/test/e2e/integration/pages/compute/flavor.spec.js +++ b/test/e2e/integration/pages/compute/flavor.spec.js @@ -22,6 +22,10 @@ describe('The Flavor Page', () => { cy.loginAdmin(listUrl); }); + it('successfully prepair flavor types', () => { + cy.setAllFlavorType(); + }); + it('successfully list', () => { cy.clickTab('Custom', 'custom') .clickTab('Heterogeneous Computing', 'heterogeneous_computing') diff --git a/test/e2e/integration/pages/compute/image.spec.js b/test/e2e/integration/pages/compute/image.spec.js index e542b255..28546eff 100644 --- a/test/e2e/integration/pages/compute/image.spec.js +++ b/test/e2e/integration/pages/compute/image.spec.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { onlyOn } from '@cypress/skip-test'; import { imageListUrl, volumeListUrl, @@ -24,16 +25,20 @@ describe('The Image Page', () => { const name = `e2e-image-${uuid}`; const sharedImage = `e2e-image-shared-${uuid}`; const newname = `${name}-1`; - const filename = `cirros-disk-${uuid}.qcow2`; const volumeName = `e2e-volume-by-image-${uuid}`; const downloadUrl = Cypress.env('imageDownloadUrl'); + const imageFile = Cypress.env('imageFile'); + const filename = imageFile || `cirros-disk-${uuid}.qcow2`; beforeEach(() => { cy.login(listUrl); }); - it('successfully download image', () => { - cy.downloadFile(downloadUrl, 'test/e2e/fixtures', filename); + onlyOn(!imageFile, () => { + it('successfully download image', () => { + cy.downloadFile(downloadUrl, 'test/e2e/fixtures', filename); + cy.wait(120000); + }); }); it('successfully list', () => { @@ -46,9 +51,9 @@ describe('The Image Page', () => { .should('include', `${listUrl}/create`) .formInput('name', name) .formAttachFile('file', filename) - .formSelect('disk_format', 'QCOW2 - QEMU Emulator') + .formSelect('disk_format', 'QCOW2 - QEMU image format') .formSelect('os_distro', 'Others') - .formInput('os_version', 'cirros-0.4.0-x86_64') + .formInput('os_version', 'cirros') .formInput('os_admin_user', 'root') .formSelect('usage_type', 'Common Server') .formText('description', name) @@ -68,9 +73,9 @@ describe('The Image Page', () => { .formInput('name', sharedImage) .formTableSelectBySearch('owner', 'e2e') .formAttachFile('file', filename) - .formSelect('disk_format', 'QCOW2 - QEMU Emulator') + .formSelect('disk_format', 'QCOW2 - QEMU image format') .formSelect('os_distro', 'Others') - .formInput('os_version', 'cirros-0.4.0-x86_64') + .formInput('os_version', 'cirros') .formInput('os_admin_user', 'root') .formSelect('usage_type', 'Common Server') .formText('description', sharedImage) diff --git a/test/e2e/integration/pages/compute/instance.spec.js b/test/e2e/integration/pages/compute/instance.spec.js index 99f6192b..6a411689 100644 --- a/test/e2e/integration/pages/compute/instance.spec.js +++ b/test/e2e/integration/pages/compute/instance.spec.js @@ -198,7 +198,7 @@ describe('The Instance Page', () => { .wait(5000) .formTableSelectBySearch('volume', volumeName) .clickModalActionSubmitButton() - .wait(5000); + .wait(30000); // check attach successful cy.tableSearchText(name) @@ -214,9 +214,6 @@ describe('The Instance Page', () => { .wait(5000) .formTableSelectBySearch('volumes', volumeName) .clickModalActionSubmitButton(); - - // delete volume - cy.deleteAll('volume', volumeName); }); it('successfully associate floating IP', () => { @@ -296,6 +293,5 @@ describe('The Instance Page', () => { cy.deleteRouter(routerName, networkName); cy.deleteAll('network', networkName); cy.deleteAll('volume', volumeName); - cy.deleteAllAvailableVolume(); }); }); diff --git a/test/e2e/integration/pages/compute/keypair.spec.js b/test/e2e/integration/pages/compute/keypair.spec.js index 78ad78cf..81563f57 100644 --- a/test/e2e/integration/pages/compute/keypair.spec.js +++ b/test/e2e/integration/pages/compute/keypair.spec.js @@ -52,5 +52,8 @@ describe('The Keypair Page', () => { it('successfully delete', () => { cy.tableSearchText(name).clickConfirmActionInFirst().checkEmptyTable(); + cy.tableSearchText(nameByFile) + .clickConfirmActionInFirst() + .checkEmptyTable(); }); }); diff --git a/test/e2e/integration/pages/compute/server-group.spec.js b/test/e2e/integration/pages/compute/server-group.spec.js index 237f15d4..fb7718ef 100644 --- a/test/e2e/integration/pages/compute/server-group.spec.js +++ b/test/e2e/integration/pages/compute/server-group.spec.js @@ -80,7 +80,7 @@ describe('The Server Group Page', () => { it('successfully delete', () => { cy.tableSearchText(name).clickFirstActionDisabled(); cy.forceDeleteInstance(instanceName); - cy.wait(10000); + cy.wait(60000); cy.visitPage(listUrl) .tableSearchText(name) .clickConfirmActionInFirst() diff --git a/test/e2e/integration/pages/network/floatingip.spec.js b/test/e2e/integration/pages/network/floatingip.spec.js index d7f17f72..b510c775 100644 --- a/test/e2e/integration/pages/network/floatingip.spec.js +++ b/test/e2e/integration/pages/network/floatingip.spec.js @@ -90,17 +90,17 @@ describe('The Floating IP Page', () => { .clickConfirmActionInMore('Disassociate'); }); - onlyOn(!qosServiceEnabled, () => { - it('successfully edit with qos', () => { - cy.clickFirstActionButton() - .formText('description', 'description') - .clickModalActionSubmitButton() - .wait(2000); - }); - }); + // onlyOn(!qosServiceEnabled, () => { + // it('successfully edit', () => { + // cy.clickFirstActionButton() + // .formText('description', 'description') + // .clickModalActionSubmitButton() + // .wait(2000); + // }); + // }); onlyOn(qosServiceEnabled, () => { - it('successfully edit with qos', () => { + it('successfully edit', () => { cy.clickFirstActionButton() .formText('description', 'description') .formTabClick('qos_policy_id', 1) diff --git a/test/e2e/integration/pages/network/security-group.spec.js b/test/e2e/integration/pages/network/security-group.spec.js index b954e687..4259c625 100644 --- a/test/e2e/integration/pages/network/security-group.spec.js +++ b/test/e2e/integration/pages/network/security-group.spec.js @@ -40,6 +40,7 @@ describe('The Security Group Page', () => { .goToDetail() .wait(5000) .clickHeaderButton(1) + .formSelect('ethertype') .formInput('sourcePort', 80) .formInput('remote_ip_prefix', '192.168.0.0/24') .clickModalActionSubmitButton(); @@ -58,6 +59,6 @@ describe('The Security Group Page', () => { }); it('successfully delete', () => { - cy.tableSearchText(newname).clickConfirmActionButton('Delete'); + cy.tableSearchText(newname).clickConfirmActionInMore('Delete'); }); }); diff --git a/test/e2e/integration/pages/network/virtual-adapter.spec.js b/test/e2e/integration/pages/network/virtual-adapter.spec.js index 82545742..97bc1661 100644 --- a/test/e2e/integration/pages/network/virtual-adapter.spec.js +++ b/test/e2e/integration/pages/network/virtual-adapter.spec.js @@ -98,12 +98,14 @@ describe('The Virtual Adapter Page', () => { .formTableSelect('fixed_ip') .wait(5000) .formTableSelect('fip') - .clickModalActionSubmitButton(); + .clickModalActionSubmitButton() + .wait(10000); }); it('successfully disassociate floating IP', () => { cy.tableSearchText(name) - .clickActionInMore('Disassociate Floating IP') + .goToDetail() + .clickDetailActionInMore('Disassociate Floating IP') .wait(5000) .formTableSelect('floating_ip') .clickModalActionSubmitButton(); diff --git a/test/e2e/integration/pages/storage/volume.spec.js b/test/e2e/integration/pages/storage/volume.spec.js index 2349d174..4790dff0 100644 --- a/test/e2e/integration/pages/storage/volume.spec.js +++ b/test/e2e/integration/pages/storage/volume.spec.js @@ -187,7 +187,7 @@ describe('The Volume Page', () => { it('successfully delete related resources', () => { cy.deleteAll('image', imageName); cy.deleteAll('volume', cloneVolumeName); - cy.forceDeleteInstance(instanceName); + cy.forceDeleteInstance(instanceName).wait(30000); cy.deleteAll('network', networkName); cy.loginAdmin().wait(5000); cy.deleteAll('volumeType', volumeTypeName); diff --git a/test/e2e/support/resource-commands.js b/test/e2e/support/resource-commands.js index db386d56..4e61bc78 100644 --- a/test/e2e/support/resource-commands.js +++ b/test/e2e/support/resource-commands.js @@ -230,7 +230,7 @@ Cypress.Commands.add('createProject', ({ name }) => { .clickModalActionSubmitButton(); }); -Cypress.Commands.add('createIronicFlavor', (name) => { +Cypress.Commands.add('setAllFlavorType', () => { const filename = 'flavor-family.json'; const settingName = 'flavor_families'; cy.fixture(filename).then((data) => { @@ -240,18 +240,21 @@ Cypress.Commands.add('createIronicFlavor', (name) => { .formJsonInput('value', data) .wait(2000) .clickModalActionSubmitButton(); - - cy.visitPage(flavorListUrl) - .clickTab('Bare Metal', 'bare_metal') - .clickHeaderButton(1) - .formRadioChoose('category', 0) - .formInput('name', name) - .clickStepActionNextButton() - .wait(2000) - .clickStepActionNextButton(); }); }); +Cypress.Commands.add('createIronicFlavor', (name) => { + cy.setAllFlavorType(); + cy.visitPage(flavorListUrl) + .clickTab('Bare Metal', 'bare_metal') + .clickHeaderButton(1) + .formRadioChoose('category', 0) + .formInput('name', name) + .clickStepActionNextButton() + .wait(2000) + .clickStepActionNextButton(); +}); + Cypress.Commands.add('createIronicImage', ({ name }) => { const filename = 'cirros-0.4.0-x86_64-disk.qcow2'; cy.visitPage(imageListUrl)