From 0295af7bbf06f8066138d1c34513a164756d3444 Mon Sep 17 00:00:00 2001 From: "Jingwei.Zhang" Date: Thu, 2 Dec 2021 14:19:47 +0800 Subject: [PATCH] test: Add swift e2e Add swift e2e: 1. create/delete container, update access 2. upload/edit/rename/delete/copy/paste/cut file 3. create/delete folder Change-Id: Iced51cc04d672a85f6180dac7c96296bb9af316d --- playbooks/devstack/storage/run-e2etests.yaml | 1 + test/e2e/config/config-storage.yaml | 2 + test/e2e/config/config.yaml | 2 + test/e2e/fixtures/container-file.png | Bin 0 -> 4042 bytes .../integration/pages/storage/swift.spec.js | 163 ++++++++++++++++++ test/e2e/support/commands.js | 4 + test/e2e/support/constants.js | 1 + test/e2e/support/table-commands.js | 5 + 8 files changed, 178 insertions(+) create mode 100644 test/e2e/fixtures/container-file.png create mode 100644 test/e2e/integration/pages/storage/swift.spec.js diff --git a/playbooks/devstack/storage/run-e2etests.yaml b/playbooks/devstack/storage/run-e2etests.yaml index 2fa19116..f5dbd0b6 100644 --- a/playbooks/devstack/storage/run-e2etests.yaml +++ b/playbooks/devstack/storage/run-e2etests.yaml @@ -15,6 +15,7 @@ cp test/e2e/config/config-storage.yaml $config_file sed -i "s#baseUrl.*#baseUrl: https://127.0.0.1:9999#" $config_file sed -i "s/- cinder::buckup/# - cinder::buckup/" $config_file + sed -i "s/- swift/# - swift/" $config_file sed -i "s#username:.*#username: admin#" $config_file sed -i "s#password:.*#password: secretadmin#" $config_file sed -i "s#usernameAdmin:.*#usernameAdmin: admin#" $config_file diff --git a/test/e2e/config/config-storage.yaml b/test/e2e/config/config-storage.yaml index c4361d2f..9058dd7e 100644 --- a/test/e2e/config/config-storage.yaml +++ b/test/e2e/config/config-storage.yaml @@ -14,6 +14,7 @@ env: imageCanChangePassword: false extensions: - cinder::buckup + - swift testFiles: # storage - pages/storage/qos.spec.js @@ -22,3 +23,4 @@ testFiles: - pages/storage/backup.spec.js - pages/storage/snapshot.spec.js - pages/storage/storage.spec.js + - pages/storage/swift.spec.js diff --git a/test/e2e/config/config.yaml b/test/e2e/config/config.yaml index c70bd1c3..3770f4fa 100644 --- a/test/e2e/config/config.yaml +++ b/test/e2e/config/config.yaml @@ -20,6 +20,7 @@ env: - octavia - heat - ironic + - swift testFiles: - pages/login.spec.js - pages/error.spec.js @@ -36,6 +37,7 @@ testFiles: - pages/storage/backup.spec.js - pages/storage/snapshot.spec.js - pages/storage/storage.spec.js + - pages/storage/swift.spec.js # network - pages/network/router.spec.js - pages/network/network.spec.js diff --git a/test/e2e/fixtures/container-file.png b/test/e2e/fixtures/container-file.png new file mode 100644 index 0000000000000000000000000000000000000000..ae918c9eb82c1bcb5e2b0108d3d9ea2f48020df1 GIT binary patch literal 4042 zcma)92|SehyMJd=l#(SnWgCMQ>rf(DhiL{y82d70kY$j@ZknlxWG|#FWhu*v?7|@B zSX0fh#8`?_Ba?j`>-^v8fA8ns&OP0G-|zdr&*!%<&-42}&+pa+Q}n()hxY&gu+Io% zXaUMj&d0wC{BLyzj)8*9Q~$g^08}LLZo2LS(~v6`Xe3b9C&mC1FgJ|Fc>oAM0sxdK z09XgJC|>~}2mt^yE&!l;4*(7ZWHp#;fd#uRnxG9q2|jBEjbu>l4#3!50VU?gcecw% z2LSkdjSTg%p(D&O+$F5%cE`fpl}U`+;n6g?+gol*hSmYcjm`*sx*{ib>P=vbTgMTfDst=7kGCA{0$e!apA z(WMn3fG*J`TjidMJhIe;Q*TE;$#vuP|MDsGw6UrqKbJoLB|-!@5OT~sui){K>5k2N zdVx-u2UJSk0&-+Ng~co8V{0~>{zkKo~<#K2`j`N4FGfZ(PG z1Tz1gXSbn7w3;XO$qY7IQPD!y$|C4{7E_xN8%s2PLQKE=RnDofbUe(nRyjmn=DhQr zA>ukQ^puup&eM`O)WsBA86IDp(zFO9Q$D0kV9D)juWlHPC8j5{LMdEs@spD&L0T2X z^_eEJ8?HIn0<@bB4u0VN&=QmDuTg+|C!%B;L6z(;G%dEA>DS$UbRT=i`>-T=l)Sy2 z9Cha-UW2h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6{P%Es)P5&!_QM3gNN?@Dyn zbPIF`1)z#hMJTFpUaX3S=E)P9ClK-o4NU~%bd-VXPYnqEcrTBzUpK%EZ*XqXXwC>% zf;}}ax?XWt3<~rDJiL6}HIFZmPPm0j@!FF$23H-A4x4}U+RGLaDQBZUj_@O5+Z e3-Tg(`Y3Z+D1m(d^-{`Umw*w<)UXWca{XUT&hq2{ literal 0 HcmV?d00001 diff --git a/test/e2e/integration/pages/storage/swift.spec.js b/test/e2e/integration/pages/storage/swift.spec.js new file mode 100644 index 00000000..96870402 --- /dev/null +++ b/test/e2e/integration/pages/storage/swift.spec.js @@ -0,0 +1,163 @@ +// Copyright 2021 99cloud +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { onlyOn } from '@cypress/skip-test'; +import { containerListUrl } from '../../../support/constants'; + +const swiftEnabled = (Cypress.env('extensions') || []).includes('swift'); + +onlyOn(!swiftEnabled, () => { + describe('Skip The Swift Page', () => { + it('successfully skip', () => {}); + }); +}); + +onlyOn(swiftEnabled, () => { + describe('The Swift Container Page', () => { + const listUrl = containerListUrl; + const uuid = Cypress._.random(0, 1e6); + const name = `e2e-container-${uuid}`; + const name2 = `e2e-container2-${uuid}`; + const folderName = `e2e-flolder-${uuid}`; + const folderName2 = `e2e-flolder2-${uuid}`; + const filename = `container-file.png`; + const filename2 = `container-file2.png`; + + beforeEach(() => { + cy.login(listUrl); + }); + + it('successfully create container', () => { + cy.clickHeaderButton(1) + .formInput('name', name) + .clickModalActionSubmitButton(); + + cy.clickHeaderButton(1) + .formInput('name', name2) + .clickModalActionSubmitButton(); + }); + + it('successfully update container access', () => { + cy.tableSearchText(name) + .clickFirstActionButton() + .wait(5000) + .formSwitch('isPublic') + .clickModalActionSubmitButton(); + }); + + it('successfully create folder', () => { + cy.tableSearchText(name).goToContainerDetail(); + cy.clickHeaderButton(1) + .formInput('folder_name', folderName) + .clickModalActionSubmitButton(); + cy.clickHeaderButton(1) + .formInput('folder_name', folderName2) + .clickModalActionSubmitButton(); + }); + + it('successfully upload file in container', () => { + cy.tableSearchText(name) + .goToContainerDetail() + .clickHeaderButton(2) + .formAttachFile('file', filename) + .clickModalActionSubmitButton(); + }); + + it('successfully download file', () => { + cy.tableSearchText(name).goToContainerDetail().tableSearchText(filename); + cy.clickConfirmActionInMore('Download File'); + }); + + it('successfully copy file to folder', () => { + cy.tableSearchText(name).goToContainerDetail(); + cy.tableSearchText(filename).clickConfirmActionInMore('Copy'); + + cy.clickBreadcrumbLink() + .waitTableLoading() + .tableSearchText(name) + .goToContainerDetail() + .tableSearchText(folderName) + .goToContainerDetail() + .clickHeaderConfirmButtonByTitle('Paste'); + }); + + it('successfully cut file from folder to folder', () => { + cy.tableSearchText(name) + .goToContainerDetail() + .tableSearchText(folderName) + .goToContainerDetail() + .tableSearchText(filename) + .clickConfirmActionInMore('Cut'); + + cy.clickBreadcrumbLink() + .waitTableLoading() + .tableSearchText(name) + .goToContainerDetail() + .tableSearchText(folderName2) + .goToContainerDetail() + .clickHeaderConfirmButtonByTitle('Paste'); + }); + + it('successfully rename file in container', () => { + cy.tableSearchText(name) + .goToContainerDetail() + .tableSearchText(filename) + .clickActionInMore('Rename') + .formInput('newname', filename2) + .clickModalActionSubmitButton(); + }); + + it('successfully cut file from container to container', () => { + cy.tableSearchText(name) + .goToContainerDetail() + .tableSearchText(filename2) + .clickConfirmActionInMore('Cut'); + + cy.clickBreadcrumbLink() + .waitTableLoading() + .tableSearchText(name2) + .goToContainerDetail() + .clickHeaderConfirmButtonByTitle('Paste'); + }); + + it('successfully delete file in container', () => { + cy.tableSearchText(name2) + .goToContainerDetail() + .tableSearchText(filename2) + .clickConfirmActionInFirst(); + }); + + it('successfully delete file in folder', () => { + cy.tableSearchText(name) + .goToContainerDetail() + .tableSearchText(folderName2) + .goToDetail() + .tableSearchText(filename) + .clickConfirmActionInFirst(); + }); + + it('successfully delete folder', () => { + cy.tableSearchText(name) + .goToContainerDetail() + .tableSearchText(folderName) + .clickConfirmActionInFirst(); + cy.tableSearchText(folderName2).clickConfirmActionInFirst(); + }); + + it('successfully delete container', () => { + cy.tableSearchText(name).clickConfirmActionButton('Delete'); + cy.tableSearchText(name2).clickConfirmActionButton('Delete'); + }); + }); +}); diff --git a/test/e2e/support/commands.js b/test/e2e/support/commands.js index 8e04841c..c1a04ed3 100644 --- a/test/e2e/support/commands.js +++ b/test/e2e/support/commands.js @@ -175,3 +175,7 @@ Cypress.Commands.add('logout', () => { cy.clearToken(); cy.get('.ant-layout-header').find('.anticon-user').click().wait(2000); }); + +Cypress.Commands.add('clickBreadcrumbLink', (index = 0) => { + cy.get('.ant-breadcrumb-link').eq(index).click(); +}); diff --git a/test/e2e/support/constants.js b/test/e2e/support/constants.js index 25426135..36fcd61b 100644 --- a/test/e2e/support/constants.js +++ b/test/e2e/support/constants.js @@ -29,6 +29,7 @@ export const volumeSnapshotListUrl = '/storage/snapshot'; export const backupListUrl = '/storage/backup'; export const volumeTypeListUrl = '/storage/volume-type-admin'; export const storageBackendListUrl = '/storage/storage-admin'; +export const containerListUrl = '/storage/container'; // network export const networkListUrl = '/network/networks'; diff --git a/test/e2e/support/table-commands.js b/test/e2e/support/table-commands.js index e1e28add..0ec18ebc 100644 --- a/test/e2e/support/table-commands.js +++ b/test/e2e/support/table-commands.js @@ -454,3 +454,8 @@ Cypress.Commands.add('clickButtonInColumn', (index) => { .find('button') .click({ force: true }); }); + +Cypress.Commands.add('goToContainerDetail', () => { + cy.clickLinkInColumn(1, 2000); + cy.waitTableLoading(); +});