Merge remote-tracking branch 'origin/develop' into exposers

This commit is contained in:
Jacson Passold 2018-03-28 20:42:58 -03:00
commit 39331653f1
30 changed files with 1540 additions and 885 deletions

View File

@ -12,15 +12,15 @@ current_OS=`uname`
# For macOS (Darwin)
if [ $current_OS == "Darwin" ]; then
find src -type f \( -name "*.js" -or -name "*.vue" \) -exec md5 {} \; | sort -k 2 | md5 > last-js-build.md5
find src -type f \( -name "*.scss" \) -exec md5 {} \; | sort -k 2 | md5 > last-sass-build.md5
find src -type f \( -name "composer.json" \) -exec md5 {} \; | sort -k 2 | md5 > last-composer-build.md5
find src -type f \( -name "package.json" -or -name "package-lock.json" \) -exec md5 {} \; | sort -k 2 | md5 > last-package-build.md5
find src ./webpack.config.js -type f \( -name "*.js" -or -name "*.vue" -or -name "webpack.config.js" \) -exec md5 {} \; | sort -k 2 | md5 > last-js-build.md5
find ./src/scss/ ./src/admin/scss/ -type f \( -name "*.scss" \) -exec md5 {} \; | sort -k 2 | md5 > last-sass-build.md5
find ./composer.json -type f \( -name "composer.json" \) -exec md5 {} \; | sort -k 2 | md5 > last-composer-build.md5
find ./package.json -type f \( -name "package.json" -or -name "package-lock.json" \) -exec md5 {} \; | sort -k 2 | md5 > last-package-build.md5
else
find src -type f \( -name "*.js" -or -name "*.vue" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-js-build.md5
find src -type f \( -name "*.scss" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-sass-build.md5
find src -type f \( -name "composer.json" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-composer-build.md5
find src -type f \( -name "package.json" -or -name "package-lock.json" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-package-build.md5
find src ./webpack.config.js -type f \( -name "*.js" -or -name "*.vue" -or -name "webpack.config.js" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-js-build.md5
find ./src/scss/ ./src/admin/scss/ -type f \( -name "*.scss" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-sass-build.md5
find ./composer.json -type f \( -name "composer.json" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-composer-build.md5
find ./package.json -type f \( -name "package.json" -or -name "package-lock.json" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-package-build.md5
fi
new_md5_package=$(<last-package-build.md5)

View File

@ -1,791 +0,0 @@
describe('Fields text 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.get('h1').should('contain', 'Collections Page')
cy.contains('New Collection').click()
cy.get('#tainacan-text-name').type('Book Fields')
cy.get('#tainacan-text-description').type('Descrição book 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()
cy.get('.b-table').should('contain', 'Book Fields')
})
context('create text-type fields', function(){
it('canceled create text field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('Text name canceled')
cy.get('.textarea').type('name book canceled description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(1) > .button').click()
cy.get('.active-fields-area >').should('not.contain', 'Text name canceled')
})
it('create text field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('Text name public')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Text name public')
})
it('create text field private', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('Text name private')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-private > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Text name private')
})
it('create text field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('Text name public required')
cy.get('.textarea').type('name book description required')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Text name public required')
})
it('create text field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('Text name public multiple values')
cy.get('.textarea').type('name book description multiple values')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(3) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Text name public multiple values')
})
it('create text field public unique values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('Text name public unique values')
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()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Text name public unique values')
})
it('check if fields are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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', 'Text name canceled')
cy.get('.active-fields-area >').should('contain', 'Text name public')
cy.get('.active-fields-area >').should('contain', 'Text name private')
cy.get('.active-fields-area >').should('contain', 'Text name public required')
cy.get('.active-fields-area >').should('contain', 'Text name public multiple values')
cy.get('.active-fields-area >').should('contain', 'Text name public unique values')
})
})
context('delete text-type fields', function(){
it('delete fields created texts', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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(3) > .handle > .controls > :nth-child(3) > .icon > .mdi').click()
cy.get(':nth-child(4) > .handle > .controls > :nth-child(3) > .icon > .mdi').click()
cy.get(':nth-child(5) > .handle > .controls > :nth-child(3) > .icon > .mdi').click()
cy.get(':nth-child(6) > .handle > .controls > :nth-child(3) > .icon > .mdi').click()
cy.get(':nth-child(7) > .handle > .controls > :nth-child(3) > .icon > .mdi').click()
})
})
context('create textArea-type fields', function(){
it('canceled create textArea field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('TextArea name canceled')
cy.get('.textarea').type('name book canceled description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(1) > .button').click()
cy.get('.active-fields-area >').should('not.contain', 'TextArea name canceled')
})
it('create textArea field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('TextArea name public')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'TextArea name public')
})
it('create textArea field private', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('TextArea name private')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-private > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'TextArea name private')
})
it('create textArea field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('TextArea name public required')
cy.get('.textarea').type('name book description required')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'TextArea name public required')
})
it('create textArea field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('TextArea name public multiple values')
cy.get('.textarea').type('name book description multiple values')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(3) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'TextArea name public multiple values')
})
it('create textArea field public unique values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('TextArea name public unique values')
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()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'TextArea name public unique values')
})
it('check if fields are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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', 'Text name canceled')
cy.get('.active-fields-area >').should('contain', 'TextArea name public')
cy.get('.active-fields-area >').should('contain', 'TextArea name private')
cy.get('.active-fields-area >').should('contain', 'TextArea name public required')
cy.get('.active-fields-area >').should('contain', 'TextArea name public multiple values')
cy.get('.active-fields-area >').should('contain', 'TextArea name public unique values')
})
})
context('delete textArea-type fields', function(){
it('delete fields created texts', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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(3) > .handle > .controls > :nth-child(3) > .icon > .mdi').click()
cy.get(':nth-child(4) > .handle > .controls > :nth-child(3) > .icon > .mdi').click()
cy.get(':nth-child(5) > .handle > .controls > :nth-child(3) > .icon > .mdi').click()
cy.get(':nth-child(6) > .handle > .controls > :nth-child(3) > .icon > .mdi').click()
cy.get(':nth-child(7) > .handle > .controls > :nth-child(3) > .icon > .mdi').click()
})
})
context('create date-type fields', function(){
it('canceled create date field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('date name canceled')
cy.get('.textarea').type('name book canceled description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(1) > .button').click()
cy.get('.active-fields-area >').should('not.contain', 'date name canceled')
})
it('create date field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('date name public')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'date name public')
})
it('create date field private', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('date name private')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-private > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'date name private')
})
it('create date field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('date name public required')
cy.get('.textarea').type('name book description required')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'date name public required')
})
it('create date field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('date name public multiple values')
cy.get('.textarea').type('name book description multiple values')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(3) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'date name public multiple values')
})
it('create date field public unique values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('date name public unique values')
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()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'date name public unique values')
})
it('check if fields are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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', 'Text name canceled')
cy.get('.active-fields-area >').should('contain', 'date name public')
cy.get('.active-fields-area >').should('contain', 'date name private')
cy.get('.active-fields-area >').should('contain', 'date name public required')
cy.get('.active-fields-area >').should('contain', 'date name public multiple values')
cy.get('.active-fields-area >').should('contain', 'date name public unique values')
})
})
context('create numeric-type fields', function(){
it('canceled create date field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('numeric name canceled')
cy.get('.textarea').type('name book canceled description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(1) > .button').click()
cy.get('.active-fields-area >').should('not.contain', 'numeric name canceled')
})
it('create numeric field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('numeric name public')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'numeric name public')
})
it('create numeric field private', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('numeric name private')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-private > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'numeric name private')
})
it('create numeric field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('numeric name public required')
cy.get('.textarea').type('name book description required')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'numeric name public required')
})
it('create numeric field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('numeric name public multiple values')
cy.get('.textarea').type('name book description multiple values')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(3) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'numeric name public multiple values')
})
it('create numeric field public unique values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('numeric name public unique values')
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()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'numeric name public unique values')
})
it('check if fields are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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', 'Text name canceled')
cy.get('.active-fields-area >').should('contain', 'numeric name public')
cy.get('.active-fields-area >').should('contain', 'numeric name private')
cy.get('.active-fields-area >').should('contain', 'numeric name public required')
cy.get('.active-fields-area >').should('contain', 'numeric name public multiple values')
cy.get('.active-fields-area >').should('contain', 'numeric name public unique values')
})
})
context('create select-type fields', function(){
it('canceled create select field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('select name canceled')
cy.get('.textarea').type('name book canceled description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(1) > .button').click()
cy.get('.active-fields-area >').should('not.contain', 'select name canceled')
})
it('create select field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('select name public')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('.autocomplete > .control > .input').type('select1{enter}')
cy.get('.autocomplete > .control > .input').type('select2{enter}')
cy.get('.autocomplete > .control > .input').type('select3{enter}')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'select name public')
})
it('create select field private', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('select name private')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-private > .check').click()
cy.get('.autocomplete > .control > .input').type('select1{enter}')
cy.get('.autocomplete > .control > .input').type('select2{enter}')
cy.get('.autocomplete > .control > .input').type('select3{enter}')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'select name private')
})
it('create select field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('select name public required')
cy.get('.textarea').type('name book description required')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .b-checkbox > .check').click()
cy.get('.autocomplete > .control > .input').type('select1{enter}')
cy.get('.autocomplete > .control > .input').type('select2{enter}')
cy.get('.autocomplete > .control > .input').type('select3{enter}')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'select name public required')
})
it('create select field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('select name public multiple values')
cy.get('.textarea').type('name book description multiple values')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(3) > .b-checkbox > .check').click()
cy.get('.autocomplete > .control > .input').type('select1{enter}')
cy.get('.autocomplete > .control > .input').type('select2{enter}')
cy.get('.autocomplete > .control > .input').type('select3{enter}')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'select name public multiple values')
})
it('create select field public unique values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('select name public unique values')
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()
cy.get('.autocomplete > .control > .input').type('select1{enter}')
cy.get('.autocomplete > .control > .input').type('select2{enter}')
cy.get('.autocomplete > .control > .input').type('select3{enter}')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'select name public unique values')
})
it('check if fields are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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', 'Text name canceled')
cy.get('.active-fields-area >').should('contain', 'select name public')
cy.get('.active-fields-area >').should('contain', 'select name private')
cy.get('.active-fields-area >').should('contain', 'select name public required')
cy.get('.active-fields-area >').should('contain', 'select name public multiple values')
cy.get('.active-fields-area >').should('contain', 'select name public unique values')
})
})
context('create relationship-type fields', function(){
it('create collection for create relationship', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.contains('New Collection').click()
cy.get('#tainacan-text-name').type('Book relationship')
cy.get('#tainacan-text-description').type('Descrição book relationship')
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()
cy.get('.b-table').should('contain', 'Book relationship')
})
it('canceled create select field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get(':nth-child(2) > [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('.field > :nth-child(2) > :nth-child(6)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('relationship name canceled')
cy.get('.textarea').type('name book canceled description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(1) > .button').click()
cy.get('.active-fields-area >').should('not.contain', 'relationship name canceled')
})
it('create relationship field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get(':nth-child(2) > [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('.field > :nth-child(2) > :nth-child(6)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('relationship name public')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('select').select('Book relationship')
cy.get(':nth-child(1) > .b-checkbox > .check').click()
cy.get('.block > :nth-child(2) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'relationship name public')
})
it('create relationship field private', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get(':nth-child(2) > [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('.field > :nth-child(2) > :nth-child(6)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('relationship name private')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-private > .check').click()
cy.get('select').select('Book relationship')
cy.get(':nth-child(1) > .b-checkbox > .check').click()
cy.get('.block > :nth-child(2) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'relationship name private')
})
it('create relationship field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get(':nth-child(2) > [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('.field > :nth-child(2) > :nth-child(6)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('relationship name public required')
cy.get('.textarea').type('name book description required')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .b-checkbox > .check').click()
cy.get('select').select('Book relationship')
cy.get(':nth-child(1) > .b-checkbox > .check').click()
cy.get('.block > :nth-child(2) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'relationship name public required')
})
it('create relationship field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get(':nth-child(2) > [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('.field > :nth-child(2) > :nth-child(6)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('relationship name public multiple values')
cy.get('.textarea').type('name book description multiple values')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(3) > .b-checkbox > .check').click()
cy.get('select').select('Book relationship')
cy.get(':nth-child(1) > .b-checkbox > .check').click()
cy.get('.block > :nth-child(2) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'relationship name public multiple values')
})
it('create relationship field public unique values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get(':nth-child(2) > [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('.field > :nth-child(2) > :nth-child(6)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('relationship name public unique values')
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()
cy.get('select').select('Book relationship')
cy.get(':nth-child(1) > .b-checkbox > .check').click()
cy.get('.block > :nth-child(2) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'relationship name public unique values')
})
it('check if fields are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get(':nth-child(2) > [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', 'Text name canceled')
cy.get('.active-fields-area >').should('contain', 'relationship name public')
cy.get('.active-fields-area >').should('contain', 'relationship name private')
cy.get('.active-fields-area >').should('contain', 'relationship name public required')
cy.get('.active-fields-area >').should('contain', 'relationship name public multiple values')
cy.get('.active-fields-area >').should('contain', 'relationship name public unique values')
})
})
})

View File

@ -0,0 +1,201 @@
context('create category-type fields tests', 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.get('h1').should('contain', 'Collections Page')
cy.contains('New Collection').click()
cy.get('#tainacan-text-name').type('Book Fields')
cy.get('#tainacan-text-description').type('Descrição book 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()
cy.get('.b-table').should('contain', 'Book Fields')
})
it('create taxonomies for create relationship', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get(':nth-child(8) > a > .menu-text').click()
cy.get('.button').click()
cy.get('#tainacan-text-name').type('Cat 1')
cy.get('#tainacan-text-description').type('description cat 1')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-category-creation').click()
cy.get('.page-container').should('contain', 'Cat 1')
cy.get('.button').click()
cy.get('#tainacan-text-name').type('Cat 2')
cy.get('#tainacan-text-description').type('description cat 2')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-category-creation').click()
cy.get('.page-container').should('contain', 'Cat 2')
cy.get('.button').click()
cy.get('#tainacan-text-name').type('Cat 3')
cy.get('#tainacan-text-description').type('description cat 3')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-category-creation').click()
cy.get('.page-container').should('contain', 'Cat 3')
cy.get('.button').click()
cy.get('#tainacan-text-name').type('Cat 4')
cy.get('#tainacan-text-description').type('description cat 4')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-category-creation').click()
cy.get('.page-container').should('contain', 'Cat 4')
cy.get('.button').click()
cy.get('#tainacan-text-name').type('Cat 5')
cy.get('#tainacan-text-description').type('description cat 5')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-category-creation').click()
cy.get('.page-container').should('contain', 'Cat 5')
cy.get('#tainacan-text-name').type('Cat 6')
cy.get('#tainacan-text-description').type('description cat 6')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-category-creation').click()
cy.get('.page-container').should('contain', 'Cat 6')
})
it('canceled create category-type field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(7)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('category name canceled')
cy.get('.textarea').type('name book canceled description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(1) > .button').click()
cy.get('.active-fields-area >').should('not.contain', 'category name canceled')
})
it('create category-type field public - input type = radio', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(7)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('category name public')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(1) > .control > .select > select').select('Cat 1')
cy.get(':nth-child(2) > .control > .select > select').select('Radio').should('have.value', 'tainacan-category-radio')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'category name public')
})
it('create category-type field public - input type = selectbox', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(7)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('category name public')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(1) > .control > .select > select').select('Cat 1')
cy.get(':nth-child(2) > .control > .select > select').select('Selectbox').should('have.value', 'tainacan-category-selectbox')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'category name public')
})
it('create category-type field private', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(7)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('category name private')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-private > .check').click()
cy.get(':nth-child(1) > .control > .select > select').select('Cat 2')
cy.get(':nth-child(2) > .control > .select > select').select('Radio').should('have.value', 'tainacan-category-radio')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'category name private')
})
it('create category-type field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(7)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('category name public required')
cy.get('.textarea').type('name book description required')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(1) > .control > .select > select').select('Cat 3')
cy.get(':nth-child(2) > .control > .select > select').select('Radio').should('have.value', 'tainacan-category-radio')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'category name public required')
})
it('create category-type field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(7)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('category name public multiple values')
cy.get('.textarea').type('name book description multiple values')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(1) > .control > .select > select').select('Cat 4')
cy.get(':nth-child(2) > .control > .select > select').select('Radio').should('have.value', 'tainacan-category-radio')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'category name public multiple values')
})
it('create category-type field public unique values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(7)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('category name public unique values')
cy.get('.textarea').type('name book description multiple values')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(1) > .control > .select > select').select('Cat 5')
cy.get(':nth-child(2) > .control > .select > select').select('Radio').should('have.value', 'tainacan-category-radio')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'category name public unique values')
})
it('check if fields are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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(7) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area >').should('not.contain', 'category name canceled')
cy.get('.active-fields-area >').should('contain', 'category name public')
cy.get('.active-fields-area >').should('contain', 'category name private')
cy.get('.active-fields-area >').should('contain', 'category name public required')
cy.get('.active-fields-area >').should('contain', 'category name public multiple values')
cy.get('.active-fields-area >').should('contain', 'category name public unique values')
})
})

View File

@ -0,0 +1,135 @@
context('create date-type fields tests', 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.get('h1').should('contain', 'Collections Page')
cy.contains('New Collection').click()
cy.get('#tainacan-text-name').type('Book Fields')
cy.get('#tainacan-text-description').type('Descrição book 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()
cy.get('.b-table').should('contain', 'Book Fields')
})
it('canceled create date field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('date name canceled')
cy.get('.textarea').type('name book canceled description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(1) > .button').click()
cy.get('.active-fields-area >').should('not.contain', 'date name canceled')
})
it('create date-type field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('date name public')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'date name public')
})
it('create date-type field private', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('date name private')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-private > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'date name private')
})
it('create date-type field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('date name public required')
cy.get('.textarea').type('name book description required')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'date name public required')
})
it('create date-type field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('date name public multiple values')
cy.get('.textarea').type('name book description multiple values')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(3) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'date name public multiple values')
})
it('create date-type field public unique values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('date name public unique values')
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()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'date name public unique values')
})
it('check if fields are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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', 'date name canceled')
cy.get('.active-fields-area >').should('contain', 'date name public')
cy.get('.active-fields-area >').should('contain', 'date name private')
cy.get('.active-fields-area >').should('contain', 'date name public required')
cy.get('.active-fields-area >').should('contain', 'date name public multiple values')
cy.get('.active-fields-area >').should('contain', 'date name public unique values')
})
})

View File

@ -0,0 +1,135 @@
context('create numeric-type fields tests', 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.get('h1').should('contain', 'Collections Page')
cy.contains('New Collection').click()
cy.get('#tainacan-text-name').type('Book Fields')
cy.get('#tainacan-text-description').type('Descrição book 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()
cy.get('.b-table').should('contain', 'Book Fields')
})
it('canceled create date field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('numeric name canceled')
cy.get('.textarea').type('name book canceled description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(1) > .button').click()
cy.get('.active-fields-area >').should('not.contain', 'numeric name canceled')
})
it('create numeric-type field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('numeric name public')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'numeric name public')
})
it('create numeric-type field private', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('numeric name private')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-private > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'numeric name private')
})
it('create numeric-type field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('numeric name public required')
cy.get('.textarea').type('name book description required')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'numeric name public required')
})
it('create numeric-type field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('numeric name public multiple values')
cy.get('.textarea').type('name book description multiple values')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(3) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'numeric name public multiple values')
})
it('create numeric-type field public unique values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('numeric name public unique values')
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()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'numeric name public unique values')
})
it('check if fields are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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', 'numeric name canceled')
cy.get('.active-fields-area >').should('contain', 'numeric name public')
cy.get('.active-fields-area >').should('contain', 'numeric name private')
cy.get('.active-fields-area >').should('contain', 'numeric name public required')
cy.get('.active-fields-area >').should('contain', 'numeric name public multiple values')
cy.get('.active-fields-area >').should('contain', 'numeric name public unique values')
})
})

View File

@ -0,0 +1,162 @@
context('create relationship-type fields tests', 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.get('h1').should('contain', 'Collections Page')
cy.contains('New Collection').click()
cy.get('#tainacan-text-name').type('Book Fields')
cy.get('#tainacan-text-description').type('Descrição book 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()
cy.get('.b-table').should('contain', 'Book Fields')
})
it('create collection for create relationship', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.contains('New Collection').click()
cy.get('#tainacan-text-name').type('Book relationship')
cy.get('#tainacan-text-description').type('Descrição book relationship')
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()
cy.get('.b-table').should('contain', 'Book relationship')
})
it('canceled create relationship-type field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get(':nth-child(2) > [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('.field > :nth-child(2) > :nth-child(6)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('relationship name canceled')
cy.get('.textarea').type('name book canceled description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(1) > .button').click()
cy.get('.active-fields-area >').should('not.contain', 'relationship name canceled')
})
it('create relationship-type field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get(':nth-child(2) > [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('.field > :nth-child(2) > :nth-child(6)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('relationship name public')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('select').select('Book relationship')
cy.get(':nth-child(1) > .b-checkbox > .check').click()
cy.get('.block > :nth-child(2) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'relationship name public')
})
it('create relationship-type field private', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get(':nth-child(2) > [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('.field > :nth-child(2) > :nth-child(6)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('relationship name private')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-private > .check').click()
cy.get('select').select('Book relationship')
cy.get(':nth-child(1) > .b-checkbox > .check').click()
cy.get('.block > :nth-child(2) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'relationship name private')
})
it('create relationship-type field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get(':nth-child(2) > [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('.field > :nth-child(2) > :nth-child(6)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('relationship name public required')
cy.get('.textarea').type('name book description required')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .b-checkbox > .check').click()
cy.get('select').select('Book relationship')
cy.get(':nth-child(1) > .b-checkbox > .check').click()
cy.get('.block > :nth-child(2) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'relationship name public required')
})
it('create relationship-type field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get(':nth-child(2) > [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('.field > :nth-child(2) > :nth-child(6)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('relationship name public multiple values')
cy.get('.textarea').type('name book description multiple values')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(3) > .b-checkbox > .check').click()
cy.get('select').select('Book relationship')
cy.get(':nth-child(1) > .b-checkbox > .check').click()
cy.get('.block > :nth-child(2) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'relationship name public multiple values')
})
it('create relationship-type field public unique values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get(':nth-child(2) > [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('.field > :nth-child(2) > :nth-child(6)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('relationship name public unique values')
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()
cy.get('select').select('Book relationship')
cy.get(':nth-child(1) > .b-checkbox > .check').click()
cy.get('.block > :nth-child(2) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'relationship name public unique values')
})
it('check if fields are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get(':nth-child(2) > [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', 'relationship name canceled')
cy.get('.active-fields-area >').should('contain', 'relationship name public')
cy.get('.active-fields-area >').should('contain', 'relationship name private')
cy.get('.active-fields-area >').should('contain', 'relationship name public required')
cy.get('.active-fields-area >').should('contain', 'relationship name public multiple values')
cy.get('.active-fields-area >').should('contain', 'relationship name public unique values')
})
})

View File

@ -0,0 +1,150 @@
context('create select-type fields tests', 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.get('h1').should('contain', 'Collections Page')
cy.contains('New Collection').click()
cy.get('#tainacan-text-name').type('Book Fields')
cy.get('#tainacan-text-description').type('Descrição book 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()
cy.get('.b-table').should('contain', 'Book Fields')
})
it('canceled create select field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('select name canceled')
cy.get('.textarea').type('name book canceled description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(1) > .button').click()
cy.get('.active-fields-area >').should('not.contain', 'select name canceled')
})
it('create select-type field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('select name public')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('.autocomplete > .control > .input').type('select1{enter}')
cy.get('.autocomplete > .control > .input').type('select2{enter}')
cy.get('.autocomplete > .control > .input').type('select3{enter}')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'select name public')
})
it('create select-type field private', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('select name private')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-private > .check').click()
cy.get('.autocomplete > .control > .input').type('select1{enter}')
cy.get('.autocomplete > .control > .input').type('select2{enter}')
cy.get('.autocomplete > .control > .input').type('select3{enter}')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'select name private')
})
it('create select-type field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('select name public required')
cy.get('.textarea').type('name book description required')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .b-checkbox > .check').click()
cy.get('.autocomplete > .control > .input').type('select1{enter}')
cy.get('.autocomplete > .control > .input').type('select2{enter}')
cy.get('.autocomplete > .control > .input').type('select3{enter}')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'select name public required')
})
it('create select-type field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('select name public multiple values')
cy.get('.textarea').type('name book description multiple values')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(3) > .b-checkbox > .check').click()
cy.get('.autocomplete > .control > .input').type('select1{enter}')
cy.get('.autocomplete > .control > .input').type('select2{enter}')
cy.get('.autocomplete > .control > .input').type('select3{enter}')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'select name public multiple values')
})
it('create select-type field public unique values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('select name public unique values')
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()
cy.get('.autocomplete > .control > .input').type('select1{enter}')
cy.get('.autocomplete > .control > .input').type('select2{enter}')
cy.get('.autocomplete > .control > .input').type('select3{enter}')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'select name public unique values')
})
it('check if fields are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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', 'select name canceled')
cy.get('.active-fields-area >').should('contain', 'select name public')
cy.get('.active-fields-area >').should('contain', 'select name private')
cy.get('.active-fields-area >').should('contain', 'select name public required')
cy.get('.active-fields-area >').should('contain', 'select name public multiple values')
cy.get('.active-fields-area >').should('contain', 'select name public unique values')
})
})

View File

@ -0,0 +1,135 @@
context('create textArea-type fields tests', 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.get('h1').should('contain', 'Collections Page')
cy.contains('New Collection').click()
cy.get('#tainacan-text-name').type('Book Fields')
cy.get('#tainacan-text-description').type('Descrição book 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()
cy.get('.b-table').should('contain', 'Book Fields')
})
it('canceled create textArea field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('TextArea name canceled')
cy.get('.textarea').type('name book canceled description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(1) > .button').click()
cy.get('.active-fields-area >').should('not.contain', 'TextArea name canceled')
})
it('create textArea-type field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('TextArea name public')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'TextArea name public')
})
it('create textArea-type field private', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('TextArea name private')
cy.get('.textarea').type('name book description')
cy.get('#tainacan-select-status-private > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'TextArea name private')
})
it('create textArea-type field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('TextArea name public required')
cy.get('.textarea').type('name book description required')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'TextArea name public required')
})
it('create textArea-type field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('TextArea name public multiple values')
cy.get('.textarea').type('name book description multiple values')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(3) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'TextArea name public multiple values')
})
it('create textArea-type field public unique values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('TextArea name public unique values')
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()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'TextArea name public unique values')
})
it('check if fields are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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', 'TextArea name canceled')
cy.get('.active-fields-area >').should('contain', 'TextArea name public')
cy.get('.active-fields-area >').should('contain', 'TextArea name private')
cy.get('.active-fields-area >').should('contain', 'TextArea name public required')
cy.get('.active-fields-area >').should('contain', 'TextArea name public multiple values')
cy.get('.active-fields-area >').should('contain', 'TextArea name public unique values')
})
})

View File

@ -0,0 +1,478 @@
describe('Text 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.get('h1').should('contain', 'Collections Page')
cy.contains('New Collection').click()
cy.get('#tainacan-text-name').type('Book Text Fields')
cy.get('#tainacan-text-description').type('Descrição book 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()
cy.get('.b-table').should('contain', 'Book Text Fields')
})
context('CRUD text field', function(){
it('create actor field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Actor')
cy.get('.textarea').type('description actor')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Actor')
})
it('check create actor field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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.contains('Actor')
})
it('create location field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Location')
cy.get('.textarea').type('description location')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Location')
})
it('check create location field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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.contains('Location')
})
it('edit location field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type(' edited')
cy.get('.textarea').type(' edited')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Location edited')
})
it('create denomination field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Denomination')
cy.get('.textarea').type('description denomination')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Denomination')
})
it('delete denomination field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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.contains('Denomination')
cy.get(':nth-child(5) > .handle > .controls > :nth-child(3) > .icon > .mdi').click()
cy.get('.handle > .field-name').should('not.contain', 'Denomination')
})
it('check not contain denomination field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.handle > .field-name').should('not.contain', 'Denomination')
})
})
context('Diseble text field', function(){
it('create record field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Record')
cy.get('.textarea').type('description record')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Record')
})
it('disebled record field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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')
})
it('check disebled record field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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')
})
})
context('Check required fields', function(){
it('create blank field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(1)').click()
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')
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').should('have.class', 'is-danger')
cy.get(':nth-child(1) > .button').click()
cy.get('.active-fields-area > :nth-child(6) > .handle > .field-name').should('not.contain', 'Blank').and('contain', 'Text')
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.get('h1').should('contain', 'Collections Page')
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')
})
})
context('Create text field private', function(){
it('create private field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Private')
cy.get('.textarea').type('description private')
cy.get('#tainacan-select-status-private > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Private')
})
it('check create private field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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', 'Private')
cy.get(':nth-child(6) > .handle > .controls > :nth-child(2) > .icon > .mdi').click()
cy.get('#tainacan-select-status-private > .check').should('be.selected')
})
})
context('"Not saved" label vs. "cancel button"', function(){
it('create denomination field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Denomination')
cy.get('.textarea').type('description private')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Denomination')
})
it('check that Not Saved label wasnt inserted, and changes were lost', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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(7) > .handle > .field-name').should('contain', 'Denomination')
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()
cy.get(':nth-child(1) > .button').click()
cy.get('.active-fields-area >').should('not.contain', 'Denomination edited')
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.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Record Type')
cy.get('.textarea').type('description new')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(1) > .button').click()
cy.get('.active-fields-area > :nth-child(8) > .handle > .field-name').should('not.contain', 'Record Type').and('contain', 'Text')
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()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Record Type')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area > :nth-child(8) > .handle > .field-name').should('contain', 'Record Type').and('not.contain', 'Text')
cy.get('.active-fields-area > :nth-child(8) > .handle > .label-details').should('not.contain', 'Not saved')
})
})
context('Fields Sorting', function(){
})
context('create text-type fields tests', function(){
it('canceled create text field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text name canceled')
cy.get('.textarea').type('description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(1) > .button').click()
cy.get('.active-fields-area >').should('not.contain', 'Text name canceled')
})
it('create text-type field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text name public required')
cy.get('.textarea').type('book description required')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .b-checkbox > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Text name public required')
})
it('create text-type field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text name public multiple values')
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()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Text name public multiple values')
})
it('create text-type field public unique values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text name public unique values')
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()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Text name public unique values')
})
})
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.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(1)').click()
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()
cy.get('.active-fields-area >').should('not.contain', 'Not Saved').and('contain', 'Text')
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(){
it('create texts fields', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text 1')
cy.get('.textarea').type('description text')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.wait(500)
cy.get('[draggable="false"]').click()
//cy.get('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text 2')
cy.get('.textarea').type('description text')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.wait(500)
cy.get('[draggable="false"]').click()
//cy.get('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text 3')
cy.get('.textarea').type('description text')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.wait(500)
cy.get('[draggable="false"]').click()
//cy.get('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text 4')
cy.get('.textarea').type('description text')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.wait(500)
cy.get('[draggable="false"]').click()
//cy.get('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text 5')
cy.get('.textarea').type('description text')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.wait(500)
cy.get('[draggable="false"]').click()
//cy.get('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text 6')
cy.get('.textarea').type('description text')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.wait(500)
cy.get('[draggable="false"]').click()
//cy.get('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text 7')
cy.get('.textarea').type('description text')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.wait(500)
cy.get('[draggable="false"]').click()
//cy.get('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text 8')
cy.get('.textarea').type('description text')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.wait(500)
cy.get('[draggable="false"]').click()
//cy.get('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text 9')
cy.get('.textarea').type('description text')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.wait(500)
cy.get('[draggable="false"]').click()
//cy.get('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text 10')
cy.get('.textarea').type('description text')
cy.get('#tainacan-select-status-publish > .check').click()
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.get('h1').should('contain', 'Collections Page')
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('contain', 'Actor')
.and('contain', 'Location edited')
.and('contain', 'Record')
.and('contain', 'Private')
.and('not.contain', 'Blank')
.and('contain', 'Denomination')
.and('contain', 'Record Type')
.and('not.contain', 'Text name canceled')
.and('contain', 'Text name public required')
.and('contain', 'Text name public multiple values')
.and('contain', 'Text name public unique values')
.and('contain', 'Text 1')
.and('contain', 'Text 2')
.and('contain', 'Text 3')
.and('contain', 'Text 4')
.and('contain', 'Text 5')
.and('contain', 'Text 6')
.and('contain', 'Text 7')
.and('contain', 'Text 8')
.and('contain', 'Text 9')
.and('contain', 'Text 10')
})
})
})

View File

@ -82,5 +82,11 @@ Cypress.Commands.add('loginByUI', () => {
})
Cypress.Commands.add('clearDB', () => {
cy.contains('WPress').click()
cy.get('#default-api-namespace').clear()
cy.get('#default-api-namespace').type('tainacan/v2')
cy.get('#default-db-prefix').clear()
cy.get('#default-db-prefix').type('wptests_')
cy.get('#submit').click()
cy.request('POST', '/wp-json/tainacan/v2/database')
})

21
package-lock.json generated
View File

@ -4309,11 +4309,6 @@
"readable-stream": "2.3.3"
}
},
"fs": {
"version": "0.0.1-security",
"resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
"integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ="
},
"fs-extra": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.1.tgz",
@ -7415,9 +7410,9 @@
}
},
"mdi": {
"version": "2.1.99",
"resolved": "https://registry.npmjs.org/mdi/-/mdi-2.1.99.tgz",
"integrity": "sha512-s0NN21D+r6pOgU0UmrsbNs+lrdKG6xFq4BvJF6ivJlI5ki6KfWMO8kQsIpYxYiM177rad0cY3nOWVXotyyoyeg=="
"version": "2.2.43",
"resolved": "https://registry.npmjs.org/mdi/-/mdi-2.2.43.tgz",
"integrity": "sha512-g3m6z4303qieltUM20JL2gdsJZvoVzIzO74qa2XxZ2kg9JPwrPEAgooVhRDHZi1vvRh0gB8Dg+c9XqNdz4jcIg=="
},
"media-typer": {
"version": "0.3.0",
@ -7810,11 +7805,6 @@
"integrity": "sha512-nJmSswG4As/MkRq7QZFuH/sf/yuv8ODdMZrY4Bedjp77a5MK4A6s7YbBB64c9u79EBUOfXUXBvArmvzTD0X+6g==",
"dev": true
},
"net": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/net/-/net-1.0.2.tgz",
"integrity": "sha1-0XV+yaf7I3HYPPR1XOPifhCCk4g="
},
"nice-try": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.4.tgz",
@ -11666,11 +11656,6 @@
"setimmediate": "1.0.5"
}
},
"tls": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/tls/-/tls-0.0.1.tgz",
"integrity": "sha1-CrK/WWjXHfL4wOFRXSSiJAuYqsg="
},
"tmp": {
"version": "0.0.31",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.31.tgz",

View File

@ -4,22 +4,18 @@
"author": "Eduardo <eduardo.humberto1992@gmail.com>",
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development webpack --mode development --open --inline --hot",
"build": "cross-env NODE_ENV=production webpack --mode production --progress --hide-modules"
},
"dependencies": {
"axios": "^0.18.0",
"buefy": "^0.6.3",
"bulma": "^0.6.2",
"fs": "0.0.1-security",
"html-to-json": "^0.6.0",
"mdi": "^2.1.99",
"moment": "^2.21.0",
"net": "^1.0.2",
"node-sass": "^4.7.2",
"qs": "^6.5.1",
"moment": "^2.21.0",
"node-sass": "^4.7.2",
"sass-loader": "^6.0.6",
"tls": "0.0.1",
"vue": "^2.5.16",
"vue-router": "^3.0.1",
"vuedraggable": "^2.16.0",
@ -43,6 +39,7 @@
"postcss-loader": "^2.1.0",
"sass-resources-loader": "^1.3.2",
"style-loader": "^0.20.3",
"uglifyjs-webpack-plugin": "^1.2.4",
"vue-custom-element": "^2.1.0",
"vue-loader": "^14.2.2",
"vue-template-compiler": "^2.5.16",

View File

@ -127,7 +127,7 @@
</form>
<b-loading
:active.sync="isLoading"
:active.sync="isLoadingCategory"
:can-cancel="false"/>
</div>
</div>

View File

@ -50,10 +50,9 @@
<option
id="tainacan-select-parent-term"
v-for="(parentTerm, index) in parentTermsList"
v-if="editForm.id != parentTerm.id"
:key="index"
:value="editForm.parent">
{{ parentTerm.name == 0 ? $i18n.get('instruction_select_a_parent_term') : parentTerm.name }}
:value="parentTerm.id">
{{ parentTerm.name }}
</option>
</b-select>
</b-field>
@ -99,14 +98,18 @@ export default {
},
computed: {
parentTermsList() {
return this.getTerms();
let parentTerms = [];
parentTerms.push({name: this.$i18n.get('label_no_parent_term'), id: 0});
for (let term of this.getTerms()) {
if (term.id != this.editForm.id)
parentTerms.push({id: term.id, name: term.name});
}
return parentTerms;
}
},
created() {
created() {
this.editForm = this.editedTerm;
this.oldForm = JSON.parse(JSON.stringify(this.originalTerm));
},
beforeDestroy() {
if (this.closedByForm) {
@ -140,7 +143,6 @@ export default {
.then(() => {
this.editForm = {};
this.closedByForm = true;
this.$console.log("Tudo OK AQUI.");
this.$emit('onEditionFinished');
})
.catch((error) => {
@ -149,16 +151,15 @@ export default {
});
} else {
this.updateTerm({
categoryId: this.categoryId,
termId: term.id,
termId: this.editForm.id,
index: this.index,
name: this.editForm.name,
description: this.editForm.description,
parent: this.editForm.parent
})
.then(() => {
.then((res) => {
this.editForm = {};
this.closedByForm = true;
this.$emit('onEditionFinished');

View File

@ -12,7 +12,8 @@
'not-sortable-item': term.id == 'new' || term.id == undefined || openedTermId != '' ,
'not-focusable-item': openedTermId == term.id
}"
v-for="(term, index) in termsList"
:style="{'margin-left': (term.depth * 20) + 'px'}"
v-for="(term, index) in orderedTermsList"
:key="index">
<span
class="term-name"
@ -57,6 +58,9 @@
</div>
</div>
<b-loading
:active.sync="isLoadingTerms"
:can-cancel="false"/>
</div>
</template>
@ -68,7 +72,6 @@ export default {
name: 'TermsList',
data(){
return {
// Terms related
isLoadingTerms: false,
formWithErrors: '',
openedTermId: '',
@ -77,15 +80,18 @@ export default {
}
},
props: {
categoryId: Number
categoryId: String
},
computed: {
termsList() {
//this.orderedTermsList = new Array();
//this.buildOrderedTermsList(0, 0);
return this.getTerms();
}
},
watch: {
termsList() {
this.generateOrderedTerms();
}
},
components: {
TermEditionForm
},
@ -117,7 +123,6 @@ export default {
'deleteTerm'
]),
...mapGetters('category',[
'getTerms'
]),
addNewTerm() {
@ -176,19 +181,20 @@ export default {
this.termsList.splice(index, 1);
}
this.formWithErrors = '';
delete this.editForms[this.openedTermId];
this.$delete(this.editForms, this.openedTermId);
this.openedTermId = '';
},
onTermEditionCanceled() {
this.formWithErrors = '';
delete this.editForms[this.openedTermId];
this.$delete(this.editForms, this.openedTermId);
this.openedTermId = '';
},
buildOrderedTermsList(parentId, termDepth) {
for (let term of this.termsList) {
for (let i = 1; i < this.termsList.length; i++) {
let term = this.termsList[i];
if (term['parent'] != parentId ) {
if (term.parent != parentId ) {
continue;
}
@ -198,6 +204,10 @@ export default {
this.buildOrderedTermsList(term.id, termDepth + 1);
}
},
generateOrderedTerms() {
this.orderedTermsList = new Array();
this.buildOrderedTermsList(0, 0);
}
},
created() {
@ -207,6 +217,7 @@ export default {
.then(() => {
// Fill this.form data with current data.
this.isLoadingTerms = false;
this.generateOrderedTerms();
})
.catch((error) => {
this.$console.log(error);
@ -239,7 +250,7 @@ export default {
min-height: 40px;
display: block;
position: relative;
cursor: grab;
//cursor: grab;
.handle {
padding-right: 6em;

View File

@ -17,8 +17,6 @@ export default {
collectionId: Number
}
},
methods: {
},
components: {
SecondaryMenu
},

View File

@ -123,6 +123,7 @@ return [
'label_parent_term' => __( 'Parent Term', 'tainacan' ),
'label_new_term' => __( 'New Term', 'tainacan' ),
'label_category_terms' => __( 'Category Terms', 'tainacan' ),
'label_no_parent_term' => __( 'No parent term', 'tainacan' ),
// Instructions. More complex sentences to guide user and placeholders
'instruction_dragndrop_fields_collection' => __( 'Drag and drop Fields here to Collection.', 'tainacan' ),

View File

@ -259,12 +259,18 @@ class TAINACAN_REST_Controller extends WP_REST_Controller {
// handle core field
if( array_key_exists("key", $a) ){
$field = new Tainacan\Entities\Field($a['key']);
if( strpos( $field->get_field_type(), 'Core') !== false ){
if( strpos( $field->get_field_type(), 'Core_Title') !== false ){
$args[ 'post_title_in' ] = [
'relation' => ( isset( $request_meta_query['relation']) ) ? $request_meta_query['relation'] : 'AND' ,
'value' => ( is_array( $a['value'] ) ) ? $a['value'] : [$a['value']]
];
continue;
} else if( strpos( $field->get_field_type(), 'Core_Description') !== false ) {
$args[ 'post_content_in' ] = [
'relation' => ( isset( $request_meta_query['relation']) ) ? $request_meta_query['relation'] : 'AND' ,
'value' => ( is_array( $a['value'] ) ) ? $a['value'] : [$a['value']]
];
continue;
}
}

View File

@ -23,7 +23,6 @@ class Category extends Field_Type {
]);
$this->set_form_component('tainacan-form-category');
// TODO: Set component depending on options. If multiple is checkbox. if single, select. etc.
$this->set_component('tainacan-category');
}

View File

@ -52,7 +52,9 @@
export default {
name: 'TainacanFormItem',
props: {
field: Object
field: {
type: Object
}
},
data(){
return {

View File

@ -26,6 +26,7 @@ class Items extends Repository {
{
parent::__construct();
add_filter( 'posts_where', array(&$this, 'title_in_posts_where'), 10, 2 );
add_filter( 'posts_where', array(&$this, 'content_in_posts_where'), 10, 2 );
}
public function get_map() {
@ -333,4 +334,26 @@ class Items extends Repository {
}
return $where;
}
/**
* allow wp query filter post by array of content
*
* @param $where
* @param $wp_query
* @return string
*/
public function content_in_posts_where( $where, $wp_query ) {
global $wpdb;
if ( $post_content_in = $wp_query->get( 'post_content_in' ) ) {
if(is_array( $post_content_in ) && isset( $post_content_in['value']) ){
$quotes = [];
foreach ($post_content_in['value'] as $title) {
$quotes[] = "'" . esc_sql( $wpdb->esc_like( $title ) ). "'";
}
}
$where .= ' '.$post_content_in['relation'].' ' . $wpdb->posts . '.post_content IN ( ' .implode(',', $quotes ) . ')';
}
return $where;
}
}

View File

@ -93,8 +93,13 @@ class Terms extends Repository {
unset($defaults['id']);
return $defaults;
}
public function insert($term){
/**
* @param Entities\Entity $term
*
* @return Entities\Entity|Entities\Term
*/
public function insert($term){
// First iterate through the native post properties
$map = $this->get_map();
foreach ($map as $prop => $mapped) {
@ -104,22 +109,39 @@ class Terms extends Repository {
}
// save post and get its ID
$term_inserted = wp_insert_term( $term->get_name(), $term->get_taxonomy(), [
'parent' => $term->get_parent(),
'description' => $term->get_description(),
]);
if(isset($term->WP_Term->term_id)){
$args = [];
foreach ($map as $prop => $mapped) {
if ($mapped['map'] != 'termmeta') {
$get_ = 'get_'. $prop;
if( !empty($term->WP_Term->{$mapped['map']}) ){
$args[$mapped['map']] = $term->$get_();
}
}
}
$term_saved = wp_update_term( $term->get_id(), $term->get_taxonomy(), $args);
} else {
$term_saved = wp_insert_term( $term->get_name(), $term->get_taxonomy(), [
'parent' => $term->get_parent(),
'description' => $term->get_description(),
] );
}
// Now run through properties stored as postmeta
foreach ($map as $prop => $mapped) {
if ($mapped['map'] == 'termmeta') {
update_term_meta($term_inserted['term_id'], $prop, wp_slash( $term->get_mapped_property($prop) ));
update_term_meta($term_saved['term_id'], $prop, wp_slash( $term->get_mapped_property($prop) ));
}
}
do_action('tainacan-insert', $term);
do_action('tainacan-insert-Term', $term);
//var_dump($term);
return new Entities\Term($term_inserted['term_id'], $term->get_taxonomy());
return new Entities\Term($term_saved['term_id'], $term->get_taxonomy());
}
/**
@ -178,7 +200,7 @@ class Terms extends Repository {
}
}
public function update($object, $tax_name = null){
public function update($object, $args = null){
return $this->insert($object);
}

View File

@ -6,7 +6,6 @@ import { eventBus } from './event-bus-web-components';
import { eventFilterBus } from './event-bus-filters';
import Buefy from 'buefy'
Vue.use(Buefy);
Vue.use(VueCustomElement);

View File

@ -131,7 +131,6 @@ export const sendTerm = ({commit}, { categoryId, index, name, description, paren
resolve( term );
})
.catch(error => {
console.log(error);
reject( error );
});
});
@ -160,12 +159,10 @@ export const updateTerm = ({ commit }, { categoryId, termId, index, name, descri
})
.then( res => {
let term = res.data;
console.log(term);
commit('setSingleTerm', term);
resolve( term );
})
.catch(error => {
console.log(error);
reject(error)
//reject({ error_message: error['response']['data'].error_message, errors: error['response']['data'].errors });
});

View File

@ -1,3 +1,5 @@
import Vue from 'vue';
// CATEGORIES
export const setCategory = (state, category) => {
state.category = category;

View File

@ -1,3 +1,5 @@
import Vue from 'vue';
export const setItems = ( state, items ) => {
state.items = items;
}

View File

@ -97,7 +97,8 @@ class TAINACAN_REST_Terms extends TAINACAN_UnitApiTestCase {
);
$new_attributes = json_encode([
'name' => 'Trap'
'name' => 'Trap',
'user' => 7
]);
$request = new \WP_REST_Request(
@ -112,6 +113,7 @@ class TAINACAN_REST_Terms extends TAINACAN_UnitApiTestCase {
$this->assertNotEquals('Rock', $data['name']);
$this->assertEquals('Trap', $data['name']);
$this->assertEquals(7, $data['user']);
$this->assertEquals($taxonomy->get_db_identifier(), $data['taxonomy']);
}

View File

@ -1,5 +1,6 @@
let path = require('path');
let webpack = require('webpack');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
entry: {
@ -11,7 +12,6 @@ module.exports = {
publicPath: './src/assets/',
filename: '[name]-components.js'
},
devtool: 'eval-source-map',
module: {
rules: [
{
@ -55,15 +55,13 @@ module.exports = {
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.js'
'vue$': 'vue/dist/vue.esm.js'
}
},
devServer: {
historyApiFallback: true,
noInfo: true
},
node: {
fs: 'empty'
fs: 'empty',
net: 'empty',
tls: 'empty'
},
performance: {
hints: false
@ -71,7 +69,7 @@ module.exports = {
};
if (process.env.NODE_ENV === 'production') {
module.exports.devtool = 'inline-source-map';
module.exports.devtool = ''; //'eval-source-map'; // Add it to use vue dev tools
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
@ -79,16 +77,15 @@ if (process.env.NODE_ENV === 'production') {
NODE_ENV: '"production"'
}
}),
// new webpack.optimize.UglifyJsPlugin({
// compress: {
// warnings: false
// }
// }),
// new webpack.LoaderOptionsPlugin({
// minimize: true
// })
new UglifyJsPlugin({
parallel: true,
sourceMap: false, //Changes to true to use vue dev tools
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
]);
// module.exports.resolve.alias = {
// 'vue$': 'vue/dist/vue.min.js'
// }
module.exports.resolve.alias = {
'vue$': 'vue/dist/vue.min.js'
}
}