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

This commit is contained in:
daniel-dx
2019-03-16 23:18:48 +08:00
parent 9f44cc4c5f
commit b6ff4dc57e
2 changed files with 104 additions and 1 deletions
@@ -0,0 +1,103 @@
/// <reference types="Cypress" />
import common from './common';
context('Array', () => {
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: {
widgetConfig: {
collapsed: true,
itemCollapse: true,
addTxt: 'Add Item',
delAllTxt: 'Remove All'
}
}
},
users2: {
type: 'array',
value: [
'daniel', 'sarah'
],
items: {
type: 'string'
},
ui: {
widgetConfig: {
disableAdd: true,
disableDel: true,
disableReorder: true,
disableCollapse: true,
disableItemCollapse: 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('input').should('not.be.visible');
cy.get('button').find('.el-icon-arrow-up').click()
cy.get('input').should('be.visible');
cy.get('button').contains('Add Item').click();
cy.get('button').find('.el-icon-arrow-up:visible').click()
cy.get('input').its('length').should('equal', 2);
cy.get('input').eq(0).type('daniel')
cy.get('input').eq(1).type('sarah')
cy.get('.el-icon-sort-down:visible').click();
cy.get('input').eq(0).should('have.value', 'sarah')
cy.get('input').eq(1).should('have.value', 'daniel')
cy.get('.el-icon-remove').eq(0).click();
cy.get('input').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-arrow-up').should('not.exist');
cy.get('.el-icon-arrow-down').should('not.exist');
cy.get('.el-icon-sort-up').should('not.exist');
cy.get('.el-icon-sort-down').should('not.exist');
cy.get('button:contains("Add")').should('not.exist');
cy.get('button:contains("Delete All")').should('not.exist');
cy.get('.el-icon-remove').should('not.exist');
});
// common.submitForm();
});
});
});
@@ -77,7 +77,7 @@ context('Upload', () => {
});
});
it.only('Simple Props', () => {
it('Simple Props', () => {
cy.server();
cy.route({
method: 'POST',