xusongfu 3b2144c39d test: Add zun e2e test
1. create zun container test
2. start zun container test
3. pause zun container test
4. unpause zun container test
5. reboot zun container test
6. stop zun container test
7. delete zun container test
8. create zun capsule test
9. delete zun capsule test

Change-Id: If291bbfd1dde4a73b5e14c171e3bb885d687f480
2022-06-08 18:48:07 +08:00

96 lines
2.8 KiB
JavaScript

import { onlyOn } from '@cypress/skip-test';
import { zunContainerListUrl } from '../../../support/constants';
const zunServiceEnabled = (Cypress.env('extensions') || []).includes('zun');
onlyOn(!zunServiceEnabled, () => {
describe('Skip The zunContainer Page', () => {
it('successfully skip', () => {});
});
});
onlyOn(zunServiceEnabled, () => {
describe('The zunContainer Page', () => {
const listUrl = zunContainerListUrl;
const uuid = Cypress._.random(0, 1e6);
const zunContainerName = `e2e-zunContainer-${uuid}`;
beforeEach(() => {
cy.login(listUrl);
});
it('successfully create', () => {
cy.clickHeaderButton(1)
.url()
.should('include', `${listUrl}/create`)
.wait(5000)
.formInput('containerName', zunContainerName)
.formInput('image', 'cirros')
.clickStepActionNextButton()
.wait(2000)
.clickStepActionNextButton()
.wait(2000)
.clickStepActionNextButton()
.wait(2000)
.clickStepActionNextButton()
.wait(2000)
.clickStepActionNextButton()
.waitFormLoading()
.url()
.should('include', listUrl)
.closeNotice()
.waitStatusTextByFresh('Created');
});
it('successfully start', () => {
cy.tableSimpleSearchText(zunContainerName)
.checkTableFirstRow(zunContainerName)
.clickActionInMore('Start')
.clickConfirmActionSubmitButton()
.waitStatusTextByFresh('Running');
});
it('successfully pause', () => {
cy.tableSimpleSearchText(zunContainerName)
.checkTableFirstRow(zunContainerName)
.clickActionInMore('Pause')
.clickConfirmActionSubmitButton()
.waitStatusTextByFresh('Paused');
});
it('successfully unpause', () => {
cy.tableSimpleSearchText(zunContainerName)
.checkTableFirstRow(zunContainerName)
.clickActionButtonByTitle('Unpause')
.clickConfirmActionSubmitButton()
.waitStatusTextByFresh('Running');
});
it('successfully reboot', () => {
cy.tableSimpleSearchText(zunContainerName)
.checkTableFirstRow(zunContainerName)
.clickActionInMore('Reboot')
.clickConfirmActionSubmitButton()
.waitStatusTextByFresh('Restarting')
.wait(5000)
.waitStatusTextByFresh('Running');
});
it('successfully stop', () => {
cy.tableSimpleSearchText(zunContainerName)
.checkTableFirstRow(zunContainerName)
.clickActionInMore('Stop')
.clickConfirmActionSubmitButton()
.waitStatusTextByFresh('Stopped');
});
it('successfully delete', () => {
cy.tableSimpleSearchText(zunContainerName)
.checkTableFirstRow(zunContainerName)
.clickFirstActionButton()
.clickConfirmActionSubmitButton()
.checkEmptyTable();
});
});
});