tainacan/cypress/integration/repository/collection/field/field_selectbox_spec.js

486 lines
28 KiB
JavaScript
Raw Normal View History

2018-04-10 19:38:27 +00:00
describe('Selectbox field test', function() {
beforeEach(() => {
cy.loginByUI()
})
it('clear DB', function(){
cy.clearDB()
})
it('create collection for create fields', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-create-collection').click()
2018-04-10 19:38:27 +00:00
cy.get('#tainacan-text-name').type('Selectbox Fields')
cy.get('#tainacan-text-description').type('Description Selectbox Fields')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('#primary-menu > .menu > .menu-header > .menu-list > li > .router-link-active > .icon > .mdi').click()
2018-04-10 19:38:27 +00:00
cy.get('.b-table').should('contain', 'Selectbox Fields')
})
2018-04-10 19:38:27 +00:00
context('CRUD selectbox field', function(){
it('create reviewed field', function(){
2018-04-05 13:32:49 +00:00
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Reviewed')
cy.get('.textarea').type('description reviewed')
2018-04-05 13:32:49 +00:00
cy.get('#tainacan-select-status-publish > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('op1{enter}op2{enter}op3')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(2) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.handle > .field-name').should('contain', 'Reviewed')
2018-04-05 13:32:49 +00:00
})
2018-04-10 19:38:27 +00:00
it('check create reviewed field', function(){
2018-04-05 13:32:49 +00:00
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
2018-04-10 19:38:27 +00:00
cy.contains('Reviewed')
2018-04-05 13:32:49 +00:00
})
2018-04-10 19:38:27 +00:00
it('create edited field', function(){
2018-04-05 13:32:49 +00:00
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Edited')
cy.get('.textarea').type('description edited')
2018-04-05 13:32:49 +00:00
cy.get('#tainacan-select-status-publish > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('op1{enter}op2{enter}op3')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(2) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.handle > .field-name').should('contain', 'Edited')
2018-04-05 13:32:49 +00:00
})
2018-04-10 19:38:27 +00:00
it('check create edited field', function(){
2018-04-05 13:32:49 +00:00
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
2018-04-10 19:38:27 +00:00
cy.contains('Edited')
2018-04-05 13:32:49 +00:00
})
2018-04-10 19:38:27 +00:00
it('edit edited field', function(){
2018-04-05 13:32:49 +00:00
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get(':nth-child(4) > .handle > .controls > :nth-child(2) > .icon > .mdi').click()
2018-04-10 19:38:27 +00:00
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('Edited edited')
2018-04-05 13:32:49 +00:00
cy.get('.textarea').type(' edited')
cy.get('#tainacan-select-status-publish > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('op1{enter}op2{enter}op3')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(2) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.handle > .field-name').should('contain', 'Edited edited')
2018-04-05 13:32:49 +00:00
})
2018-04-10 19:38:27 +00:00
it('create itsCool field', function(){
2018-04-05 13:32:49 +00:00
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}itsCool')
cy.get('.textarea').type('description itsCool')
2018-04-05 13:32:49 +00:00
cy.get('#tainacan-select-status-publish > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('op1{enter}op2{enter}op3')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(2) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.handle > .field-name').should('contain', 'itsCool')
2018-04-05 13:32:49 +00:00
})
2018-04-10 19:38:27 +00:00
it('delete itsCool field', function(){
2018-04-05 13:32:49 +00:00
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
2018-04-10 19:38:27 +00:00
cy.contains('itsCool')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(5) > .handle > .controls > :nth-child(3) > .icon > .mdi').click()
2018-04-10 19:38:27 +00:00
cy.get('.handle > .field-name').should('not.eq', 'itsCool')
2018-04-05 13:32:49 +00:00
})
2018-04-10 19:38:27 +00:00
it('check not contain itsCool field', function(){
2018-04-05 13:32:49 +00:00
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
2018-04-10 19:38:27 +00:00
cy.get('.handle > .field-name').should('not.eq', 'itsCool')
2018-04-05 13:32:49 +00:00
})
})
2018-04-10 19:38:27 +00:00
context('Diseble selectbox field', function(){
it('create verified field', function(){
2018-04-05 13:32:49 +00:00
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Verified disebled')
cy.get('.textarea').type('description verified')
2018-04-05 13:32:49 +00:00
cy.get('#tainacan-select-status-publish > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('YES{enter}NO')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(2) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.active-fields-area >').should('contain', 'Verified disebled')
2018-04-05 13:32:49 +00:00
})
2018-04-10 19:38:27 +00:00
it('disebled verified field', function(){
2018-04-05 13:32:49 +00:00
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get(':nth-child(5) > .handle > .controls > .switch > .check').click()
cy.get('.active-fields-area > :nth-child(5)').should('have.class', 'disabled-field')
})
2018-04-10 19:38:27 +00:00
it('check disebled verified field', function(){
2018-04-05 13:32:49 +00:00
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area > :nth-child(5)').should('have.class', 'disabled-field')
})
})
2018-04-05 13:32:49 +00:00
context('Check required fields', function(){
it('create blank field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
2018-04-05 13:32:49 +00:00
cy.get('.not-focusable-item > .handle > .label-details').should('contain', 'Not saved')
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Bank{selectall}{del}')
cy.get('.textarea').clear()
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.not-focusable-item > .handle > .field-name').should('have.class', 'is-danger')
2018-04-10 19:38:27 +00:00
//cy.get('#fieldEditForm > :nth-child(1) > .control > .input').should('have.class', 'is-danger')
cy.get('.help').should('have.class', 'is-danger')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(1) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.active-fields-area > :nth-child(6) > .handle > .field-name').should('not.contain', 'Blank').and('contain', 'Selectbox')
2018-04-05 13:32:49 +00:00
cy.get('.active-fields-area > :nth-child(6) > .handle > .label-details').should('contain', 'Not saved')
})
it('check not contain blank field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area').should('not.contain', 'Blank')
})
})
2018-04-10 19:38:27 +00:00
context('Create selectbox field private', function(){
it('create selectbox private field', function(){
2018-04-05 13:32:49 +00:00
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox private')
2018-04-05 13:32:49 +00:00
cy.get('.textarea').type('description private')
cy.get('#tainacan-select-status-private > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('yes{enter}no')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(2) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.active-fields-area >').should('contain', 'Selectbox private')
2018-04-05 13:32:49 +00:00
})
it('check create selectbox private field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')})
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area > :nth-child(6) > .handle > .field-name').should('contain', 'Selectbox private')
cy.get(':nth-child(6) > .handle > .controls > :nth-child(2) > .icon > .mdi').click()
cy.get('#tainacan-select-status-private > .check').should('be.selected')
})
})
2018-04-05 13:32:49 +00:00
context('"Not saved" label vs. "cancel button"', function(){
2018-04-10 19:38:27 +00:00
it('create likes field', function(){
2018-04-05 13:32:49 +00:00
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Likes')
cy.get('.textarea').type('description likes')
2018-04-05 13:32:49 +00:00
cy.get('#tainacan-select-status-publish > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('yes{enter}no')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(2) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.active-fields-area >').should('contain', 'Likes')
2018-04-05 13:32:49 +00:00
})
it('check that Not Saved label wasnt inserted, and changes were lost', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
2018-04-10 19:38:27 +00:00
cy.get('.active-fields-area > :nth-child(7) > .handle > .field-name').should('contain', 'Likes')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(7) > .handle > .controls > :nth-child(2) > .icon > .mdi').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type(' edited')
cy.get('.textarea').type(' edited')
cy.get('#tainacan-select-status-private > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('dont')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(1) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.active-fields-area >').should('not.contain', 'Likes edited')
2018-04-05 13:32:49 +00:00
cy.get('.active-fields-area > :nth-child(7) > .handle > .label-details').should('not.contain', 'Not saved')
})
it('check if the message “Not Saved” appeared next to the field name', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox Type')
2018-04-05 13:32:49 +00:00
cy.get('.textarea').type('description new')
cy.get('#tainacan-select-status-publish > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('yes{enter}no')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(1) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.active-fields-area > :nth-child(8) > .handle > .field-name').should('not.eq', 'Selectbox Type').and('contain', 'Selectbox')
2018-04-05 13:32:49 +00:00
cy.get('.active-fields-area > :nth-child(8) > .handle > .label-details').should('contain', 'Not saved')
cy.get(':nth-child(8) > .handle > .controls > :nth-child(2) > .icon > .mdi').click()
2018-04-10 19:38:27 +00:00
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox Type')
cy.get('.autocomplete > .control > .input').type('yes{enter}no')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(2) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.active-fields-area > :nth-child(8) > .handle > .field-name').should('contain', 'Selectbox Type').and('not.eq', 'Selectbox')
2018-04-05 13:32:49 +00:00
cy.get('.active-fields-area > :nth-child(8) > .handle > .label-details').should('not.eq', 'Not saved')
})
})
2018-04-05 13:32:49 +00:00
context('Fields Sorting', function(){
})
2018-04-10 19:38:27 +00:00
context('create selectbox-types fields tests', function(){
it('canceled create selectbox field', function(){
2018-04-05 13:32:49 +00:00
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox name canceled')
2018-04-05 13:32:49 +00:00
cy.get('.textarea').type('description')
cy.get('#tainacan-select-status-publish > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('Y{enter}n')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(1) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.active-fields-area >').should('not.contain', 'Selectbox name canceled')
2018-04-05 13:32:49 +00:00
})
2018-04-10 19:38:27 +00:00
it('create selectbox-type field public required', function(){
2018-04-05 13:32:49 +00:00
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox name public required')
2018-04-05 13:32:49 +00:00
cy.get('.textarea').type('book description required')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .b-checkbox > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('Y{enter}n')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(2) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.active-fields-area >').should('contain', 'Selectbox name public required')
2018-04-05 13:32:49 +00:00
})
2018-04-10 19:38:27 +00:00
it('create selectbox-type field public multiple values', function(){
2018-04-05 13:32:49 +00:00
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox name public multiple values')
2018-04-05 13:32:49 +00:00
cy.get('.textarea').type('book description multiple values')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(3) > .b-checkbox > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('Y{enter}n')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(2) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.active-fields-area >').should('contain', 'Selectbox name public multiple values')
2018-04-05 13:32:49 +00:00
})
2018-04-10 19:38:27 +00:00
it('create selectbox-type field public unique values', function(){
2018-04-05 13:32:49 +00:00
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox name public unique values')
2018-04-05 13:32:49 +00:00
cy.get('.textarea').type('name book description multiple values')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(4) > .b-checkbox > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('y{enter}n')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(2) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.active-fields-area >').should('contain', 'Selectbox name public unique values')
2018-04-05 13:32:49 +00:00
})
})
context('Leave page without saving field editions', function(){
it('Leave page without saving field editions', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
2018-04-05 13:32:49 +00:00
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Not Saved')
cy.get('.textarea').type('description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.contains('Items').click()
cy.get('.modal-card').should('have.class', 'animation-content')
cy.get('.modal-card-foot > :nth-child(1)').click()
cy.get(':nth-child(1) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.active-fields-area >').should('not.contain', 'Not Saved').and('contain', 'Selectbox')
2018-04-05 13:32:49 +00:00
cy.get('.menu > :nth-child(2) > :nth-child(8) > a').click()
cy.get('.modal-card').should('have.class', 'is-titleless')
})
})
context('Field loading for paging and persistence testing', function(){
2018-04-10 19:38:27 +00:00
it('create selectbox fields', function(){
2018-04-05 13:32:49 +00:00
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)clearDB').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 1')
cy.get('.textarea').type('description selectbox')
2018-04-05 13:32:49 +00:00
cy.get('#tainacan-select-status-publish > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('y{enter}n')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(2) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 2')
cy.get('.textarea').type('description selectbox')
2018-04-05 13:32:49 +00:00
cy.get('#tainacan-select-status-publish > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('y{enter}n')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(2) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 3')
cy.get('.textarea').type('description selectbox')
2018-04-05 13:32:49 +00:00
cy.get('#tainacan-select-status-publish > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('y{enter}n')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(2) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 4')
cy.get('.textarea').type('description selectbox')
2018-04-05 13:32:49 +00:00
cy.get('#tainacan-select-status-publish > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('y{enter}n')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(2) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 5')
cy.get('.textarea').type('description selectbox')
2018-04-05 13:32:49 +00:00
cy.get('#tainacan-select-status-publish > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('y{enter}n')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(2) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 6')
cy.get('.textarea').type('description selectbox')
2018-04-05 13:32:49 +00:00
cy.get('#tainacan-select-status-publish > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('y{enter}n')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(2) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 7')
cy.get('.textarea').type('description selectbox')
2018-04-05 13:32:49 +00:00
cy.get('#tainacan-select-status-publish > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('y{enter}n')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(2) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 8')
cy.get('.textarea').type('description selectbox')
2018-04-05 13:32:49 +00:00
cy.get('#tainacan-select-status-publish > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('y{enter}n')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(2) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 9')
cy.get('.textarea').type('description selectbox')
2018-04-05 13:32:49 +00:00
cy.get('#tainacan-select-status-publish > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('y{enter}n')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(2) > .button').click()
2018-04-10 19:38:27 +00:00
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 10')
cy.get('.textarea').type('description selectbox')
2018-04-05 13:32:49 +00:00
cy.get('#tainacan-select-status-publish > .check').click()
2018-04-10 19:38:27 +00:00
cy.get('.autocomplete > .control > .input').type('y{enter}n')
2018-04-05 13:32:49 +00:00
cy.get(':nth-child(2) > .button').click()
})
it('check if fields are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
2018-04-05 13:32:49 +00:00
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
2018-04-10 19:38:27 +00:00
cy.get('.active-fields-area >').should('contain', 'Reviewed')
.and('contain', 'Edited edited')
.and('contain', 'Verified disabled')
.and('contain', 'Selectbox Private')
2018-04-05 13:32:49 +00:00
.and('not.contain', 'Blank')
2018-04-10 19:38:27 +00:00
.and('contain', 'Likes')
.and('contain', 'Selectbox Type')
.and('not.contain', 'Selectbox name canceled')
.and('contain', 'Selectbox name public required')
.and('contain', 'Selectbox name public multiple values')
.and('contain', 'Selectbox name public unique values')
.and('contain', 'Selectbox 1')
.and('contain', 'Selectbox 2')
.and('contain', 'Selectbox 3')
.and('contain', 'Selectbox 4')
.and('contain', 'Selectbox 5')
.and('contain', 'Selectbox 6')
.and('contain', 'Selectbox 7')
.and('contain', 'Selectbox 8')
.and('contain', 'Selectbox 9')
.and('contain', 'Selectbox 10')
2018-04-05 13:32:49 +00:00
})
})
})