Merge branch 'develop' of https://github.com/tainacan/tainacan into develop

This commit is contained in:
weryques 2018-04-11 08:44:56 -03:00
commit e5341719dc
38 changed files with 1378 additions and 824 deletions

View File

@ -0,0 +1,107 @@
describe('Category test', function () {
beforeEach(() => {
cy.loginByUI()
})
it('clear DB', function(){
cy.clearDB()
})
context('CRUD Taxonomies', function(){
it('canceled create category', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/categories')
cy.location('hash').should('eq', '#/categories')
//cy.get('#button-category-creation').click()
cy.get('.button').click()
cy.location('hash').should('eq', '#/categories/new')
cy.get('#tainacan-text-name').type('Category canceled')
cy.get('#tainacan-text-description').type('description category canceled')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-cancel-category-creation').click()
cy.location('hash').should('eq', '#/categories/')
cy.get('td').should('not.contain', 'Book canceled')
})
// it('create category with status publish', function(){
// cy.visit('/wp-admin/admin.php?page=tainacan_admin#/categories')
// cy.location('hash').should('eq', '#/categories')
// //cy.get('#button-category-creation').click()
// cy.get('.button').click()
// cy.location('hash').should('eq', '#/categories/new')
// cy.get('#tainacan-text-name').type('Category publish')
// cy.get('#tainacan-text-description').type('description category publish')
// cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
// cy.get('#button-submit-category-creation').click()
// cy.location('hash').should('eq', '#/categories/')
// cy.get('td').should('contain', 'Category publish')
// })
//
// it('create category with status private', function(){
// cy.visit('/wp-admin/admin.php?page=tainacan_admin#/categories')
// cy.location('hash').should('eq', '#/categories')
// //cy.get('#button-category-creation').click()
// cy.get('.button').click()
// cy.location('hash').should('eq', '#/categories/new')
// cy.get('#tainacan-text-name').type('Category private')
// cy.get('#tainacan-text-description').type('description category private')
// cy.get('#tainacan-select-status').select('Private').should('have.value', 'private')
// cy.get('#button-submit-category-creation').click()
// cy.location('hash').should('eq', '#/categories/')
// cy.get('td').should('contain', 'Category private')
// })
//
// it('create category with status draft', function(){
// cy.visit('/wp-admin/admin.php?page=tainacan_admin#/categories')
// cy.location('hash').should('eq', '#/categories')
// //cy.get('#button-category-creation').click()
// cy.get('.button').click()
// cy.location('hash').should('eq', '#/categories/new')
// cy.get('#tainacan-text-name').type('Category draft')
// cy.get('#tainacan-text-description').type('description category draft')
// cy.get('#tainacan-select-status').select('Draft').should('have.value', 'draft')
// cy.get('#button-submit-category-creation').click()
// cy.location('hash').should('eq', '#/categories/')
// cy.get('td').should('not.contain', 'Category draft')
// })
//
// it('create category with status draft', function(){
// cy.visit('/wp-admin/admin.php?page=tainacan_admin#/categories')
// cy.location('hash').should('eq', '#/categories')
// //cy.get('#button-category-creation').click()
// cy.get('.button').click()
// cy.location('hash').should('eq', '#/categories/new')
// cy.get('#tainacan-text-name').type('Category trash')
// cy.get('#tainacan-text-description').type('description category trash')
// cy.get('#tainacan-select-status').select('Trash').should('have.value', 'trash')
// cy.get('#button-submit-category-creation').click()
// cy.location('hash').should('eq', '#/categories/')
// cy.get('td').should('not.contain', 'Category trash')
// })
//
// it('create category color', function(){
// cy.visit('/wp-admin/admin.php?page=tainacan_admin#/categories')
// cy.location('hash').should('eq', '#/categories')
// //cy.get('#button-category-creation').click()
// cy.get('.button').click()
// cy.location('hash').should('eq', '#/categories/new')
// cy.get('#tainacan-text-name').type('Category color')
// cy.get('#tainacan-text-description').type('description category color')
// cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
// cy.get('#button-submit-category-creation').click()
// cy.location('hash').should('eq', '#/categories/')
// cy.get('td').should('contain', 'Category color')
// })
//
// it('delete category color', function(){
// cy.visit('/wp-admin/admin.php?page=tainacan_admin#/categories')
// cy.location('hash').should('eq', '#/categories')
// cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
// cy.get('.b-table').should('contain', 'Category 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', 'Category trash')
// })
})
})

View File

@ -1,4 +1,4 @@
describe('Tainacan Plugin Test', function () {
describe('Collection test', function () {
beforeEach(() => {
cy.loginByUI()
})
@ -7,80 +7,91 @@ describe('Tainacan Plugin Test', function () {
cy.clearDB()
})
context('Collections', function(){
context('CRUD collections', function(){
it('canceled collection', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-collection-creation').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.url().should('contain', '/wp-admin/admin.php?page=tainacan_admin#/collections/')
cy.get('h1').should('contain', 'Collections Page')
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.get('h1').should('contain', 'Collections Page')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-collection-creation').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.get('h1').should('contain', 'Collections Page')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-collection-creation').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.get('h1').should('contain', 'Collections Page')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-collection-creation').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.get('.b-table').should('contain', 'Book draft')
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.get('h1').should('contain', 'Collections Page')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-collection-creation').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.get('.b-table').should('contain', 'Book trash')
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.get('h1').should('contain', 'Collections Page')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-collection-creation').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')
})
})
@ -88,111 +99,141 @@ describe('Tainacan Plugin Test', function () {
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.get('h1').should('contain', 'Collections Page')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-collection-creation').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-collection-creation').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-collection-creation').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-collection-creation').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-collection-creation').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-collection-creation').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-collection-creation').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-collection-creation').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-collection-creation').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-collection-creation').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-collection-creation').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-collection-creation').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-collection-creation').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-collection-creation').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-collection-creation').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')
})
})
@ -200,11 +241,12 @@ describe('Tainacan Plugin Test', function () {
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.get('h1').should('contain', 'Collections Page')
cy.get('.active-fields-area >').should('contain', 'Book publish')
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('contain', 'Book draft')
.and('contain', 'Book trash')
.and('not.contain', 'Book draft')
.and('not.contain', 'Book trash')
.and('contain', 'Book 1')
.and('contain', 'Book 2')
.and('contain', 'Book 3')

View File

@ -1,4 +1,4 @@
context('create category-type fields tests', function(){
context('Category field test', function(){
beforeEach(() => {
cy.loginByUI()
})
@ -9,8 +9,8 @@ context('create category-type fields tests', function(){
it('create collection for create fields', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.contains('New Collection').click()
cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')})
cy.get('#button-collection-creation').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')
@ -21,7 +21,7 @@ context('create category-type fields tests', function(){
it('create taxonomies for create relationship', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')})
cy.get(':nth-child(8) > a > .menu-text').click()
cy.get('.button').click()
cy.get('#tainacan-text-name').type('Cat 1')
@ -62,7 +62,7 @@ context('create category-type fields tests', function(){
it('canceled create category-type field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -78,7 +78,7 @@ context('create category-type fields tests', function(){
it('create category-type field public - input type = radio', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -96,7 +96,7 @@ context('create category-type fields tests', function(){
it('create category-type field public - input type = selectbox', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -114,7 +114,7 @@ context('create category-type fields tests', function(){
it('create category-type field private', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -132,7 +132,7 @@ context('create category-type fields tests', function(){
it('create category-type field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -150,7 +150,7 @@ context('create category-type fields tests', function(){
it('create category-type field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -168,7 +168,7 @@ context('create category-type fields tests', function(){
it('create category-type field public unique values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -186,7 +186,7 @@ context('create category-type fields tests', function(){
it('check if fields are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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(7) > a').click()

View File

@ -9,7 +9,7 @@ describe('Date field test', function() {
it('create collection for create fields', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')})
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Date Fields')
cy.get('#tainacan-text-description').type('Description Date Fields')
@ -22,7 +22,7 @@ describe('Date field test', function() {
context('CRUD date field', function(){
it('create submission date field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -37,7 +37,7 @@ describe('Date field test', function() {
it('check create submission date field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -47,7 +47,7 @@ describe('Date field test', function() {
it('create year of manufacture field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -62,7 +62,7 @@ describe('Date field test', function() {
it('check create year of manufacture field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -72,7 +72,7 @@ describe('Date field test', function() {
it('edit year of manufacture field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -87,7 +87,7 @@ describe('Date field test', function() {
it('create year field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -102,7 +102,7 @@ describe('Date field test', function() {
it('delete year field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -114,7 +114,7 @@ describe('Date field test', function() {
it('check not contain year field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -126,7 +126,7 @@ describe('Date field test', function() {
context('Diseble date field', function(){
it('create purchase day field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -141,7 +141,7 @@ describe('Date field test', function() {
it('disebled purchase day field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -152,7 +152,7 @@ describe('Date field test', function() {
it('check disebled purchase day field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -164,7 +164,7 @@ describe('Date field test', function() {
context('Check required fields', function(){
it('create blank field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -184,7 +184,7 @@ describe('Date field test', function() {
it('check not contain blank field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -196,7 +196,7 @@ describe('Date field test', function() {
context('Create date field private', function(){
it('create date private field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -211,7 +211,7 @@ describe('Date field test', function() {
it('check create date private field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -225,7 +225,7 @@ describe('Date field test', function() {
context('"Not saved" label vs. "cancel button"', function(){
it('create warranty field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -240,7 +240,7 @@ describe('Date field test', function() {
it('check that Not Saved label wasnt inserted, and changes were lost', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -257,7 +257,7 @@ describe('Date field test', function() {
it('check if the message “Not Saved” appeared next to the field name', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -283,7 +283,7 @@ describe('Date field test', 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.get('h1').should('contain', 'Collections Page')
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()
@ -298,7 +298,7 @@ describe('Date field test', function() {
it('create date-type field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -314,7 +314,7 @@ describe('Date field test', function() {
it('create date-type field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -330,7 +330,7 @@ describe('Date field test', function() {
it('create date-type field public unique values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -348,7 +348,7 @@ describe('Date field test', function() {
context('Leave page without saving field editions', function(){
it('Leave page without saving field editions', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -370,7 +370,7 @@ describe('Date field test', function() {
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.get('h1').should('contain', 'Collections Page')
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()
@ -429,7 +429,7 @@ describe('Date field test', function() {
it('check if fields are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()

View File

@ -9,8 +9,7 @@ describe('Numeric field test', function() {
it('create collection for create fields', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.contains('New Collection').click()
cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')})
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Numeric Fields')
cy.get('#tainacan-text-description').type('Description Numeric Fields')
@ -23,7 +22,7 @@ describe('Numeric field test', function() {
context('CRUD numeric field', function(){
it('create counter field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -38,7 +37,7 @@ describe('Numeric field test', function() {
it('check create counter field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -48,7 +47,7 @@ describe('Numeric field test', function() {
it('create code field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -63,7 +62,7 @@ describe('Numeric field test', function() {
it('check create code field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -73,7 +72,7 @@ describe('Numeric field test', function() {
it('edit code field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -88,7 +87,7 @@ describe('Numeric field test', function() {
it('create number field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -103,7 +102,7 @@ describe('Numeric field test', function() {
it('delete number field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -115,7 +114,7 @@ describe('Numeric field test', function() {
it('check not contain year field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -127,7 +126,7 @@ describe('Numeric field test', function() {
context('Diseble numeric field', function(){
it('create registration number field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -142,7 +141,7 @@ describe('Numeric field test', function() {
it('disebled registration number field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -153,7 +152,7 @@ describe('Numeric field test', function() {
it('check disebled registration number field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -165,7 +164,7 @@ describe('Numeric field test', function() {
context('Check required fields', function(){
it('create blank field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -185,7 +184,7 @@ describe('Numeric field test', function() {
it('check not contain blank field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -197,7 +196,7 @@ describe('Numeric field test', function() {
context('Create numeric field private', function(){
it('create date private field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -205,29 +204,28 @@ describe('Numeric field test', function() {
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-publish > .check').click()
//cy.get('#tainacan-select-status-private > .check').click()
cy.get('#tainacan-select-status-private > .check').click()
cy.get(':nth-child(2) > .button').click()
//cy.get('.active-fields-area >').should('contain', 'Numeric private')
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.get('h1').should('contain', 'Collections Page')
// cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
// cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
// cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
// cy.get('h1').should('contain', 'Collection Fields Edition Page')
// cy.get('.active-fields-area > :nth-child(6) > .handle > .field-name').should('contain', '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')
// })
it('check create numeric 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', '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.get('h1').should('contain', 'Collections Page')
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()
@ -242,7 +240,7 @@ describe('Numeric field test', function() {
it('check that Not Saved label wasnt inserted, and changes were lost', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -259,7 +257,7 @@ describe('Numeric field test', function() {
it('check if the message “Not Saved” appeared next to the field name', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -285,7 +283,7 @@ describe('Numeric field test', 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.get('h1').should('contain', 'Collections Page')
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()
@ -300,7 +298,7 @@ describe('Numeric field test', function() {
it('create numeric-type field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -316,7 +314,7 @@ describe('Numeric field test', function() {
it('create numeric-type field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -332,7 +330,7 @@ describe('Numeric field test', function() {
it('create numeric-type field public unique values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -350,7 +348,7 @@ describe('Numeric field test', function() {
context('Leave page without saving field editions', function(){
it('Leave page without saving field editions', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -372,7 +370,7 @@ describe('Numeric field test', function() {
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.get('h1').should('contain', 'Collections Page')
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()
@ -431,7 +429,7 @@ describe('Numeric field test', function() {
it('check if fields are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()

View File

@ -1,4 +1,4 @@
context('create relationship-type fields tests', function(){
context('Relationship field test', function(){
beforeEach(() => {
cy.loginByUI()
})
@ -9,8 +9,8 @@ context('create relationship-type fields tests', function(){
it('create collection for create fields', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.contains('New Collection').click()
cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')})
cy.get('#button-collection-creation').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')
@ -21,7 +21,7 @@ context('create relationship-type fields tests', function(){
it('create collection for create relationship', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.location().should((loc) => {expect(loc.hash).to.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')
@ -33,7 +33,7 @@ context('create relationship-type fields tests', function(){
it('canceled create relationship-type field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.location().should((loc) => {expect(loc.hash).to.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()
@ -49,7 +49,7 @@ context('create relationship-type fields tests', function(){
it('create relationship-type field public', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.location().should((loc) => {expect(loc.hash).to.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()
@ -68,7 +68,7 @@ context('create relationship-type fields tests', function(){
it('create relationship-type field private', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.location().should((loc) => {expect(loc.hash).to.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()
@ -87,7 +87,7 @@ context('create relationship-type fields tests', function(){
it('create relationship-type field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.location().should((loc) => {expect(loc.hash).to.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()
@ -107,7 +107,7 @@ context('create relationship-type fields tests', function(){
it('create relationship-type field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.location().should((loc) => {expect(loc.hash).to.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()
@ -127,7 +127,7 @@ context('create relationship-type fields tests', function(){
it('create relationship-type field public unique values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.location().should((loc) => {expect(loc.hash).to.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()
@ -147,7 +147,7 @@ context('create relationship-type fields tests', function(){
it('check if fields are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.location().should((loc) => {expect(loc.hash).to.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()

View File

@ -0,0 +1,486 @@
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().should((loc) => {expect(loc.hash).to.eq('#/collections')})
cy.get('#button-collection-creation').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().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('.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().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.contains('Reviewed')
})
it('create edited 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('.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().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.contains('Edited')
})
it('edit edited 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(':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().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('.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().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.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().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('.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().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('.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().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(':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().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(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().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('.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().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').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().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('.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-publish > .check').click()
//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().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('.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().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(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().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('.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().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('.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().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('.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().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('.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().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('.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().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('.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().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('.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().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 >').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

@ -9,7 +9,7 @@ describe('TextArea field test', function() {
it('create collection for create fields', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')})
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('TextArea Fields')
cy.get('#tainacan-text-description').type('Description TextArea Fields')
@ -22,7 +22,7 @@ describe('TextArea field test', function() {
context('CRUD textArea field', function(){
it('create model field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -37,7 +37,7 @@ describe('TextArea field test', function() {
it('check create model field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -47,7 +47,7 @@ describe('TextArea field test', function() {
it('create color field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -62,7 +62,7 @@ describe('TextArea field test', function() {
it('check create color field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -72,7 +72,7 @@ describe('TextArea field test', function() {
it('edit color field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -87,7 +87,7 @@ describe('TextArea field test', function() {
it('create door field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -102,7 +102,7 @@ describe('TextArea field test', function() {
it('delete door field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -114,7 +114,7 @@ describe('TextArea field test', function() {
it('check not contain door field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -126,7 +126,7 @@ describe('TextArea field test', function() {
context('Diseble textArea field', function(){
it('create motor field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -141,7 +141,7 @@ describe('TextArea field test', function() {
it('disebled motor field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -152,7 +152,7 @@ describe('TextArea field test', function() {
it('check disebled motor field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -164,7 +164,7 @@ describe('TextArea field test', function() {
context('Check required fields', function(){
it('create blank field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -184,7 +184,7 @@ describe('TextArea field test', function() {
it('check not contain blank field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -196,7 +196,7 @@ describe('TextArea field test', function() {
context('Create textArea field private', function(){
it('create private field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -211,7 +211,7 @@ describe('TextArea field test', function() {
it('check create private field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -225,7 +225,7 @@ describe('TextArea field test', function() {
context('"Not saved" label vs. "cancel button"', function(){
it('create brand field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -240,7 +240,7 @@ describe('TextArea field test', function() {
it('check that Not Saved label wasnt inserted, and changes were lost', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -257,7 +257,7 @@ describe('TextArea field test', function() {
it('check if the message “Not Saved” appeared next to the field name', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -283,7 +283,7 @@ describe('TextArea field test', 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.get('h1').should('contain', 'Collections Page')
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()
@ -298,7 +298,7 @@ describe('TextArea field test', function() {
it('create textArea-type field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -314,7 +314,7 @@ describe('TextArea field test', function() {
it('create textArea-type field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -330,7 +330,7 @@ describe('TextArea field test', function() {
it('create textArea-type field public unique values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -348,7 +348,7 @@ describe('TextArea field test', function() {
context('Leave page without saving field editions', function(){
it('Leave page without saving field editions', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -370,7 +370,7 @@ describe('TextArea field test', function() {
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.get('h1').should('contain', 'Collections Page')
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()
@ -438,7 +438,7 @@ describe('TextArea field test', function() {
it('check if fields are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()

View File

@ -9,7 +9,7 @@ describe('Text field test', function() {
it('create collection for create fields', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')})
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book Text Fields')
cy.get('#tainacan-text-description').type('Description book Fields')
@ -22,7 +22,7 @@ describe('Text field test', function() {
context('CRUD text field', function(){
it('create actor field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -37,7 +37,7 @@ describe('Text field test', function() {
it('check create actor field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -47,7 +47,7 @@ describe('Text field test', function() {
it('create location field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -62,7 +62,7 @@ describe('Text field test', function() {
it('check create location field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -72,7 +72,7 @@ describe('Text field test', function() {
it('edit location field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -87,7 +87,7 @@ describe('Text field test', function() {
it('create denomination field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -102,7 +102,7 @@ describe('Text field test', function() {
it('delete denomination field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -114,7 +114,7 @@ describe('Text field test', function() {
it('check not contain denomination field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -126,7 +126,7 @@ describe('Text field test', function() {
context('Diseble text field', function(){
it('create record field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -141,7 +141,7 @@ describe('Text field test', function() {
it('disebled record field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -152,7 +152,7 @@ describe('Text field test', function() {
it('check disebled record field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -164,7 +164,7 @@ describe('Text field test', function() {
context('Check required fields', function(){
it('create blank field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -184,7 +184,7 @@ describe('Text field test', function() {
it('check not contain blank field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -196,13 +196,13 @@ describe('Text field test', function() {
context('Create text field private', function(){
it('create private field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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('.field > :nth-child(2) > :nth-child(1)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text Text Private')
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()
@ -211,7 +211,7 @@ describe('Text field test', function() {
it('check create private field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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()
@ -225,7 +225,7 @@ describe('Text field test', function() {
context('"Not saved" label vs. "cancel button"', function(){
it('create denomination field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -240,7 +240,7 @@ describe('Text field test', function() {
it('check that Not Saved label wasnt inserted, and changes were lost', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -257,7 +257,7 @@ describe('Text field test', function() {
it('check if the message “Not Saved” appeared next to the field name', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -283,7 +283,7 @@ describe('Text field test', function() {
context('create text-type fields tests', function(){
it('canceled create text field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -298,7 +298,7 @@ describe('Text field test', function() {
it('create text-type field public required', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -314,7 +314,7 @@ describe('Text field test', function() {
it('create text-type field public multiple values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -330,7 +330,7 @@ describe('Text field test', function() {
it('create text-type field public unique values', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -348,7 +348,7 @@ describe('Text field test', function() {
context('Leave page without saving field editions', function(){
it('Leave page without saving field editions', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -370,7 +370,7 @@ describe('Text field test', function() {
context('Field loading for paging and persistence testing', function(){
it('create texts fields', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()
@ -438,7 +438,7 @@ describe('Text field test', function() {
it('check if fields are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.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()

View File

@ -1,4 +1,4 @@
describe('Tainacan Plugin Test', function () {
describe('Item tests', function () {
beforeEach(() => {
cy.loginByUI()
})
@ -7,27 +7,45 @@ describe('Tainacan Plugin Test', function () {
cy.clearDB()
})
it('create collection for crud items', function(){
Cypress.Commands.add('createCollection', (name) => {
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
//cy.get('#button-collection-creation').click()
cy.contains('New Collection').click()
cy.get('#tainacan-text-name').type('Book Items')
cy.get('#tainacan-text-description').type('description book items')
cy.location('hash').should('eq', '#/collections')
cy.get('#button-collection-creation').click()
cy.location('hash').should('eq', '#/collections/new')
cy.get('#tainacan-text-name').type(name)
cy.get('#tainacan-text-description').type('description'+name)
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.get('.b-table').should('contain', 'Book Items')
cy.location('hash').should('eq', '#/collections')
cy.get('.b-table').should('contain', name)
})
context('Items', function(){
it('create collection', function(){
cy.createCollection('Book itens')
})
// 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-collection-creation').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.get('h1').should('contain', 'Collections Page')
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-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#button-item-creation').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')
@ -38,11 +56,10 @@ describe('Tainacan Plugin Test', function () {
it('create item with status publish', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#button-item-creation').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')
@ -53,11 +70,10 @@ describe('Tainacan Plugin Test', function () {
it('create item with status private', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#button-item-creation').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')
@ -68,41 +84,38 @@ describe('Tainacan Plugin Test', function () {
it('create item with status draft', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#button-item-creation').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('contain', 'Item draft')
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.get('h1').should('contain', 'Collections Page')
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-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#button-item-creation').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('contain', 'Item trash')
cy.get('.b-table').should('not.contain', 'Item trash')
})
it('delete item', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
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-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#button-item-creation').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')
@ -120,123 +133,108 @@ describe('Tainacan Plugin Test', function () {
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.get('h1').should('contain', 'Collections Page')
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-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#button-item-creation').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-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#button-item-creation').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-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#button-item-creation').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-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#button-item-creation').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-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#button-item-creation').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-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#button-item-creation').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-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#button-item-creation').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-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#button-item-creation').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-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#button-item-creation').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-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#button-item-creation').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-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#button-item-creation').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-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#button-item-creation').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-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#button-item-creation').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-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#button-item-creation').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-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#button-item-creation').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')
@ -249,13 +247,14 @@ describe('Tainacan Plugin Test', function () {
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.get('h1').should('contain', 'Collections Page')
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('.active-fields-area >').should('contain', 'Item publish')
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('contain', 'Item draft')
.and('contain', 'Item trash')
.and('not.contain', 'Item draft')
.and('not.contain', 'Item trash')
.and('contain', 'Item 1')
.and('contain', 'Item 2')
.and('contain', 'Item 3')

View File

@ -1,471 +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.get('h1').should('contain', 'Collections Page')
cy.contains('New Collection').click()
//cy.get('#button-collection-creation').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.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').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.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.contains('Reviewed')
})
it('create edited field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(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.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.contains('Edited')
})
it('edit edited field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get(':nth-child(4) > .handle > .controls > :nth-child(2) > .icon > .mdi').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('Edited 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.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').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.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.contains('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.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.handle > .field-name').should('not.eq', 'itsCool')
})
})
context('Diseble selectbox field', function(){
it('create verified field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(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.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get(':nth-child(5) > .handle > .controls > .switch > .check').click()
cy.get('.active-fields-area > :nth-child(5)').should('have.class', 'disabled-field')
})
it('check disebled verified field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area > :nth-child(5)').should('have.class', 'disabled-field')
})
})
context('Check required fields', function(){
it('create blank field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(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(':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.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area').should('not.contain', 'Blank')
})
})
context('Create selectbox field private', function(){
it('create selectbox private field', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(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-publish > .check').click()
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.get('h1').should('contain', 'Collections Page')
// cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
// cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
// cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
// cy.get('h1').should('contain', 'Collection Fields Edition Page')
// cy.get('.active-fields-area > :nth-child(6) > .handle > .field-name').should('contain', '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.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').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.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.active-fields-area > :nth-child(7) > .handle > .field-name').should('contain', '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('yes{enter}no')
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.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
cy.get('h1').should('contain', 'Collection Fields Edition Page')
cy.get('.field > :nth-child(2) > :nth-child(5)').click()
cy.get('#fieldEditForm > :nth-child(1) > .control > .input').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(':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 date-types fields tests', function(){
// it('canceled create numeric field', function(){
// cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
// cy.get('h1').should('contain', 'Collections Page')
// cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
// cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
// cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
// cy.get('h1').should('contain', 'Collection Fields Edition Page')
// cy.get('.field > :nth-child(2) > :nth-child(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.get('h1').should('contain', 'Collections Page')
// cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
// cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
// cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
// cy.get('h1').should('contain', 'Collection Fields Edition Page')
// cy.get('.field > :nth-child(2) > :nth-child(4)').click()
// cy.get('#fieldEditForm > :nth-child(1) > .control > .input').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.get('h1').should('contain', 'Collections Page')
// cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
// cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
// cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
// cy.get('h1').should('contain', 'Collection Fields Edition Page')
// cy.get('.field > :nth-child(2) > :nth-child(4)').click()
// cy.get('#fieldEditForm > :nth-child(1) > .control > .input').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.get('h1').should('contain', 'Collections Page')
// cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
// cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
// cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
// cy.get('h1').should('contain', 'Collection Fields Edition Page')
// cy.get('.field > :nth-child(2) > :nth-child(4)').click()
// cy.get('#fieldEditForm > :nth-child(1) > .control > .input').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.get('h1').should('contain', 'Collections Page')
// cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
// cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
// cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
// cy.get('h1').should('contain', 'Collection Fields Edition Page')
// cy.get('.field > :nth-child(2) > :nth-child(4)').click()
// cy.get('#fieldEditForm > :nth-child(1) > .control > .input').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.get('h1').should('contain', 'Collections Page')
// cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
// cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
// cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
// cy.get('h1').should('contain', 'Collection Fields Edition Page')
// cy.get('.field > :nth-child(2) > :nth-child(4)').click()
// cy.get('#fieldEditForm > :nth-child(1) > .control > .input').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.get('h1').should('contain', 'Collections Page')
// cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
// cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
// cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click()
// cy.get('h1').should('contain', 'Collection Fields Edition Page')
// cy.get('.active-fields-area >').should('contain', 'Reviewed')
// .and('contain', 'Edited edited')
// .and('contain', 'Verified 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

@ -39,7 +39,8 @@ cd -
# cypress beginning
if [ ${SKIP_HEAD} = "0" ]
then
./node_modules/.bin/cypress run --config baseUrl=$wp_url --record --key $cy_record_key
# ./node_modules/.bin/cypress run --config baseUrl=$wp_url --record --key $cy_record_key
./node_modules/.bin/cypress run --spec cypress/integration/repository/collection/field/field_text_spec.js --config baseUrl=$wp_url
else
./node_modules/.bin/cypress open --config baseUrl=$wp_url
fi

View File

@ -59,7 +59,7 @@
.is-secondary-content {
padding: 0px;
margin: 78px auto 0 auto;
margin: $header-height auto 0 auto;
position: relative;
overflow-y: auto;
@ -68,6 +68,11 @@
overflow-y: visible;
}
}
.columns {
margin-left: 0px;
margin-right: 0px;
}
}
</style>

View File

@ -224,7 +224,7 @@ export default {
.catch((errors) => {
for (let error of errors.errors) {
for (let field of Object.keys(error)){
eventBus.errors.push({ field_id: attribute, errors: error[field]});
eventBus.errors.push({ field_id: field, errors: error[field]});
}
}
this.formErrorMessage = errors.error_message;

View File

@ -5,19 +5,17 @@
:class="{'secondary-page': onSecondaryPage}">
<div class="level-left">
<div class="level-item">
<h1 class="has-text-weight-bold is-uppercase has-text-tertiary"><b-icon
<h1 class="has-text-weight-bold is-uppercase"><b-icon
size="is-small"
:icon="currentIcon"/>{{ pageTitle }}</h1>
<nav class="breadcrumbs">
<router-link
class="has-text-tertiary"
tag="a"
:to="$routerHelper.getCollectionsPath()">{{ $i18n.get('repository') }}</router-link> >
<span
v-for="(pathItem, index) in arrayRealPath"
:key="index">
<router-link
class="has-text-tertiary"
tag="a"
:to="'/' + arrayRealPath.slice(0, index + 1).join('/')">
{{ arrayViewPath[index] }}
@ -28,11 +26,13 @@
</div>
</div>
<div class="level-right">
<a class="level-item">
<b-icon icon="magnify"/>
</a>
<a
class="level-item has-text-tertiary"
class="level-item"
:href="wordpressAdmin">
<b-icon
icon="wordpress"/>
<b-icon icon="wordpress"/>
</a>
</div>
</div>
@ -145,7 +145,7 @@ export default {
// Tainacan Header
#tainacan-header {
background-color: $primary;
background-color: $secondary;
height: $header-height;
max-height: $header-height;
width: 100%;
@ -156,6 +156,7 @@ export default {
right: 0;
position: absolute;
z-index: 9;
color: white;
.icon {
padding-right: 1.3em;
@ -174,7 +175,7 @@ export default {
}
&.secondary-page {
.level-item {
margin-left: 310px;
margin-left: 87px;
}
}

View File

@ -33,7 +33,9 @@
:aria-label="$i18n.get('label_collection_fields')">
<b-icon
size="is-small"
icon="file-multiple"/> <span class="menu-text">{{ $i18n.getFrom('items', 'name') }}</span>
icon="file-multiple"/>
<br>
<span class="menu-text">{{ $i18n.getFrom('items', 'name') }}</span>
</router-link></li>
<li class="level-item"><router-link
tag="a"
@ -42,7 +44,9 @@
:aria-label="$i18n.getFrom('collections','edit_item')">
<b-icon
size="is-small"
icon="pencil"/> <span class="menu-text">{{ $i18n.get('edit') }}</span>
icon="pencil"/>
<br>
<span class="menu-text">{{ $i18n.get('edit') }}</span>
</router-link></li>
<li class="level-item"><router-link
tag="a"
@ -51,7 +55,9 @@
:aria-label="$i18n.get('label_collection_fields')">
<b-icon
size="is-small"
icon="format-list-checks"/> <span class="menu-text">{{ $i18n.getFrom('fields', 'name') }}</span>
icon="format-list-checks"/>
<br>
<span class="menu-text">{{ $i18n.getFrom('fields', 'name') }}</span>
</router-link></li>
<li class="level-item"><router-link
tag="a"
@ -60,7 +66,9 @@
:aria-label="$i18n.get('label_collection_filters')">
<b-icon
size="is-small"
icon="filter"/> <span class="menu-text">{{ $i18n.getFrom('filters', 'name') }}</span>
icon="filter"/>
<br>
<span class="menu-text">{{ $i18n.getFrom('filters', 'name') }}</span>
</router-link></li>
</ul>
@ -82,14 +90,23 @@ export default {
currentIcon: ''
}
},
props: {
id: Number
},
watch: {
'$route' (to) {
this.activeRoute = to.name;
this.onSecondaryPage = (to.params.collectionId != undefined);
this.pageTitle = this.$route.meta.title;
this.currentIcon = this.$route.meta.icon;
this.arrayRealPath = to.path.split("/");
this.arrayRealPath = this.arrayRealPath.filter((item) => item.length != 0);
this.generateViewPath();
}
},
created () {
this.activeRoute = this.$route.name;
},
methods: {
...mapActions('collection', [
'fetchCollectionName'
@ -150,19 +167,9 @@ export default {
}
}
},
watch: {
'$route' (to) {
this.onSecondaryPage = (to.params.collectionId != undefined);
this.pageTitle = this.$route.meta.title;
this.currentIcon = this.$route.meta.icon;
this.arrayRealPath = to.path.split("/");
this.arrayRealPath = this.arrayRealPath.filter((item) => item.length != 0);
this.generateViewPath();
}
},
created() {
this.activeRoute = this.$route.name;
this.onSecondaryPage = (this.$route.params.collectionId != undefined);
this.pageTitle = this.$route.meta.title;
this.currentIcon = this.$route.meta.icon;
@ -180,17 +187,17 @@ export default {
@import "../../scss/_variables.scss";
// Tainacan Header
#tainacan-header {
#tainacan-subheader {
background-color: $primary-lighter;
height: $header-height;
max-height: $header-height;
height: $subheader-height;
max-height: $subheader-height;
width: 100%;
border-bottom: 0.5px solid #ddd;
padding: 1.0em;
margin: 0px;
vertical-align: middle;
left: 0;
right: 0;
position: absolute;
z-index: 9;
.icon {
@ -205,12 +212,57 @@ export default {
.level-left {
.level-item {
display: inline-block;
margin-left: 268px;
margin-left: 45px;
}
}
&.secondary-page {
.level-item {
margin-left: 310px;
li{
a {
color: $secondary;
text-align: center;
white-space: nowrap;
overflow: hidden;
padding: 1.0em 1.8em;
line-height: 1.5em;
border-radius: 0px;
-webkit-transition: padding 0.3s linear; /* Safari */
transition: padding 0.3s linear;
}
a:hover {
background-color: rgba(255,255,255,0.4);
color: $tertiary;
}
a.is-active {
background-color: rgba(255,255,255,0.6);
color: $tertiary;
}
.icon {
margin: 0;
padding: 0;
}
.menu-text {
opacity: 1;
visibility: visible;
transition: opacity 0.3s linear, visibility 0.3s linear;
-webkit-transition: opacity 0.3s linear, visibility 0.3s linear;
}
}
@media screen and (max-width: 769px) {
width: 100% !important;
max-width: 100% !important;
ul {
flex-flow: wrap;
display: flex;
align-items: stretch;
justify-content: space-evenly;
a {
padding: 0.5em 0.7em !important;
text-align: center;
}
.menu-text {
padding-left: 0.3em !important;
}
}
}
@ -221,14 +273,7 @@ export default {
margin-left: 30px;
}
}
.level-right {
display: none;
}
top: 206px;
&.secondary-page {
top: 237px !important;
}
margin-bottom: 0px !important;
}

View File

@ -15,7 +15,7 @@
custom>
<b-checkbox
v-model="column.visible"
:native-value="column.slug">
:native-value="column.field">
{{ column.name }}
</b-checkbox>
</b-dropdown-item>

View File

@ -20,21 +20,21 @@
:table-fields="tableFields"
:pref-table-fields="prefTableFields"/>
</div>
<div class="columns above-subheader">
<aside
class="column filters-menu"
v-if="items.length > 0">
<div class="columns">
<aside class="column filters-menu">
<h3>{{ $i18n.get('filters') }}</h3>
<filters-items-list />
</aside>
<div class="column table-container">
<items-list
:collection-id="collectionId"
:table-fields="tableFields"
:items="items"
:is-loading="isLoading"/>
<!-- Pagination Footer -->
<pagination v-if="items.length > 0"/>
<div class="column">
<div class="table-container above-subheader">
<items-list
:collection-id="collectionId"
:table-fields="tableFields"
:items="items"
:is-loading="isLoading"/>
<!-- Pagination Footer -->
<pagination v-if="items.length > 0"/>
</div>
</div>
</div>
</div>
@ -121,9 +121,14 @@ export default {
@import '../../scss/_variables.scss';
.page-container-small>.columns {
margin-top: 0;
}
.sub-header {
max-height: $header-height;
height: $header-height;
max-height: $subheader-height;
height: $subheader-height;
margin-left: -$page-small-side-padding;
margin-right: -$page-small-side-padding;
margin-top: -$page-small-top-padding;
@ -147,35 +152,35 @@ export default {
margin-bottom: 0;
margin-top: 0;
min-height: 100%;
height: auto;
height: auto;
}
.filters-menu {
min-width: $side-menu-width;
max-width: $side-menu-width;
background-color: $primary-lighter;
margin-left: -$page-small-side-padding;
padding: $page-small-side-padding;
.label {
font-size: 12px;
font-weight: normal;
}
.filters-menu {
min-width: $side-menu-width;
max-width: $side-menu-width;
background-color: $tainacan-input-color;
margin-left: -$page-small-side-padding;
padding: $page-small-side-padding;
.label {
font-size: 12px;
font-weight: normal;
}
}
.table-container {
margin-right: -$page-small-side-padding;
padding: 3em 2.5em;
}
@media screen and (max-width: 769px) {
.filters-menu {
display: none;
}
.table-container {
margin-right: -$page-small-side-padding;
padding: 3em 2.5em;
}
@media screen and (max-width: 769px) {
.filters-menu {
display: none;
}
.table-container {
margin-right: 0;
padding: .85em 0em;
}
margin-right: 0;
padding: .85em 0em;
}
}

View File

@ -1,14 +1,14 @@
<template>
<div class="columns is-fullheight">
<secondary-menu :id="collectionId"/>
<section class="column is-secondary-content">
<tainacan-subheader :id="collectionId"/>
<router-view class="page-container"/>
</section>
</div>
</template>
<script>
import SecondaryMenu from '../../components/navigation/secondary-menu.vue';
import TainacanSubheader from '../../components/navigation/tainacan-subheader.vue';
export default {
name: 'CollectionPage',
@ -18,7 +18,7 @@ export default {
}
},
components: {
SecondaryMenu
TainacanSubheader
},
created(){
this.collectionId = parseInt(this.$route.params.collectionId);

View File

@ -53,9 +53,10 @@ $colors: map-merge($colors, $addColors);
$size-small: 0.85em; // 0.75em on Bulma.
// Tainacan Header and side menus
$header-height: 78px;
$header-height: 58px;
$subheader-height: 78px;
$side-menu-width: 222px;
$page-height: calc(100% - 78px);
$page-height: calc(100% - 58px);
// Overall Pages padding:
$page-side-padding: 4em;

View File

@ -97,7 +97,12 @@ class TAINACAN_REST_Controller extends WP_REST_Controller {
'paged' => 'paged',
'postin' => 'post__in',
'relation' => 'relation',
<<<<<<< HEAD
'nopaging' => 'nopaging'
=======
'meta_key' => 'meta_key',
'meta_type' => 'meta_type'
>>>>>>> 081c9b2e44413a5eb9b01c5fb20b6cd94b0dc233
];
$meta_query = [
@ -381,6 +386,8 @@ class TAINACAN_REST_Controller extends WP_REST_Controller {
'slug',
'include_slugs',
'title',
'meta_value',
'meta_value_num'
),
);

View File

@ -379,6 +379,38 @@ class Field extends Entity {
if (false === $is_valid)
return false;
// You cant have a multiple field inside a compound field (except category)
if ($this->get_parent() > 0) {
if ( $this->is_multiple() && $this->get_field_type_object()->get_primitive_type() != 'term') {
$this->add_error($this->get_id(), __('Compound fields do not support fields with multiple values (except categories)', 'tainacan'));
return false;
}
}
// You cant have a category field inside a multiple compound field
if ( $this->get_parent() > 0 && $this->get_field_type_object()->get_primitive_type() == 'term' ) {
$parent_field = new \Tainacan\Entities\Field($this->get_parent());
if ( $parent_field->is_multiple() ) {
$this->add_error($this->get_id(), __('Category fields can not be used inside Compound field with multiple values', 'tainacan'));
return false;
}
}
if ( $this->get_field_type() == 'Tainacan\Field_Types\Compound' && $this->is_multiple() ) {
$Tainacan_fields = \Tainacan\Repositories\Fields::getInstance();
$children = $Tainacan_fields->fetch(
[
'parent' => $this->get_id(),
'field_type' => 'Tainacan\Field_Types\Category',
'post_status' => 'any'
]
, 'OBJECT');
if ( sizeof($children) > 0 ) {
$this->add_error($this->get_id(), __('Category fields can not be used inside Compound field with multiple values', 'tainacan'));
return false;
}
}
$fto = $this->get_field_type_object();
if (is_object($fto)) {

View File

@ -21,6 +21,7 @@ class Item_Metadata_Entity extends Entity {
$field,
$parent_meta_id,
$meta_id,
$has_value,
$value;
/**
@ -258,6 +259,20 @@ class Item_Metadata_Entity extends Entity {
$Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::getInstance();
return $Tainacan_Item_Metadata->get_value($this);
}
/**
* Check wether the item has a value stored in the database or not
*
* @return bool
*/
function has_value() {
if (isset($this->has_value))
return $this->has_value;
$value = $this->get_value();
$this->has_value = !empty($value);
return $this->has_value;
}
/**
* Return true if field is multiple, else return false

View File

@ -434,4 +434,64 @@ class Item extends Entity {
}
/**
* Return the item metadata as a HTML string to be used as output.
*
* Each metadata is a label with the field name and the value.
*
* If an ID, a slug or a Tainacan\Entities\Field object is passed, it returns only one metadata, otherwise
* it returns all metadata
*
* @param int|string|Tainacan\Entities\Field $field Field object, ID or slug to retrieve only one field. empty returns all fields
* @param bool $hide_empty Wether to hide or not fields the item has no value to
* @return string The HTML output
*/
public function get_metadata_as_html($field = null, $hide_empty = true) {
$Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::getInstance();
$Tainacan_Fields = \Tainacan\Repositories\Fields::getInstance();
$return = '';
if (!is_null($field)) {
$field_object = null;
if ( $field instanceof \Tainacan\Entities\Field ) {
$field_object = $field;
} elseif ( is_int($field) ) {
$field_object = $Tainacan_Fields->fetch($field);
} elseif ( is_string($field) ) {
$query = $Tainacan_Fields->fetch(['slug' => $field], 'OBJECT');
if ( is_array($query) && sizeof($query) == 1 && isset($field[0])) {
$field_object = $field[0];
}
}
if ( $field_object instanceof \Tainacan\Entities\Field ) {
$item_meta = new \Tainacan\Entities\Item_Metadata_Entity($this, $field_object);
if ($item_meta->has_value() || !$hide_empty) {
$return .= '<h3>' . $field_object->get_name() . '</h3>';
$return .= $item_meta->get_value_as_html();
}
}
return $return;
}
$fields = $this->get_fields();
foreach ( $fields as $item_meta ) {
if ($item_meta->has_value() || !$hide_empty) {
$return .= '<h3>' . $item_meta->get_field()->get_name() . '</h3>';
$return .= $item_meta->get_value_as_html();
}
}
return $return;
}
}

View File

@ -39,16 +39,7 @@ class Compound extends Field_Type {
}
public function validate_options( Field $field ) {
// TODO: You cant have a multiple field inside a compound field (except category)
//
// TODO: You cant have a Category field inside a multiple compound field
return true;
}
/**
* Return the value of an Item_Metadata_Entity using a field of this field type as an html string
* @param Item_Metadata_Entity $item_metadata

View File

@ -33,7 +33,7 @@
size="is-small"
closable
@close="clearSearch()">
{{ results }}
{{ label }}
</b-tag>
</div>
</div>
@ -71,6 +71,7 @@
type: '',
collection: '',
field: '',
label: ''
}
},
mixins: [filter_type_mixin],
@ -79,6 +80,7 @@
if(!option)
return;
this.results = option.value;
this.label = option.label;
this.onSelect()
},
onSelect(){
@ -95,7 +97,7 @@
if ( this.type === 'Tainacan\\Field_Types\\Relationship' ) {
let collectionTarget = ( this.field_object && this.field_object.field_type_options.collection_id ) ?
this.field_object.field_type_options.collection_id : this.collection_id;
promise = this.getValuesRelationship( collectionTarget, query );
promise = this.getValuesRelationship( collectionTarget );
} else {
promise = this.getValuesPlainText( this.field, query );
@ -129,6 +131,7 @@
// instance.selected.push({ label: item.title, value: item.id, img: '' });
this.$console.log(item.title);
instance.results = item.title;
instance.label = item.title;
}
})
.catch(error => {
@ -143,6 +146,7 @@
},
clearSearch(){
this.results = '';
this.label = '';
this.selected = '';
this.$emit('input', {
filter: 'autocomplete',

View File

@ -7,7 +7,6 @@
v-model="selected"
:data="options"
autocomplete
:loading="loading"
field="label"
@typing="search" />
</div>
@ -83,11 +82,10 @@
});
},
getValuesCategory( taxonomy, query ){
this.$console.log( query );
return axios.get('/taxonomy/' + taxonomy + '/terms?hideempty=0' ).then( res => {
for (let item of res.data) {
if( item.name.toLowerCase().indexOf( query.toLowerCase() ) >= 0 )
this.options.push(item);
for (let term of res.data) {
if( term.name.toLowerCase().indexOf( query.toLowerCase() ) >= 0 )
this.options.push({label: term.name, value: term.id});
}
})
.catch(error => {

View File

@ -57,10 +57,9 @@
let promise = null;
this.isLoading = true;
if ( this.type === 'Tainacan\\Field_types\\Relationship' ) {
let collectionTarget = ( this.filter && this.filter.field.field_type_options.collection_id ) ?
this.filter.field.field_type_options.collection_id : this.collection_id;
if ( this.type === 'Tainacan\\Field_Types\\Relationship' ) {
let collectionTarget = ( this.field_object && this.field_object.field_type_options.collection_id ) ?
this.field_object.field_type_options.collection_id : this.collection_id;
promise = this.getValuesRelationship( collectionTarget );
} else {

View File

@ -30,7 +30,13 @@ export const filter_type_mixin = {
});
},
getValuesRelationship(collectionTarget, search) {
return axios.get('/collection/' + collectionTarget + '/items?search=' + search)
let url = '/collection/' + collectionTarget + '/items';
if( search ){
url += "?search=" + search;
}
return axios.get( url )
.then(res => {
if (res.data.length > 0) {
for (let item of res.data) {

View File

@ -56,10 +56,9 @@
this.isLoading = true;
let instance = this;
if ( this.type === 'Tainacan\\Field_types\\Relationship' ) {
let collectionTarget = ( this.filter && this.filter.field.field_type_options.collection_id ) ?
this.filter.field.field_type_options.collection_id : this.collection_id;
if ( this.type === 'Tainacan\\Field_Types\\Relationship' ) {
let collectionTarget = ( this.field_object && this.field_object.field_type_options.collection_id ) ?
this.field_object.field_type_options.collection_id : this.collection_id;
promise = this.getValuesRelationship( collectionTarget );
} else {

View File

@ -289,7 +289,6 @@ class Fields extends Repository {
$args = array_merge([
'posts_per_page' => -1,
'post_status' => 'publish'
], $args);
$args = $this->parse_fetch_args($args);

View File

@ -371,11 +371,15 @@ class Items extends Repository {
if(is_array( $post_title_in ) && isset( $post_title_in['value']) ){
$quotes = [];
foreach ($post_title_in['value'] as $title) {
$quotes[] = "'" . esc_sql( $wpdb->esc_like( $title ) ). "'";
$quotes[] = " $wpdb->posts.post_title LIKE '%" . esc_sql( $wpdb->esc_like( $title ) ). "%'";
}
}
$where .= ' '.$post_title_in['relation'].' ' . $wpdb->posts . '.post_title IN ( ' .implode(',', $quotes ) . ')';
// retrieve only posts for the specified collection and status
$type = " $wpdb->posts.post_type = '" . $wp_query->get( 'post_type' )[0]."' ";
$status = " ( $wpdb->posts.post_status = 'publish' OR $wpdb->posts.post_status = 'private') ";
$where .= ' '.$post_title_in['relation'] . '( ( ' .implode(' OR ', $quotes ) . ' ) AND ' .
$status . ' AND ' . $type . ' )';
}
return $where;
}
@ -393,11 +397,15 @@ class Items extends Repository {
if(is_array( $post_content_in ) && isset( $post_content_in['value']) ){
$quotes = [];
foreach ($post_content_in['value'] as $title) {
$quotes[] = "'" . esc_sql( $wpdb->esc_like( $title ) ). "'";
$quotes[] = " $wpdb->posts.post_content LIKE '%" .esc_sql( $wpdb->esc_like( $title ) ). "%'";
}
}
$where .= ' '.$post_content_in['relation'].' ' . $wpdb->posts . '.post_content IN ( ' .implode(',', $quotes ) . ')';
// retrieve only posts for the specified collection and status
$type = " $wpdb->posts.post_type = '" . $wp_query->get( 'post_type' )[0]."' ";
$status = " ( $wpdb->posts.post_status = 'publish' OR $wpdb->posts.post_status = 'private') ";
$where .= ' '.$post_content_in['relation'] . '( ( ' .implode(' OR ', $quotes ) . ' ) AND ' .
$status . ' AND ' . $type . ' )';
}
return $where;
}

View File

@ -3,14 +3,14 @@ import qs from 'qs';
export const fetchFields = ({ commit }, {collectionId, isRepositoryLevel, isContextEdit }) => {
return new Promise((resolve, reject) => {
let endpoint = '';
let endpoint = '?perpage=-1';
if (!isRepositoryLevel)
endpoint = '/collection/' + collectionId + '/fields/';
else
endpoint = '/fields/';
if (isContextEdit)
endpoint += '?context=edit';
endpoint += '&context=edit';
axios.tainacan.get(endpoint)
.then((res) => {

View File

@ -35,18 +35,17 @@ export const setItemsPerPage = ({ commit }, page ) => {
// Sorting queries
export const setOrderBy = ({ commit }, orderBy ) => {
if (orderBy.field_type == 'Tainacan\\Field_Types\\Numeric') {
commit('addMetaQuery', {
field_id: orderBy.id
});
// Primitive Types: string, date, item, term, compound
if (orderBy.field_type_object.primitive_type == 'float' || orderBy.field_type_object.primitive_type == 'int') {
commit('setPostQueryAttribute', { attr: 'meta_key', value: orderBy.id } );
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value_num' } );
} else if (orderBy.field_type == orderBy.field_type_object.core) {
} else if (orderBy.field_type_object.primitive_type == 'date') {
commit('setPostQueryAttribute', { attr: 'meta_key', value: orderBy.id } );
commit('setPostQueryAttribute', { attr: 'meta_type', value: 'DATETIME' } );
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value' } );
} else if (orderBy.field_type_object.core) {
commit('setPostQueryAttribute', { attr: 'orderby', value: orderBy.field_type_object.related_mapped_prop } );
} else {
commit('addMetaQuery', {
field_id: orderBy.id
});
commit('setPostQueryAttribute', { attr: 'meta_key', value: orderBy.id } );
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value' } );
}

View File

@ -35,6 +35,10 @@ register_activation_hook( __FILE__, array( $Tainacan_Capabilities, 'init' ) );
require_once('admin/class-tainacan-admin.php');
$Tainacan_Admin = \Tainacan\Admin::getInstance();
require_once('theme-helper/class-tainacan-theme-helper.php');
require_once('theme-helper/template-tags.php');
$Tainacan_Admin = \Tainacan\Theme_Helper::getInstance();
function tainacan_load_plugin_textdomain() {
load_plugin_textdomain( 'tainacan', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
}

View File

@ -0,0 +1,61 @@
<?php
namespace Tainacan;
use Tainacan\Entities;
class Theme_Helper {
private static $instance = null;
public static function getInstance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
private function __construct() {
add_filter( 'the_content', [&$this, 'the_content_filter'] );
}
public function is_post_an_item(\WP_Post $post) {
$post_type = $post->post_type;
$prefix = substr( $post_type, 0, strlen( Entities\Collection::$db_identifier_prefix ) );
return $prefix == Entities\Collection::$db_identifier_prefix;
}
public function the_content_filter($content) {
global $post;
if (!is_single())
return $content;
// Is it a collection Item?
if ( !$this->is_post_an_item($post) ) {
return $content;
}
$item = new Entities\Item($post);
$content = '';
// document
// metadata
$content .= $item->get_metadata_as_html();
// attachments
return $content;
}
}

View File

@ -0,0 +1,35 @@
<?php
namespace Tainacan;
use Tainacan\Entities;
/**
* To be used inside The Loop
*
* Return the item metadata as a HTML string to be used as output.
*
* Each metadata is a label with the field name and the value.
*
* If an ID, a slug or a Tainacan\Entities\Field object is passed, it returns only one metadata, otherwise
* it returns all metadata
*
* @param int|string|Tainacan\Entities\Field $field Field object, ID or slug to retrieve only one field. empty returns all fields
* @param bool $hide_empty Wether to hide or not fields the item has no value to
* @return string The HTML output
*/
function get_tainacan_the_metadata($field = null, $hide_empty = true) {
$post = get_post();
$theme_helper = \Tainacan\Theme_Helper::getInstance();
if (!$theme_helper->is_post_an_item($post));
return;
$item = new Entities\Item($post);
return $item->get_metadata_as_html($field, $hide_empty);
}
function tainacan_the_metadata($field = null, $hide_empty = true) {
echo get_tainacan_the_metadata($field, $hide_empty);
}

View File

@ -248,4 +248,122 @@ class CompoundFieldTypes extends TAINACAN_UnitTestCase {
}
function test_validations_category_in_multiple() {
$Tainacan_Fields = \Tainacan\Repositories\Fields::getInstance();
$collection = $this->tainacan_entity_factory->create_entity(
'collection',
array(
'name' => 'test',
),
true
);
$field = $this->tainacan_entity_factory->create_entity(
'field',
array(
'name' => 'meta',
'description' => 'description',
'collection' => $collection,
'field_type' => 'Tainacan\Field_Types\Compound',
'status' => 'publish',
'multiple' => 'yes'
),
true
);
$newField = new \Tainacan\Entities\Field();
$newField->set_name('test_multiple');
$newField->set_field_type('Tainacan\Field_Types\Category');
$newField->set_parent($field->get_id());
$this->assertFalse($newField->validate(), 'You cant add a category field inside a multiple compound field');
$newField->set_field_type('Tainacan\Field_Types\Text');
$this->assertTrue($newField->validate());
}
function test_validations_category_in_multiple_2() {
$Tainacan_Fields = \Tainacan\Repositories\Fields::getInstance();
$collection = $this->tainacan_entity_factory->create_entity(
'collection',
array(
'name' => 'test',
),
true
);
$field = $this->tainacan_entity_factory->create_entity(
'field',
array(
'name' => 'meta',
'description' => 'description',
'collection' => $collection,
'field_type' => 'Tainacan\Field_Types\Compound',
'status' => 'publish',
'multiple' => 'no'
),
true
);
$newField = new \Tainacan\Entities\Field();
$newField->set_name('test_multiple');
$newField->set_field_type('Tainacan\Field_Types\Category');
$newField->set_parent($field->get_id());
$this->assertTrue($newField->validate(), 'You can add a category field inside a not multiple compound field');
$newField = $Tainacan_Fields->insert($newField);
$field->set_multiple('yes');
$this->assertFalse($field->validate(), 'You cant turn a compound field into multiple when there is a category field inside it');
}
function test_validations_multiple_fields() {
$Tainacan_Fields = \Tainacan\Repositories\Fields::getInstance();
$collection = $this->tainacan_entity_factory->create_entity(
'collection',
array(
'name' => 'test',
),
true
);
$field = $this->tainacan_entity_factory->create_entity(
'field',
array(
'name' => 'meta',
'description' => 'description',
'collection' => $collection,
'field_type' => 'Tainacan\Field_Types\Compound',
'status' => 'publish',
'multiple' => 'no'
),
true
);
$newField = new \Tainacan\Entities\Field();
$newField->set_name('test_multiple');
$newField->set_multiple('yes');
$newField->set_field_type('Tainacan\Field_Types\Text');
$newField->set_parent($field->get_id());
$this->assertFalse($newField->validate(), 'You cant add a multiple field inside a compound field');
$newField->set_multiple('no');
$this->assertTrue($newField->validate());
}
}