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
This commit is contained in:
Jingwei.Zhang 2021-12-02 14:19:47 +08:00
parent a956a9f3df
commit 0295af7bbf
8 changed files with 178 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -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');
});
});
});

View File

@ -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();
});

View File

@ -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';

View File

@ -454,3 +454,8 @@ Cypress.Commands.add('clickButtonInColumn', (index) => {
.find('button')
.click({ force: true });
});
Cypress.Commands.add('goToContainerDetail', () => {
cy.clickLinkInColumn(1, 2000);
cy.waitTableLoading();
});