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 00000000..ae918c9e Binary files /dev/null and b/test/e2e/fixtures/container-file.png differ 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(); +});