
1. Update password value to fit value check 2. Remove cases in backup e2e: remove backup by volume which is used by instance 3. Update waittime for fip list page to ensure create form can be opened 4. Update image select when create instance 5. Add volume case:create backup and backup inc 6. Update force delete instance command Change-Id: I45e4bba0b670171860d85e4e5cb402962a41becd
4.4 KiB
English | 简体中文
For specific introduction and usage of Cypress, please refer toOfficial document
Here we mainly give the E2E use cases corresponding to the resources in the front-end page of Skyline-console, and use function defined in test/e2e/support
The following is an introduction, taking the instance use case test/e2e/integration/pages/compute/instance.spec.js
as an example
Generally, when testing the corresponding functions of a resource, follow the following order
-
Prepare relevant variables in text
- Required parameters when creating a resource, such as: name, password
- Required parameters when editing resources, such as: new name
- When creating an associated resource, the name of the associated resource, such as: network name, router name, volume name
const uuid = Cypress._.random(0, 1e6); const name = `e2e-instance-${uuid}`; const newname = `${name}-1`; const password = 'passW0rd_1'; const volumeName = `e2e-instance-attach-volume-${uuid}`; const networkName = `e2e-network-for-instance-${uuid}`; const routerName = `e2e-router-for-instance-${uuid}`;
-
Login before operation
- If you are operating console resources, please use
cy.login
- If you are operating administrator resource, please use
cy.loginAdmin
- Generally, the variable
listUrl
is used in thelogin
andloginAdmin
functions, that is, directly access the page where the resource is located after logging in
beforeEach(() => { cy.login(listUrl); });
- If you are operating console resources, please use
-
Create associated resources, use the resource creation function provided in
resource-commands.js
, take the test instance as an example-
Create a network for testing to create a instance, attach interface
cy.createNetwork({ name: networkName });
-
Create router
cy.createRouter
to ensure that the floating IP is reachable when testing the associated floating IP- The router created in the following way will open the external network gateway and bind the subnet of the
networkName
network
cy.createRouter({ name: routerName, network: networkName });
- The router created in the following way will open the external network gateway and bind the subnet of the
-
Create floating ip
cy.createFip
,Used to test associat floating ipcy.createFip();
-
Create volumr
cy.createVolume
(Used to test attach volume)cy.createVolume(volumeName);
-
-
Write cases for creating resources
-
Write use cases for accessing resource details
-
Write use cases corresponding to all operations of resources separately
- Generally, the use case of the
edit
operation is written later, and then the use case of thedelete
operation is written, so that you can test whether the editing is effective
- Generally, the use case of the
-
To delete associated resources, use the resource-deleting function provided in
resource-commands.js
, this is to make the resources in the test account as clean as possible after the test case is executed-
Delete Floating IP
cy.deleteAll('fip');
-
Delete Router
routerName
cy.deleteRouter(routerName, networkName);
-
Delete Network
networkName
cy.deleteAll('network', networkName);
-
Delete Volume
volumeName
cy.deleteAll('volume', volumeName);
-
Delete all available volume
cy.deleteAllAvailableVolume();
-
The 4
, 5
, and 6
in the above steps are mainly used
- The function operation form in
test/e2e/support/form-commands.js
, please refer to the detailed introduction3-1-E2E-form-operation - The functions in
test/e2e/support/table-commands.js
, click on the buttons in the operation table, search, and enter for details. please refer to the detailed introduction3-2-E2E-table-operation - The functions in
test/e2e/support/detail-commands.js
, the operation returns the list page, the detection details, and the switching details Tab. please refer to the detailed introduction3-3-E2E-detail-operation
Create and delete associated resources mainly use the functions in test/e2e/support/resource-commands.js
,. please refer to the detailed introduction33-4-E2E-resource-operation