Fix cypress test run in docker
This commit is contained in:
@@ -63,21 +63,10 @@ class IceCypressTest {
|
||||
|
||||
clickSave(cy) {
|
||||
cy.get(`#${this.element}Form .saveBtn`).should("be.visible").click();
|
||||
cy.wait(config.WAIT_TIME);
|
||||
}
|
||||
|
||||
editElementValidate(cy, validation = [], editButtonSelector) {
|
||||
if (this.isRemoteTable) {
|
||||
cy.server().route('GET', `/${config.URL_PREFIX}/data.php*`).as('getAfterSave');
|
||||
} else {
|
||||
cy.server().route('POST', `/${config.URL_PREFIX}/service.php*`).as('getAfterSave');
|
||||
}
|
||||
|
||||
// Wait for data table response
|
||||
if (config.WAIT_ON_TIME) {
|
||||
cy.wait(config.WAIT_TIME);
|
||||
} else {
|
||||
cy.wait('@getAfterSave').its('status').should('be', config.DEFAULT_STATUS);
|
||||
}
|
||||
|
||||
cy.server().route('POST', `/${config.URL_PREFIX}/service.php*`).as('getElementAfterSave');
|
||||
// Click on edit and wait
|
||||
@@ -85,11 +74,7 @@ class IceCypressTest {
|
||||
.should("be.visible")
|
||||
.click();
|
||||
|
||||
if (config.WAIT_ON_TIME) {
|
||||
cy.wait(config.WAIT_TIME);
|
||||
} else {
|
||||
cy.wait('@getElementAfterSave').its('status').should('be', config.DEFAULT_STATUS);
|
||||
}
|
||||
cy.wait('@getElementAfterSave').its('status').should('be', config.DEFAULT_STATUS);
|
||||
|
||||
validation.forEach((item) => {
|
||||
cy.get(item[0]).then(element => expect(element.val()).eq(item[1]));
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
const IceCypressTest = require('../../commmon/ice-cypress-test');
|
||||
const config = require('../../support/config');
|
||||
|
||||
const test = new IceCypressTest(
|
||||
'g=admin&n=teams&m=admin_Employees',
|
||||
'TeamMembers',
|
||||
false,
|
||||
);
|
||||
|
||||
context('Admin Teams Module - Team Members Tab', () => {
|
||||
it('admin can view list', () => {
|
||||
cy.login('admin', 'admin');
|
||||
test.loadModule(cy);
|
||||
test.switchTab(cy);
|
||||
test.loadTable(cy, 2);
|
||||
});
|
||||
|
||||
it('admin can edit element', () => {
|
||||
cy.login('admin', 'admin');
|
||||
test.loadModule(cy);
|
||||
test.switchTab(cy);
|
||||
cy.get('#TeamMembers table tbody').find('tr').first().find('.center div img[data-original-title=\'Edit\']')
|
||||
.click();
|
||||
test.select2Click('team', 'beta');
|
||||
test.clickSave(cy);
|
||||
});
|
||||
|
||||
it('manager can view list', () => {
|
||||
cy.login('manager', config.DEFAULT_USER_PASS);
|
||||
test.loadModule(cy);
|
||||
test.switchTab(cy);
|
||||
test.loadTable(cy, 2);
|
||||
});
|
||||
|
||||
it('manager can edit element', () => {
|
||||
cy.login('manager', config.DEFAULT_USER_PASS);
|
||||
test.loadModule(cy);
|
||||
test.switchTab(cy);
|
||||
cy.get('#TeamMembers table tbody').find('tr').first().find('.center div img[data-original-title=\'Edit\']')
|
||||
.click();
|
||||
test.select2Click('team', 'beta');
|
||||
test.clickSave(cy);
|
||||
});
|
||||
});
|
||||
@@ -1,40 +0,0 @@
|
||||
const IceCypressTest = require('../../commmon/ice-cypress-test');
|
||||
const config = require('../../support/config');
|
||||
|
||||
const test = new IceCypressTest(
|
||||
'g=admin&n=teams&m=admin_Employees',
|
||||
'Teams',
|
||||
false,
|
||||
);
|
||||
|
||||
context('Admin Teams Module - Teams Tab', () => {
|
||||
it('admin can view list', () => {
|
||||
cy.login('admin', 'admin');
|
||||
test.loadModule(cy);
|
||||
test.loadTable(cy, 2);
|
||||
});
|
||||
|
||||
it('admin can edit element', () => {
|
||||
cy.login('admin', 'admin');
|
||||
test.loadModule(cy);
|
||||
test.editElement(cy, [['#description', 'creative designing team']]);
|
||||
test.select2Click('department', 'Head Office');
|
||||
test.clickSave(cy);
|
||||
test.editElementValidate(cy, [['#description', 'creative designing team']]);
|
||||
});
|
||||
|
||||
it('manager can view list', () => {
|
||||
cy.login('manager', config.DEFAULT_USER_PASS);
|
||||
test.loadModule(cy);
|
||||
test.loadTable(cy, 2);
|
||||
});
|
||||
|
||||
it('manager can edit element', () => {
|
||||
cy.login('manager', config.DEFAULT_USER_PASS);
|
||||
test.loadModule(cy);
|
||||
test.editElement(cy, [['#description', 'creative designing team']]);
|
||||
test.select2Click('department', 'Head Office');
|
||||
test.clickSave(cy);
|
||||
test.editElementValidate(cy, [['#description', 'creative designing team']]);
|
||||
});
|
||||
});
|
||||
@@ -1,11 +1,11 @@
|
||||
const BASE_URL = 'http://icehrm:8090/app/';
|
||||
const BASE_URL = 'http://icehrm-testing:8090/app/';
|
||||
//const BASE_URL = 'http://clients.icehrmpro.test/test/';
|
||||
|
||||
const DEFAULT_MAX_PAGE_SIZE = 15;
|
||||
const DEFAULT_STATUS = 200;
|
||||
const DEFAULT_USER_PASS = 'demouserpwd';
|
||||
const URL_PREFIX = 'app';
|
||||
const WAIT_ON_TIME = true;
|
||||
const WAIT_ON_TIME = false;
|
||||
const WAIT_TIME = 500;
|
||||
|
||||
module.exports = {
|
||||
|
||||
Reference in New Issue
Block a user