Removes remaining files related to cypress.

This commit is contained in:
Mateus Machado Luna 2020-01-14 13:33:21 -03:00
parent e074dd3f8a
commit 25dc7797d3
17 changed files with 0 additions and 3513 deletions

2
.gitignore vendored
View File

@ -20,8 +20,6 @@ src/views/admin/scss/.sass-cache
src/assets/css/tainacan-admin.css src/assets/css/tainacan-admin.css
src/assets/css/tainacan-admin.css.map src/assets/css/tainacan-admin.css.map
src/assets/report.html src/assets/report.html
cypress/videos
cypress/screenshots
.vscode .vscode
src/pdf-viewer/pdfjs-dist src/pdf-viewer/pdfjs-dist
report.txt report.txt

View File

@ -1,5 +0,0 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}

View File

@ -1,107 +0,0 @@
describe('Taxonomy test', function () {
beforeEach(() => {
cy.loginByUI()
})
it('clear DB', function(){
cy.clearDB()
})
context('CRUD Taxonomies', function(){
it('canceled create taxonomy', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/taxonomies')
cy.location('hash').should('eq', '#/taxonomies')
//cy.get('#button-taxonomy-creation').click()
cy.get('.button').click()
cy.location('hash').should('eq', '#/taxonomies/new')
cy.get('#tainacan-text-name').type('Taxonomy canceled')
cy.get('#tainacan-text-description').type('description taxonomy canceled')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-cancel-taxonomy-creation').click()
cy.location('hash').should('eq', '#/taxonomies/')
cy.get('td').should('not.contain', 'Book canceled')
})
it('create taxonomy with status publish', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/taxonomies')
cy.location('hash').should('eq', '#/taxonomies')
//cy.get('#button-taxonomy-creation').click()
cy.get('.button').click()
cy.location('hash').should('eq', '#/taxonomies/new')
cy.get('#tainacan-text-name').type('Taxonomy publish')
cy.get('#tainacan-text-description').type('description taxonomy publish')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-taxonomy-creation').click()
cy.location('hash').should('eq', '#/taxonomies/')
cy.get('td').should('contain', 'Taxonomy publish')
})
it('create taxonomy with status private', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/taxonomies')
cy.location('hash').should('eq', '#/taxonomies')
//cy.get('#button-taxonomy-creation').click()
cy.get('.button').click()
cy.location('hash').should('eq', '#/taxonomies/new')
cy.get('#tainacan-text-name').type('Taxonomy private')
cy.get('#tainacan-text-description').type('description taxonomy private')
cy.get('#tainacan-select-status').select('Private').should('have.value', 'private')
cy.get('#button-submit-taxonomy-creation').click()
cy.location('hash').should('eq', '#/taxonomies/')
cy.get('td').should('contain', 'Taxonomy private')
})
it('create taxonomy with status draft', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/taxonomies')
cy.location('hash').should('eq', '#/taxonomies')
//cy.get('#button-taxonomy-creation').click()
cy.get('.button').click()
cy.location('hash').should('eq', '#/taxonomies/new')
cy.get('#tainacan-text-name').type('Taxonomy draft')
cy.get('#tainacan-text-description').type('description taxonomy draft')
cy.get('#tainacan-select-status').select('Draft').should('have.value', 'draft')
cy.get('#button-submit-taxonomy-creation').click()
cy.location('hash').should('eq', '#/taxonomies/')
cy.get('td').should('not.contain', 'Taxonomy draft')
})
it('create taxonomy with status draft', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/taxonomies')
cy.location('hash').should('eq', '#/taxonomies')
//cy.get('#button-taxonomy-creation').click()
cy.get('.button').click()
cy.location('hash').should('eq', '#/taxonomies/new')
cy.get('#tainacan-text-name').type('Taxonomy trash')
cy.get('#tainacan-text-description').type('description taxonomy trash')
cy.get('#tainacan-select-status').select('Trash').should('have.value', 'trash')
cy.get('#button-submit-taxonomy-creation').click()
cy.location('hash').should('eq', '#/taxonomies/')
cy.get('td').should('not.contain', 'Taxonomy trash')
})
it('create taxonomy color', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/taxonomies')
cy.location('hash').should('eq', '#/taxonomies')
//cy.get('#button-taxonomy-creation').click()
cy.get('.button').click()
cy.location('hash').should('eq', '#/taxonomies/new')
cy.get('#tainacan-text-name').type('Taxonomy color')
cy.get('#tainacan-text-description').type('description taxonomy color')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-taxonomy-creation').click()
cy.location('hash').should('eq', '#/taxonomies/')
cy.get('td').should('contain', 'Taxonomy color')
})
it('delete taxonomy color', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/taxonomies')
cy.location('hash').should('eq', '#/taxonomies')
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Taxonomy trash')
cy.get(':nth-child(1) > [data-label="Actions"] > :nth-child(1) > #button-delete > .icon > .mdi').click()
cy.get('.modal-card').should('have.class', 'animation-content')
cy.get('.is-primary').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('not.contain', 'Taxonomy trash')
})
})
})

View File

@ -1,267 +0,0 @@
describe('Collection test', function () {
beforeEach(() => {
cy.loginByUI()
})
it('clear DB', function(){
cy.clearDB()
})
context('CRUD collections', function(){
it('canceled collection', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book canceled')
cy.get('#tainacan-text-description').type('description book canceled')
cy.get('#button-cancel-collection-creation').click()
cy.location('hash').should('eq', '#/collections/')
cy.get('td').should('not.contain', 'Book canceled')
})
it('create collection with status publish', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book publish')
cy.get('#tainacan-text-description').type('description book publish')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('contain', 'Book publish')
})
it('create collection with status private', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book private')
cy.get('#tainacan-text-description').type('description book private')
cy.get('#tainacan-select-status').select('Private').should('have.value', 'private')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('contain', 'Book private')
})
it('create collection with status draft', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book draft')
cy.get('#tainacan-text-description').type('description book draft')
cy.get('#tainacan-select-status').select('Draft').should('have.value', 'draft')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('not.contain', 'Book draft')
})
it('create collection with status trash', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book trash')
cy.get('#tainacan-text-description').type('description book trash')
cy.get('#tainacan-select-status').select('Trash').should('have.value', 'trash')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('not.contain', 'Book trash')
})
it('delete collection', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book delete')
cy.get('#tainacan-text-description').type('description book delete')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('contain', 'Book delete')
cy.get(':nth-child(1) > [data-label="Actions"] > :nth-child(1) > #button-delete > .icon > .mdi').click()
cy.get('.modal-card-body').should('contain', 'Do you really want to delete this collection?')
cy.get('.is-primary').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('not.contain', 'Book delete')
})
})
context('Create many collections for verify persistence the datas', function(){
it('create many collections', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book 1')
cy.get('#tainacan-text-description').type('description book 1')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('contain', 'Book 1')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book 2')
cy.get('#tainacan-text-description').type('description book 2')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('contain', 'Book 2')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book 3')
cy.get('#tainacan-text-description').type('description book 3')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('contain', 'Book 3')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book 4')
cy.get('#tainacan-text-description').type('description book 4')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('contain', 'Book 4')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book 5')
cy.get('#tainacan-text-description').type('description book 5')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('contain', 'Book 5')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book 6')
cy.get('#tainacan-text-description').type('description book 6')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('contain', 'Book 6')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book 7')
cy.get('#tainacan-text-description').type('description book 7')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('contain', 'Book 7')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book 8')
cy.get('#tainacan-text-description').type('description book 8')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('contain', 'Book 8')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book 9')
cy.get('#tainacan-text-description').type('description book 9')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('contain', 'Book 9')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book 10')
cy.get('#tainacan-text-description').type('description book 10')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('contain', 'Book 10')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book 11')
cy.get('#tainacan-text-description').type('description book 11')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('contain', 'Book 11')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book 12')
cy.get('#tainacan-text-description').type('description book 12')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('contain', 'Book 12')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book 13')
cy.get('#tainacan-text-description').type('description book 13')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('contain', 'Book 13')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book 14')
cy.get('#tainacan-text-description').type('description book 14')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('contain', 'Book 14')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book 15')
cy.get('#tainacan-text-description').type('description book 15')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('contain', 'Book 15')
})
})
context('Check all collections', function(){
it('check if collections are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('select').select('24').should('have.value', '24')
cy.get('.b-table').should('contain', 'Book publish')
.and('contain', 'Book private')
.and('not.contain', 'Book draft')
.and('not.contain', 'Book trash')
.and('contain', 'Book 1')
.and('contain', 'Book 2')
.and('contain', 'Book 3')
.and('contain', 'Book 4')
.and('contain', 'Book 5')
.and('contain', 'Book 6')
.and('contain', 'Book 7')
.and('contain', 'Book 8')
.and('contain', 'Book 9')
.and('contain', 'Book 10')
.and('contain', 'Book 11')
.and('contain', 'Book 12')
.and('contain', 'Book 13')
.and('contain', 'Book 14')
.and('contain', 'Book 15')
})
})
})

View File

@ -1,201 +0,0 @@
context('Taxonomy field test', function(){
beforeEach(() => {
cy.loginByUI()
})
it('clear DB', function(){
cy.clearDB()
})
it('create collection for create fields', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-create-collection').click()
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.location('hash').should('eq', '#/collections')
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-taxonomy-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-taxonomy-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-taxonomy-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-taxonomy-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-taxonomy-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-taxonomy-creation').click()
cy.get('.page-container').should('contain', 'Cat 6')
})
it('canceled create taxonomy-type field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.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('taxonomy 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', 'taxonomy name canceled')
})
it('create taxonomy-type field public - input type = radio', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.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('taxonomy 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-taxonomy-radio')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'taxonomy name public')
})
it('create taxonomy-type field public - input type = selectbox', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.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('taxonomy 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-taxonomy-selectbox')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'taxonomy name public')
})
it('create taxonomy-type field private', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.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('taxonomy 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-taxonomy-radio')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'taxonomy name private')
})
it('create taxonomy-type field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.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('taxonomy 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-taxonomy-radio')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'taxonomy name public required')
})
it('create taxonomy-type field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.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('taxonomy 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-taxonomy-radio')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'taxonomy name public multiple values')
})
it('create taxonomy-type field public unique values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.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('taxonomy 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-taxonomy-radio')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'taxonomy name public unique values')
})
it('check if fields are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
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', 'taxonomy name canceled')
cy.get('.active-fields-area >').should('contain', 'taxonomy name public')
cy.get('.active-fields-area >').should('contain', 'taxonomy name private')
cy.get('.active-fields-area >').should('contain', 'taxonomy name public required')
cy.get('.active-fields-area >').should('contain', 'taxonomy name public multiple values')
cy.get('.active-fields-area >').should('contain', 'taxonomy name public unique values')
})
})

View File

@ -1,460 +0,0 @@
describe('Date field test', function() {
beforeEach(() => {
cy.loginByUI()
})
it('clear DB', function(){
cy.clearDB()
})
it('create collection for create fields', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-create-collection').click()
cy.get('#tainacan-text-name').type('Date Fields')
cy.get('#tainacan-text-description').type('Description Date 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', 'Date Fields')
})
context('CRUD date field', function(){
it('create submission date field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Submission date')
cy.get('.textarea').type('description submission date')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.handle > .field-name').should('contain', 'Submission date')
})
it('check create submission date field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.contains('Submission date')
})
it('create year of manufacture field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Year of manufacture')
cy.get('.textarea').type('description year of manufacture')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.handle > .field-name').should('contain', 'Year of manufacture')
})
it('check create year of manufacture field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.contains('Year of manufacture')
})
it('edit year of manufacture field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get(':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('.handle > .field-name').should('contain', 'Year of manufacture edited')
})
it('create year field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Year')
cy.get('.textarea').type('description year')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.handle > .field-name').should('contain', 'Year')
})
it('delete year field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.contains('Year')
cy.get(':nth-child(5) > .handle > .controls > :nth-child(3) > .icon > .mdi').click()
cy.get('.handle > .field-name').should('not.eq', 'Year')
})
it('check not contain year field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.handle > .field-name').should('not.eq', 'Year')
})
})
context('Diseble date field', function(){
it('create purchase day field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Purchase day disebled')
cy.get('.textarea').type('description purchase day')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Purchase day disebled')
})
it('disebled purchase day field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get(':nth-child(5) > .handle > .controls > .switch > .check').click()
cy.get('.active-fields-area > :nth-child(5)').should('have.class', 'disabled-field')
})
it('check disebled purchase day field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area > :nth-child(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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(3)').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', 'Date')
cy.get('.active-fields-area > :nth-child(6) > .handle > .label-details').should('contain', 'Not saved')
})
it('check not contain blank field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
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 date field private', function(){
it('create date private field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Date 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', 'Date private')
})
it('check create date private field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area > :nth-child(6) > .handle > .field-name').should('contain', 'Date 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 warranty field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Warranty')
cy.get('.textarea').type('description warranty')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Warranty')
})
it('check that Not Saved label wasnt inserted, and changes were lost', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
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', 'Warranty')
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', 'Warranty 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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Date 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.eq', 'Date Type').and('contain', 'Date')
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}Date Type')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area > :nth-child(8) > .handle > .field-name').should('contain', 'Date Type').and('not.eq', 'Date')
cy.get('.active-fields-area > :nth-child(8) > .handle > .label-details').should('not.eq', 'Not saved')
})
})
context('Fields Sorting', function(){
})
context('create date-types fields tests', function(){
it('canceled create date field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Date 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', 'Date name canceled')
})
it('create date-type field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Date 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', 'Date name public required')
})
it('create date-type field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Date 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', '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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}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')
})
})
context('Leave page without saving field editions', function(){
it('Leave page without saving field editions', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
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').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', 'Date')
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 dates fields', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Date 1')
cy.get('.textarea').type('description date')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Date 2')
cy.get('.textarea').type('description date')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Date 3')
cy.get('.textarea').type('description date')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Date 4')
cy.get('.textarea').type('description date')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Date 5')
cy.get('.textarea').type('description date')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Date 6')
cy.get('.textarea').type('description date')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Date 7')
cy.get('.textarea').type('description date')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Date 8')
cy.get('.textarea').type('description date')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Date 9')
cy.get('.textarea').type('description date')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(3)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Date 10')
cy.get('.textarea').type('description date')
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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area >').should('contain', 'Submission date')
.and('contain', 'Year of manufacture edited')
.and('contain', 'Purchase day disebled')
.and('contain', 'Date Private')
.and('not.contain', 'Blank')
.and('contain', 'Warranty')
.and('contain', 'Date Type')
.and('not.contain', 'Date name canceled')
.and('contain', 'Date name public required')
.and('contain', 'Date name public multiple values')
.and('contain', 'Date name public unique values')
.and('contain', 'Date 1')
.and('contain', 'Date 2')
.and('contain', 'Date 3')
.and('contain', 'Date 4')
.and('contain', 'Date 5')
.and('contain', 'Date 6')
.and('contain', 'Date 7')
.and('contain', 'Date 8')
.and('contain', 'Date 9')
.and('contain', 'Date 10')
})
})
})

View File

@ -1,460 +0,0 @@
describe('Numeric field test', function() {
beforeEach(() => {
cy.loginByUI()
})
it('clear DB', function(){
cy.clearDB()
})
it('create collection for create fields', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-create-collection').click()
cy.get('#tainacan-text-name').type('Numeric Fields')
cy.get('#tainacan-text-description').type('Description Numeric 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', 'Numeric Fields')
})
context('CRUD numeric field', function(){
it('create counter field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Counter')
cy.get('.textarea').type('description counter')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.handle > .field-name').should('contain', 'Counter')
})
it('check create counter field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.contains('Counter')
})
it('create code field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Code')
cy.get('.textarea').type('description code')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.handle > .field-name').should('contain', 'Code')
})
it('check create code field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.contains('Code')
})
it('edit code field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get(':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('.handle > .field-name').should('contain', 'Code edited')
})
it('create number field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Number')
cy.get('.textarea').type('description number')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.handle > .field-name').should('contain', 'Number')
})
it('delete number field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.contains('Number')
cy.get(':nth-child(5) > .handle > .controls > :nth-child(3) > .icon > .mdi').click()
cy.get('.handle > .field-name').should('not.eq', 'Number')
})
it('check not contain year field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.handle > .field-name').should('not.eq', 'Number')
})
})
context('Diseble numeric field', function(){
it('create registration number field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Registration number disebled')
cy.get('.textarea').type('description registration number')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Registration number disebled')
})
it('disebled registration number field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get(':nth-child(5) > .handle > .controls > .switch > .check').click()
cy.get('.active-fields-area > :nth-child(5)').should('have.class', 'disabled-field')
})
it('check disebled registration number field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area > :nth-child(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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(4)').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', 'Numeric')
cy.get('.active-fields-area > :nth-child(6) > .handle > .label-details').should('contain', 'Not saved')
})
it('check not contain blank field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
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 numeric field private', function(){
it('create date private field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Numeric 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', 'Numeric private')
})
it('check create numeric private field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area > :nth-child(6) > .handle > .field-name').should('contain', 'Numeric 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 amount field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Amount')
cy.get('.textarea').type('description amount')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Amount')
})
it('check that Not Saved label wasnt inserted, and changes were lost', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
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', 'Amount')
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', 'Amount 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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Numeric 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.eq', 'Numeric Type').and('contain', 'Numeric')
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}Numeric Type')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area > :nth-child(8) > .handle > .field-name').should('contain', 'Numeric Type').and('not.eq', 'Numeric')
cy.get('.active-fields-area > :nth-child(8) > .handle > .label-details').should('not.eq', 'Not saved')
})
})
context('Fields Sorting', function(){
})
context('create date-types fields tests', function(){
it('canceled create numeric field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Numeric 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', 'Numeric name canceled')
})
it('create numeric-type field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Numeric 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', 'Numeric name public required')
})
it('create numeric-type field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Numeric 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', '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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}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')
})
})
context('Leave page without saving field editions', function(){
it('Leave page without saving field editions', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
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').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', 'Numeric')
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 numerics fields', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Numeric 1')
cy.get('.textarea').type('description numeric')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Numeric 2')
cy.get('.textarea').type('description numeric')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Numeric 3')
cy.get('.textarea').type('description numeric')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Numeric 4')
cy.get('.textarea').type('description numeric')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Numeric 5')
cy.get('.textarea').type('description numeric')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Numeric 6')
cy.get('.textarea').type('description numeric')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Numeric 7')
cy.get('.textarea').type('description numeric')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Numeric 8')
cy.get('.textarea').type('description numeric')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Numeric 9')
cy.get('.textarea').type('description numeric')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(4)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Numeric 10')
cy.get('.textarea').type('description numeric')
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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area >').should('contain', 'Counter')
.and('contain', 'Code edited')
.and('contain', 'Registration number disabled')
.and('contain', 'Numeric Private')
.and('not.contain', 'Blank')
.and('contain', 'Amount')
.and('contain', 'Numeric Type')
.and('not.contain', 'Numeric name canceled')
.and('contain', 'Numeric name public required')
.and('contain', 'Numeric name public multiple values')
.and('contain', 'Numeric name public unique values')
.and('contain', 'Numeric 1')
.and('contain', 'Numeric 2')
.and('contain', 'Numeric 3')
.and('contain', 'Numeric 4')
.and('contain', 'Numeric 5')
.and('contain', 'Numeric 6')
.and('contain', 'Numeric 7')
.and('contain', 'Numeric 8')
.and('contain', 'Numeric 9')
.and('contain', 'Numeric 10')
})
})
})

View File

@ -1,162 +0,0 @@
context('Relationship field test', function(){
beforeEach(() => {
cy.loginByUI()
})
it('clear DB', function(){
cy.clearDB()
})
it('create collection for create fields', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-create-collection').click()
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.location('hash').should('eq', '#/collections')
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.location('hash').should('eq', '#/collections')
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.location('hash').should('eq', '#/collections')
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.location('hash').should('eq', '#/collections')
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.location('hash').should('eq', '#/collections')
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.location('hash').should('eq', '#/collections')
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.location('hash').should('eq', '#/collections')
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.location('hash').should('eq', '#/collections')
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

@ -1,485 +0,0 @@
describe('Selectbox field test', function() {
beforeEach(() => {
cy.loginByUI()
})
it('clear DB', function(){
cy.clearDB()
})
it('create collection for create fields', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-create-collection').click()
cy.get('#tainacan-text-name').type('Selectbox Fields')
cy.get('#tainacan-text-description').type('Description Selectbox Fields')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('#primary-menu > .menu > .menu-header > .menu-list > li > .router-link-active > .icon > .mdi').click()
cy.get('.b-table').should('contain', 'Selectbox Fields')
})
context('CRUD selectbox field', function(){
it('create reviewed field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Reviewed')
cy.get('.textarea').type('description reviewed')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('.autocomplete > .control > .input').type('op1{enter}op2{enter}op3')
cy.get(':nth-child(2) > .button').click()
cy.get('.handle > .field-name').should('contain', 'Reviewed')
})
it('check create reviewed field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.contains('Reviewed')
})
it('create edited field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Edited')
cy.get('.textarea').type('description edited')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('.autocomplete > .control > .input').type('op1{enter}op2{enter}op3')
cy.get(':nth-child(2) > .button').click()
cy.get('.handle > .field-name').should('contain', 'Edited')
})
it('check create edited field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.contains('Edited')
})
it('edit edited field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get(':nth-child(4) > .handle > .controls > :nth-child(2) > .icon > .mdi').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('Edited edited')
cy.get('.textarea').type(' edited')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('.autocomplete > .control > .input').type('op1{enter}op2{enter}op3')
cy.get(':nth-child(2) > .button').click()
cy.get('.handle > .field-name').should('contain', 'Edited edited')
})
it('create itsCool field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}itsCool')
cy.get('.textarea').type('description itsCool')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('.autocomplete > .control > .input').type('op1{enter}op2{enter}op3')
cy.get(':nth-child(2) > .button').click()
cy.get('.handle > .field-name').should('contain', 'itsCool')
})
it('delete itsCool field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.contains('itsCool')
cy.get(':nth-child(5) > .handle > .controls > :nth-child(3) > .icon > .mdi').click()
cy.get('.handle > .field-name').should('not.eq', 'itsCool')
})
it('check not contain itsCool field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.handle > .field-name').should('not.eq', 'itsCool')
})
})
context('Diseble selectbox field', function(){
it('create verified field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Verified disebled')
cy.get('.textarea').type('description verified')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('.autocomplete > .control > .input').type('YES{enter}NO')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Verified disebled')
})
it('disebled verified field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get(':nth-child(5) > .handle > .controls > .switch > .check').click()
cy.get('.active-fields-area > :nth-child(5)').should('have.class', 'disabled-field')
})
it('check disebled verified field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area > :nth-child(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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(5)').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('.help').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', 'Selectbox')
cy.get('.active-fields-area > :nth-child(6) > .handle > .label-details').should('contain', 'Not saved')
})
it('check not contain blank field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
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 selectbox field private', function(){
it('create selectbox private field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox private')
cy.get('.textarea').type('description private')
cy.get('#tainacan-select-status-private > .check').click()
cy.get('.autocomplete > .control > .input').type('yes{enter}no')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Selectbox private')
})
it('check create selectbox private field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')})
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area > :nth-child(6) > .handle > .field-name').should('contain', 'Selectbox private')
cy.get(':nth-child(6) > .handle > .controls > :nth-child(2) > .icon > .mdi').click()
cy.get('#tainacan-select-status-private > .check').should('be.selected')
})
})
context('"Not saved" label vs. "cancel button"', function(){
it('create likes field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Likes')
cy.get('.textarea').type('description likes')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('.autocomplete > .control > .input').type('yes{enter}no')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Likes')
})
it('check that Not Saved label wasnt inserted, and changes were lost', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
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', 'Likes')
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('.autocomplete > .control > .input').type('dont')
cy.get(':nth-child(1) > .button').click()
cy.get('.active-fields-area >').should('not.contain', 'Likes 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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox Type')
cy.get('.textarea').type('description new')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('.autocomplete > .control > .input').type('yes{enter}no')
cy.get(':nth-child(1) > .button').click()
cy.get('.active-fields-area > :nth-child(8) > .handle > .field-name').should('not.eq', 'Selectbox Type').and('contain', 'Selectbox')
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}Selectbox Type')
cy.get('.autocomplete > .control > .input').type('yes{enter}no')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area > :nth-child(8) > .handle > .field-name').should('contain', 'Selectbox Type').and('not.eq', 'Selectbox')
cy.get('.active-fields-area > :nth-child(8) > .handle > .label-details').should('not.eq', 'Not saved')
})
})
context('Fields Sorting', function(){
})
context('create selectbox-types fields tests', function(){
it('canceled create selectbox field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox name canceled')
cy.get('.textarea').type('description')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('.autocomplete > .control > .input').type('Y{enter}n')
cy.get(':nth-child(1) > .button').click()
cy.get('.active-fields-area >').should('not.contain', 'Selectbox name canceled')
})
it('create selectbox-type field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 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('.autocomplete > .control > .input').type('Y{enter}n')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Selectbox name public required')
})
it('create selectbox-type field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 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('.autocomplete > .control > .input').type('Y{enter}n')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Selectbox name public multiple values')
})
it('create selectbox-type field public unique values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 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('y{enter}n')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Selectbox 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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(5)').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', 'Selectbox')
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 selectbox fields', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(5)clearDB').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 1')
cy.get('.textarea').type('description selectbox')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('.autocomplete > .control > .input').type('y{enter}n')
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 2')
cy.get('.textarea').type('description selectbox')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('.autocomplete > .control > .input').type('y{enter}n')
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 3')
cy.get('.textarea').type('description selectbox')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('.autocomplete > .control > .input').type('y{enter}n')
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 4')
cy.get('.textarea').type('description selectbox')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('.autocomplete > .control > .input').type('y{enter}n')
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 5')
cy.get('.textarea').type('description selectbox')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('.autocomplete > .control > .input').type('y{enter}n')
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 6')
cy.get('.textarea').type('description selectbox')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('.autocomplete > .control > .input').type('y{enter}n')
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 7')
cy.get('.textarea').type('description selectbox')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('.autocomplete > .control > .input').type('y{enter}n')
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 8')
cy.get('.textarea').type('description selectbox')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('.autocomplete > .control > .input').type('y{enter}n')
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 9')
cy.get('.textarea').type('description selectbox')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('.autocomplete > .control > .input').type('y{enter}n')
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Selectbox 10')
cy.get('.textarea').type('description selectbox')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get('.autocomplete > .control > .input').type('y{enter}n')
cy.get(':nth-child(2) > .button').click()
})
it('check if fields are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
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', 'Reviewed')
.and('contain', 'Edited edited')
.and('contain', 'Verified disabled')
.and('contain', 'Selectbox Private')
.and('not.contain', 'Blank')
.and('contain', 'Likes')
.and('contain', 'Selectbox Type')
.and('not.contain', 'Selectbox name canceled')
.and('contain', 'Selectbox name public required')
.and('contain', 'Selectbox name public multiple values')
.and('contain', 'Selectbox name public unique values')
.and('contain', 'Selectbox 1')
.and('contain', 'Selectbox 2')
.and('contain', 'Selectbox 3')
.and('contain', 'Selectbox 4')
.and('contain', 'Selectbox 5')
.and('contain', 'Selectbox 6')
.and('contain', 'Selectbox 7')
.and('contain', 'Selectbox 8')
.and('contain', 'Selectbox 9')
.and('contain', 'Selectbox 10')
})
})
})

View File

@ -1,460 +0,0 @@
describe('TextArea field test', function() {
beforeEach(() => {
cy.loginByUI()
})
it('clear DB', function(){
cy.clearDB()
})
it('create collection for create fields', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-create-collection').click()
cy.get('#tainacan-text-name').type('TextArea Fields')
cy.get('#tainacan-text-description').type('Description TextArea 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', 'TextArea Fields')
})
context('CRUD textArea field', function(){
it('create model field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Model')
cy.get('.textarea').type('description model')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Model')
})
it('check create model field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.contains('Model')
})
it('create color field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Color')
cy.get('.textarea').type('description color')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Color')
})
it('check create color field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.contains('Color')
})
it('edit color field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get(':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', 'Color edited')
})
it('create door field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Door')
cy.get('.textarea').type('description door')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Door')
})
it('delete door field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.contains('Door')
cy.get(':nth-child(5) > .handle > .controls > :nth-child(3) > .icon > .mdi').click()
cy.get('.handle > .field-name').should('not.eq', 'Door')
})
it('check not contain door field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.handle > .field-name').should('not.eq', 'Door')
})
})
context('Diseble textArea field', function(){
it('create motor field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Motor disebled')
cy.get('.textarea').type('description motor')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Motor disebled')
})
it('disebled motor field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get(':nth-child(5) > .handle > .controls > .switch > .check').click()
cy.get('.active-fields-area > :nth-child(5)').should('have.class', 'disabled-field')
})
it('check disebled motor field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area > :nth-child(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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(2)').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', 'Textarea')
cy.get('.active-fields-area > :nth-child(6) > .handle > .label-details').should('contain', 'Not saved')
})
it('check not contain blank field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
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 textArea field private', function(){
it('create private field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 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', 'TextArea Private')
})
it('check create private field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area > :nth-child(6) > .handle > .field-name').should('contain', 'TextArea 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 brand field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Brand')
cy.get('.textarea').type('description brand')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area >').should('contain', 'Brand')
})
it('check that Not Saved label wasnt inserted, and changes were lost', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
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', 'Brand')
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', 'Brand 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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Steering 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', 'Steering Type').and('contain', 'Textarea')
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}Steering Type')
cy.get(':nth-child(2) > .button').click()
cy.get('.active-fields-area > :nth-child(8) > .handle > .field-name').should('contain', 'Steering Type').and('not.contain', 'Textarea')
cy.get('.active-fields-area > :nth-child(8) > .handle > .label-details').should('not.contain', 'Not saved')
})
})
context('Fields Sorting', function(){
})
context('create textArea-types fields tests', function(){
it('canceled create textArea field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 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', 'TextArea name canceled')
})
it('create textArea-type field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 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', 'TextArea name public required')
})
it('create textArea-type field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 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', '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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}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')
})
})
context('Leave page without saving field editions', function(){
it('Leave page without saving field editions', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
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').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', 'TextArea')
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 textAreas fields', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 1')
cy.get('.textarea').type('description textArea')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 2')
cy.get('.textarea').type('description textArea')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 3')
cy.get('.textarea').type('description textArea')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 4')
cy.get('.textarea').type('description textArea')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 5')
cy.get('.textarea').type('description textArea')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 6')
cy.get('.textarea').type('description textArea')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 7')
cy.get('.textarea').type('description textArea')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 8')
cy.get('.textarea').type('description textArea')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 9')
cy.get('.textarea').type('description textArea')
cy.get('#tainacan-select-status-publish > .check').click()
cy.get(':nth-child(2) > .button').click()
cy.get('.field > :nth-child(2) > :nth-child(2)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 10')
cy.get('.textarea').type('description textArea')
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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area >').should('contain', 'Model')
.and('contain', 'Color edited')
.and('contain', 'Motor disebled')
.and('contain', 'TextArea Private')
.and('not.contain', 'Blank')
.and('contain', 'Brand')
.and('contain', 'Steering Type')
.and('not.contain', 'TextArea name canceled')
.and('contain', 'TextArea name public required')
.and('contain', 'TextArea name public multiple values')
.and('contain', 'TextArea name public unique values')
.and('contain', 'TextArea 1')
.and('contain', 'TextArea 2')
.and('contain', 'TextArea 3')
.and('contain', 'TextArea 4')
.and('contain', 'TextArea 5')
.and('contain', 'TextArea 6')
.and('contain', 'TextArea 7')
.and('contain', 'TextArea 8')
.and('contain', 'TextArea 9')
.and('contain', 'TextArea 10')
})
})
})

View File

@ -1,460 +0,0 @@
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.location('hash').should('eq', '#/collections')
cy.get('#button-create-collection').click()
cy.get('#tainacan-text-name').type('Book Text Fields')
cy.get('#tainacan-text-description').type('Description 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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.contains('Actor')
})
it('create location field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.contains('Location')
})
it('edit location field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get(':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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.contains('Denomination')
cy.get(':nth-child(5) > .handle > .controls > :nth-child(3) > .icon > .mdi').click()
cy.get('.handle > .field-name').should('not.eq', 'Denomination')
})
it('check not contain denomination field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.handle > .field-name').should('not.eq', 'Denomination')
})
})
context('Diseble text field', function(){
it('create record field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Record disebled')
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 disebled')
})
it('disebled record field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get(':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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area > :nth-child(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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area').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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text 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', 'Text Private')
})
it('check create private field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area > :nth-child(6) > .handle > .field-name').should('contain', 'Text 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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.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('check that Not Saved label wasnt inserted, and changes were lost', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.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.get('[draggable="false"]').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.get('[draggable="false"]').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.get('[draggable="false"]').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.get('[draggable="false"]').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.get('[draggable="false"]').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.get('[draggable="false"]').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.get('[draggable="false"]').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.get('[draggable="false"]').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.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.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area >').should('contain', 'Actor')
.and('contain', 'Location edited')
.and('contain', 'Record disebled')
.and('contain', 'Text 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

@ -1,257 +0,0 @@
describe('Item tests', function () {
beforeEach(() => {
cy.loginByUI()
})
it('clear DB', function(){
cy.clearDB()
})
it('create collection for crud items', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-create-collection').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type('Book Items')
cy.get('#tainacan-text-description').type('description book items')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('contain', 'Book Items')
})
context('CRUD items', function(){
it('canceled create item', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('#button-create-item').click()
cy.get('#tainacan-text-title').type('Item canceled')
cy.get('#tainacan-textarea-description').type('Item canceled description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-cancel-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('not.contain', 'Item canceled')
})
it('create item with status publish', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('#button-create-item').click()
cy.get('#tainacan-text-title').type('Item publish')
cy.get('#tainacan-textarea-description').type('Item publish description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item publish')
})
it('create item with status private', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('#button-create-item').click()
cy.get('#tainacan-text-title').type('Item private')
cy.get('#tainacan-textarea-description').type('Item private description')
cy.get('#status-select').select('Private').should('have.value', 'private')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item private')
})
it('create item with status draft', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('#button-create-item').click()
cy.get('#tainacan-text-title').type('Item draft')
cy.get('#tainacan-textarea-description').type('Item draft description')
cy.get('#status-select').select('Draft').should('have.value', 'draft')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('not.contain', 'Item draft')
})
it('create item with status trash', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('#button-create-item').click()
cy.get('#tainacan-text-title').type('Item trash')
cy.get('#tainacan-textarea-description').type('Item trash description')
cy.get('#status-select').select('Trash').should('have.value', 'trash')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('not.contain', 'Item trash')
})
it('delete item', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('#button-create-item').click()
cy.get('#tainacan-text-title').type('Item delete')
cy.get('#tainacan-textarea-description').type('Item delete description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item delete')
cy.get(':nth-child(1) > [data-label="Actions"] > :nth-child(1) > #button-delete > .icon > .mdi').click()
cy.get('.modal-card').should('have.class', 'animation-content')
cy.get('.is-primary').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('not.contain', 'Item delete')
})
})
context('Create many collections for verify persistence the datas', function(){
it('create many items', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('#button-create-item').click()
cy.get('#tainacan-text-title').type('Item 1')
cy.get('#tainacan-textarea-description').type('Item 1 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 1')
cy.get('#button-create-item').click()
cy.get('#tainacan-text-title').type('Item 2')
cy.get('#tainacan-textarea-description').type('Item 2 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 2')
cy.get('#button-create-item').click()
cy.get('#tainacan-text-title').type('Item 3')
cy.get('#tainacan-textarea-description').type('Item 3 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 3')
cy.get('#button-create-item').click()
cy.get('#tainacan-text-title').type('Item 4')
cy.get('#tainacan-textarea-description').type('Item 4 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 4')
cy.get('#button-create-item').click()
cy.get('#tainacan-text-title').type('Item 5')
cy.get('#tainacan-textarea-description').type('Item 5 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 5')
cy.get('#button-create-item').click()
cy.get('#tainacan-text-title').type('Item 6')
cy.get('#tainacan-textarea-description').type('Item 6 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 6')
cy.get('#button-create-item').click()
cy.get('#tainacan-text-title').type('Item 7')
cy.get('#tainacan-textarea-description').type('Item 7 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 7')
cy.get('#button-create-item').click()
cy.get('#tainacan-text-title').type('Item 8')
cy.get('#tainacan-textarea-description').type('Item 8 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 8')
cy.get('#button-create-item').click()
cy.get('#tainacan-text-title').type('Item 9')
cy.get('#tainacan-textarea-description').type('Item 9 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 9')
cy.get('#button-create-item').click()
cy.get('#tainacan-text-title').type('Item 10')
cy.get('#tainacan-textarea-description').type('Item 10 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 10')
cy.get('#button-create-item').click()
cy.get('#tainacan-text-title').type('Item 11')
cy.get('#tainacan-textarea-description').type('Item 11 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 11')
cy.get('#button-create-item').click()
cy.get('#tainacan-text-title').type('Item 12')
cy.get('#tainacan-textarea-description').type('Item 12 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 12')
cy.get('#button-create-item').click()
cy.get('#tainacan-text-title').type('Item 13')
cy.get('#tainacan-textarea-description').type('Item 13 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 13')
cy.get('#button-create-item').click()
cy.get('#tainacan-text-title').type('Item 14')
cy.get('#tainacan-textarea-description').type('Item 14 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 14')
cy.get('#button-create-item').click()
cy.get('#tainacan-text-title').type('Item 15')
cy.get('#tainacan-textarea-description').type('Item 15 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 15')
})
})
context('Check all items', function(){
it('check if collections are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.location('hash').should('eq', '#/collections')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.field-body > .field > .control > .select > select').select('24').should('have.value', '24')
cy.get('.table').should('contain', 'Item publish')
.and('contain', 'Item private')
.and('not.contain', 'Item draft')
.and('not.contain', 'Item trash')
.and('contain', 'Item 1')
.and('contain', 'Item 2')
.and('contain', 'Item 3')
.and('contain', 'Item 4')
.and('contain', 'Item 5')
.and('contain', 'Item 6')
.and('contain', 'Item 7')
.and('contain', 'Item 8')
.and('contain', 'Item 9')
.and('contain', 'Item 10')
.and('contain', 'Item 11')
.and('contain', 'Item 12')
.and('contain', 'Item 13')
.and('contain', 'Item 14')
.and('contain', 'Item 15')
})
})
})

View File

@ -1,17 +0,0 @@
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}

View File

@ -1,86 +0,0 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add("login", (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This is will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
Cypress.Commands.add('loginByForm', (username, password) => {
Cypress.log({
name: 'loginByRequest',
message: username + ' | ' + password
})
cy.request('/wp-admin')
cy.get('title').should('contain', 'Log In Test — WordPress')
cy.request({
method: 'POST',
url: '/wp-login.php',
form: true,
body: {
log: username,
pwd: password
}
})
cy.get('h1').should('contain', 'Dashboard')
cy.getCookie('cypress-session-cookie').should('exist')
})
Cypress.Commands.add('loginByRequest', () => {
Cypress.log({
name: 'loginByRequest',
message: 'admin' + ' | ' + 'admin'
})
cy.request({
method: 'POST',
url: '/login',
form: true,
body: {
log: 'admin',
pwd: 'admin'
}
})
// we should be redirected to /wp-admin
cy.url().should('include', '/wp-admin')
cy.get('h1').should('contain', 'Dashboard')
cy.getCookie('cypress-session-cookie').should('exist')
})
Cypress.Commands.add('loginByUI', () => {
cy.visit('/wp-admin')
cy.get('input[name=log]').type('admin')
cy.get('input[name=pwd]').type('admin{enter}')
// we should be redirected to /wp-admin
cy.url().should('include', '/wp-admin')
cy.get('h1').should('contain', 'Dashboard')
})
Cypress.Commands.add('clearDB', () => {
cy.request('POST', '/wp-json/tainacan/v2/database')
})

View File

@ -1,20 +0,0 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')

View File

@ -1,60 +0,0 @@
#!/bin/bash
if [ $# -lt 1 ]; then
echo -e "* Enter <OPTION> 1 to open the cypress test suite.\n* Enter <OPTION> 2 to run all headless tests on the temrinal.\n* Enter <OPTION> 3 to run a specific test class, and enter the <PATH> for the class you want from cypress/integration/repository/<PATH>."
exit 1
fi
OPTION=$1
source build-config.cfg
./build.sh
plugin_tainacan=`basename $wp_plugin_dir`
plugin_wpclear='wpress-db-cleaner'
test_db_prefix='wptests_'
cy_record_key='a15e6599-d240-4d98-b582-dea93a3008c0'
################# set up cypress environment
# replace table prefix in wp_config
echo "Changing DB prefix in wp_config..."
sed -i s/"require_once(ABSPATH . 'wp-settings.php');"/"\$table_prefix = '$test_db_prefix';\nrequire_once(ABSPATH . 'wp-settings.php');"/ $wp_base_dir/wp-config.php
# install WordPress
cd $wp_base_dir
echo "Installing WordPress..."
wp core install --url=$wp_url --title=Test --admin_user=admin --admin_password=admin --admin_email=admin@admin.com
# Activate Tainacan
wp plugin activate $plugin_tainacan $plugin_wpclear
# Add options wpress plugin_wpclear
wp option add api_namespace tainacan/v2
wp option add wpress_prefix $test_db_prefix
# back to tainacan dev directory
cd -
# cypress beginning
if [ "$OPTION" == "1" ]; then
./node_modules/.bin/cypress open --config baseUrl=$wp_url
elif [ "$OPTION" == "2" ]; then
./node_modules/.bin/cypress run --config baseUrl=$wp_url --record --key $cy_record_key
elif [ "$OPTION" == "3" ] && [ -n "$2" ]; then
UNIQUE_SPEC=cypress/integration/repository/${2}
./node_modules/.bin/cypress run --spec $UNIQUE_SPEC --config baseUrl=$wp_url
else
echo -e "\nThe parameters provided are invalid\n"
fi
################## teardown cypress environment
# remove WordPress
echo "Removing WordPress..."
cd $wp_base_dir/
wp db query "DROP TABLES $(wp db tables | paste -s -d, -);"
# recover table prefix in wp_config
echo "Restoring DB prefix in wp_config..."
sed -i s/"\$table_prefix = '$test_db_prefix';"/test/ $wp_base_dir/wp-config.php
sed -i '/test/d' $wp_base_dir/wp-config.php

View File

@ -2,7 +2,3 @@
echo "Running unit tests in PHPUnit..." echo "Running unit tests in PHPUnit..."
phpunit phpunit
echo "Running integration tests headless in Crypess..."
# the value 0 leaves the cypress headless
./run-cypress.sh 2