Skip to content

Commit

Permalink
fix: e2e cases error (#316)
Browse files Browse the repository at this point in the history
Signed-off-by: liuying <liu.ying@99cloud.net>

Signed-off-by: liuying <liu.ying@99cloud.net>
  • Loading branch information
lysign authored Dec 6, 2022
1 parent d1d52de commit bbe7901
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cypress/config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ env:
httpsRegistry: 172.16.29.140
aliyunRegistry: 'registry.aliyuncs.com/google_containers'
# 备份
backupFSRootDir: /data/aio-test
backupFSRootDir: /tmp/nfs/data/e2e-test
backupS3EndPoint: 172.20.163.233:9000
backupS3Admin: admin
backupS3Password: Aa123456
26 changes: 13 additions & 13 deletions cypress/e2e/pages/access/oauth2.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('外部用户登录', () => {

cy.tableSearchText(username);
cy.clickActionButtonByTitle('Edit');
cy.formSelect('role', role);
cy.formSelect('role', role, undefined, false);
cy.clickModalActionSubmitButton();

cy.loginByKeycloak(username, password);
Expand All @@ -50,21 +50,11 @@ describe('外部用户登录', () => {
cy.checkTableRowLength();
});

// 查看外部用户
it(...testCase('访问控制-用户-查看外部用户-1').smoke().value(), () => {
cy.login(listUrl);

cy.tableSearchText(username);

cy.checkTableColVal(5, 'keycloak');
cy.get('.ant-table-tbody').should('not.contain.text', getTitle('More'));
});

// 编辑外部用户
it(...testCase('访问控制-用户-编辑外部用户-1').smoke().value(), () => {
cy.login(listUrl);
cy.loginByKeycloak(username, password);

cy.visit('/access/user');
cy.visitPage('/access/user');
cy.tableSearchText(username);
cy.clickActionButtonByTitle('Edit');
cy.formInput('phone', phone);
Expand All @@ -75,6 +65,16 @@ describe('外部用户登录', () => {
cy.checkTableColVal(3, email);
});

// 查看外部用户
it(...testCase('访问控制-用户-查看外部用户-1').smoke().value(), () => {
cy.login(listUrl);

cy.tableSearchText(username);

cy.checkTableColVal(5, 'keycloak');
cy.get('.ant-table-tbody').should('not.contain.text', getTitle('More'));
});

// 删除外部用户
it(...testCase('访问控制-用户-删除外部用户-1').smoke().value(), () => {
cy.login(listUrl);
Expand Down
66 changes: 66 additions & 0 deletions cypress/e2e/pages/cluster/cluster.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,50 @@ describe('集群', () => {
cy.addContext();
});

// 创建带存储插件 nfs 的集群
it(...testCase('集群管理-创建-3').smoke().value(), () => {
Cypress.on('fail', (error) => {
if (error.message.indexOf('Timed out retrying') !== 0) throw error;
});
cy.visit('/');
cy.loginInput('username', Cypress.env('username'))
.loginInput('password', Cypress.env('password'))
.loginFormSubmit();
cy.wait(3000);

cy.clickHeaderButton(0);

cy.wait(1000).url().should('include', 'cluster/create');

// cluster name
cy.formInput('name', name);
cy.formSelect('region', region);
// select node
cy.waitTransferList();
cy.formMultiTransfer('nodes', 0);
cy.clickStepActionNextButton('step-next');
cy.wait(1000);

cy.formInput('localRegistry', offLineRegistry);
cy.wait(1000);

cy.clickStepActionNextButton('step-next');

cy.selectComponentTab('NFS CSI');
cy.enableComponent('nfs-csi');

cy.get('input[title="服务地址"]').eq(0).type(Cypress.env('nfsIp'));
cy.get('input[title="共享路径"]').eq(0).type(Cypress.env('nfsPath'));
cy.get('input[title="NFS 镜像仓库代理"]').eq(0).type(offLineRegistry);
cy.clickStepActionNextButton('step-quick');
cy.clickStepActionNextButton('step-confirm');

// check status
cy.wait(2000).tableSearchText(name).waitStatusSuccess();

cy.deleteCluster(name);
});

// 创建单机集群
it(...testCase('集群管理-创建-1').smoke().value(), () => {
cy.clickHeaderButton(0);
Expand Down Expand Up @@ -75,6 +119,28 @@ describe('集群', () => {
cy.deleteCluster(name);
});

// 创建同名集群
it.only(...testCase('集群管理-创建-4').smoke().value(), () => {
cy.clickHeaderButton(0);

cy.wait(1000).url().should('include', 'cluster/create');

// cluster name
cy.formInput('name', name);
cy.formSelect('region', region);
// select node
cy.waitTransferList();
cy.formMultiTransfer('nodes', 0);

// next step
cy.clickStepActionNextButton('step-next');
cy.wait(1000);
cy.clickStepActionNextButton('step-quick');
cy.clickStepActionNextButton('step-confirm');

cy.checkActionError();
});

// 创建带存储插件 nfs 的集群
it(...testCase('集群管理-创建-3').smoke().value(), () => {
cy.clickHeaderButton(0);
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/pages/cluster/hosting-kubeadm.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ describe('kubeadm 纳管', () => {
cy.get('input[title="共享路径"]').eq(0).type(Cypress.env('nfsPath'));
cy.clickStepActionConfirmButton();

cy.wait(2000).waitStatusSuccess(null, 2 * 60 * 1000);
cy.wait(2000).waitStatusSuccess(null, 10 * 60 * 1000);
}
);

Expand Down
13 changes: 13 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@ Cypress.Commands.add('visitPage', (url = '', isTable = true) => {

// 登录
Cypress.Commands.add('login', (visitUrl = '', isTable = true) => {
const username = Cypress.env('username');
const password = Cypress.env('password');

cy.visit('/auth/login');
cy.loginInput('username', username)
.loginInput('password', password)
.loginFormSubmit();
cy.visitPage(visitUrl || '/cluster', isTable);
cy.wait(500);
});

// 登录
Cypress.Commands.add('loginByApi', (visitUrl = '', isTable = true) => {
cy.session('login', () => {
cy.setLanguage();

Expand Down

0 comments on commit bbe7901

Please sign in to comment.