test(ncform-theme-elementui): complete tabs test cases

This commit is contained in:
daniel-dx
2019-03-17 00:11:33 +08:00
parent 7e3c27fd51
commit bdc16d9b2d
@@ -0,0 +1,88 @@
/// <reference types="Cypress" />
import common from './common';
context('Tabs', () => {
before(() => {
cy.visit('http://localhost:3004/examples/components/playground/index.html');
});
it('Simple Props', () => {
let formSchema = {
type: 'object',
properties: {
users1: {
type: 'array',
items: {
type: 'string'
},
ui: {
widget: 'array-tabs',
widgetConfig: {
collapsed: true,
addTxt: 'Add Item',
delAllTxt: 'Remove All'
}
}
},
users2: {
type: 'array',
value: [
'daniel', 'sarah'
],
items: {
type: 'string'
},
ui: {
widget: 'array-tabs',
widgetConfig: {
disableAdd: true,
disableDel: true,
disableCollapse: true,
}
}
}
}
};
cy.window()
.its('editor')
.invoke('setValue', JSON.stringify(formSchema, null, 2));
common.startRun();
cy.get('.previewArea').within(() => {
// Declare action elements
cy.get('legend')
.contains('users1')
.parent()
.within(() => {
cy.get('legend').next().should('not.be.visible');
cy.get('legend').click();
cy.get('legend').next().should('be.visible');
cy.get('.el-icon-plus').click()
cy.get('.el-tabs__item').its('length').should('equal', 2);
cy.get('input').eq(0).type('daniel')
cy.get('.el-tabs__item').eq(1).click();
cy.get('input').eq(1).type('sarah')
cy.get('.el-icon-close:visible').click();
cy.get('.el-tabs__item').its('length').should('equal', 1);
});
cy.get('legend')
.contains('users2')
.parent()
.within(() => {
cy.get('legend').next().should('be.visible');
cy.get('legend').click();
cy.get('legend').next().should('be.visible');
cy.get('.el-icon-plus').should('not.exist');
cy.get('.el-icon-close').should('not.exist');
});
// common.submitForm();
});
});
});