From 700c208bc8f881b45e33d81742e5649ef52dc242 Mon Sep 17 00:00:00 2001 From: "Jingwei.Zhang" Date: Sat, 9 Oct 2021 13:22:39 +0800 Subject: [PATCH] test: Update e2e case 1. Update flavor e2e order 2. Fix create shared image 3. Update waiting for attach volume finished 4. Add instance resize case 5. Update edit setting wait time 6. Update wait time for topologo page 7. Update waiting for volume attached finished Change-Id: Idca457b794aedd6e414e1f5486fae8ef75ebeb1e --- test/e2e/config/config-compute.yaml | 2 +- test/e2e/config/config.yaml | 2 +- .../integration/pages/compute/image.spec.js | 12 ++++++- .../pages/compute/instance.spec.js | 36 ++++++++++--------- .../pages/configuration/setting.spec.js | 2 +- .../pages/network/topology.spec.js | 1 + .../integration/pages/storage/volume.spec.js | 8 ++--- test/e2e/support/form-commands.js | 4 +-- 8 files changed, 40 insertions(+), 27 deletions(-) diff --git a/test/e2e/config/config-compute.yaml b/test/e2e/config/config-compute.yaml index 7d10c27a..3ecaa322 100644 --- a/test/e2e/config/config-compute.yaml +++ b/test/e2e/config/config-compute.yaml @@ -17,7 +17,6 @@ env: testFiles: # compute - pages/compute/image.spec.js - - pages/compute/flavor.spec.js - pages/compute/server-group.spec.js - pages/compute/keypair.spec.js - pages/compute/instance.spec.js @@ -25,3 +24,4 @@ testFiles: - pages/compute/aggregate.spec.js - pages/compute/hypervisor.spec.js - pages/compute/baremetal.spec.js + - pages/compute/flavor.spec.js diff --git a/test/e2e/config/config.yaml b/test/e2e/config/config.yaml index 7db1e87c..c70bd1c3 100644 --- a/test/e2e/config/config.yaml +++ b/test/e2e/config/config.yaml @@ -48,7 +48,6 @@ testFiles: - pages/network/topology.spec.js # compute - pages/compute/image.spec.js - - pages/compute/flavor.spec.js - pages/compute/server-group.spec.js - pages/compute/keypair.spec.js - pages/compute/instance.spec.js @@ -56,6 +55,7 @@ testFiles: - pages/compute/aggregate.spec.js - pages/compute/hypervisor.spec.js - pages/compute/baremetal.spec.js + - pages/compute/flavor.spec.js # - pages/management/recycle-bin.spec.js # configuration - pages/configuration/metadata.spec.js diff --git a/test/e2e/integration/pages/compute/image.spec.js b/test/e2e/integration/pages/compute/image.spec.js index 28546eff..fddc1291 100644 --- a/test/e2e/integration/pages/compute/image.spec.js +++ b/test/e2e/integration/pages/compute/image.spec.js @@ -29,11 +29,17 @@ describe('The Image Page', () => { const downloadUrl = Cypress.env('imageDownloadUrl'); const imageFile = Cypress.env('imageFile'); const filename = imageFile || `cirros-disk-${uuid}.qcow2`; + const projectName = `e2e-project-for-image-${uuid}`; beforeEach(() => { cy.login(listUrl); }); + it('successfully prepair resource', () => { + cy.loginAdmin(); + cy.createProject({ name: projectName }); + }); + onlyOn(!imageFile, () => { it('successfully download image', () => { cy.downloadFile(downloadUrl, 'test/e2e/fixtures', filename); @@ -71,7 +77,7 @@ describe('The Image Page', () => { .clickHeaderButton(1) .wait(5000) .formInput('name', sharedImage) - .formTableSelectBySearch('owner', 'e2e') + .formTableSelectBySearch('owner', projectName) .formAttachFile('file', filename) .formSelect('disk_format', 'QCOW2 - QEMU image format') .formSelect('os_distro', 'Others') @@ -148,4 +154,8 @@ describe('The Image Page', () => { .tableSearchText(sharedImage) .clickConfirmActionInMore('Delete'); }); + + it('successfully delete related resources', () => { + cy.loginAdmin().deleteAll('project', projectName); + }); }); diff --git a/test/e2e/integration/pages/compute/instance.spec.js b/test/e2e/integration/pages/compute/instance.spec.js index 6a411689..1d747071 100644 --- a/test/e2e/integration/pages/compute/instance.spec.js +++ b/test/e2e/integration/pages/compute/instance.spec.js @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { instanceListUrl } from '../../../support/constants'; +import { instanceListUrl, volumeListUrl } from '../../../support/constants'; describe('The Instance Page', () => { const listUrl = instanceListUrl; @@ -106,6 +106,7 @@ describe('The Instance Page', () => { .clickConfirmActionInMoreSub('Stop', 'Instance Status') .tableSearchText(name) .waitStatusTextByFresh('Shutoff') + .tableSearchText(name) .selectFirst() .clickHeaderButtonByTitle('Stop') .checkDisableAction(2000); @@ -197,15 +198,12 @@ describe('The Instance Page', () => { .clickActionInMoreSub('Attach Volume', 'Related Resources') .wait(5000) .formTableSelectBySearch('volume', volumeName) - .clickModalActionSubmitButton() - .wait(30000); + .clickModalActionSubmitButton(); // check attach successful - cy.tableSearchText(name) - .goToDetail() - .clickDetailTab('Volume') + cy.visitPage(volumeListUrl) .tableSearchText(volumeName) - .checkColumnValue(2, 'In-use'); + .waitStatusTextByFresh('In-use'); }); it('successfully detach volume', () => { @@ -265,16 +263,20 @@ describe('The Instance Page', () => { .waitStatusActiveByRefresh(); }); - // todo: need a confirm resize button - // it('successfully resize', () => { - // cy.tableSearchText(name) - // .clickActionInMoreSub('Resize', 'Configuration Update') - // .wait(5000) - // .formTableSelect('newFlavor') - // .formCheckboxClick('option') - // .clickModalActionSubmitButton() - // .waitStatusActiveByRefresh(); - // }); + it('successfully resize', () => { + cy.tableSearchText(name) + .clickActionInMoreSub('Resize', 'Configuration Update') + .wait(5000) + .formTableSelect('newFlavor') + .formCheckboxClick('option') + .clickModalActionSubmitButton() + .wait(120000); + cy.visitPage(instanceListUrl) + .tableSearchText(name) + .clickConfirmActionInMoreSub('Confirm Resize', 'Configuration Update') + .tableSearchText(name) + .waitStatusActiveByRefresh(); + }); it('successfully edit', () => { cy.tableSearchText(name) diff --git a/test/e2e/integration/pages/configuration/setting.spec.js b/test/e2e/integration/pages/configuration/setting.spec.js index 04e764aa..ed8a334d 100644 --- a/test/e2e/integration/pages/configuration/setting.spec.js +++ b/test/e2e/integration/pages/configuration/setting.spec.js @@ -34,7 +34,7 @@ describe('The Setting Page', () => { cy.tableSimpleSearchText(name) .clickActionInMore('Edit') .formJsonInput('value', data) - .wait(2000) + .wait(10000) .clickModalActionSubmitButton(); cy.visitPage(flavorListUrl) diff --git a/test/e2e/integration/pages/network/topology.spec.js b/test/e2e/integration/pages/network/topology.spec.js index 3d5ae386..fb03b65e 100644 --- a/test/e2e/integration/pages/network/topology.spec.js +++ b/test/e2e/integration/pages/network/topology.spec.js @@ -31,6 +31,7 @@ describe('The Netowrk Topology Page', () => { }); it('successfully page', () => { + cy.wait(5000); cy.get('canvas').should('exist'); }); diff --git a/test/e2e/integration/pages/storage/volume.spec.js b/test/e2e/integration/pages/storage/volume.spec.js index 4790dff0..b1c4aa33 100644 --- a/test/e2e/integration/pages/storage/volume.spec.js +++ b/test/e2e/integration/pages/storage/volume.spec.js @@ -136,9 +136,9 @@ describe('The Volume Page', () => { .clickActionInMore('Attach') .wait(5000) .formTableSelectBySearch('instance', instanceName) - .clickModalActionSubmitButton(); - - cy.wait(10000).tableSearchText(name).checkColumnValue(3, 'In-use'); + .clickModalActionSubmitButton() + .tableSearchText(name) + .waitStatusTextByFresh('In-use'); }); it('successfully detach', () => { @@ -189,7 +189,7 @@ describe('The Volume Page', () => { cy.deleteAll('volume', cloneVolumeName); cy.forceDeleteInstance(instanceName).wait(30000); cy.deleteAll('network', networkName); - cy.loginAdmin().wait(5000); + cy.loginAdmin().wait(10000); cy.deleteAll('volumeType', volumeTypeName); }); }); diff --git a/test/e2e/support/form-commands.js b/test/e2e/support/form-commands.js index cc3a086f..b25247f4 100644 --- a/test/e2e/support/form-commands.js +++ b/test/e2e/support/form-commands.js @@ -141,7 +141,7 @@ Cypress.Commands.add('formJsonInput', (formItemName, content) => { cy.get(getId(formItemName)) .find('textarea') .clear({ force: true }) - .wait(1000) + .wait(2000) .type(value, { force: true, parseSpecialCharSequences: false }); }); @@ -174,7 +174,7 @@ Cypress.Commands.add('formTableSelect', (formItemName, value) => { .find('.ant-table-row') .first() .find('.ant-table-selection-column') - .click(); + .click({ force: true }); return; } cy.get(getId(formItemName))