diff --git a/cypress/integration/repository/category_spec.js b/cypress/integration/repository/category_spec.js new file mode 100644 index 000000000..e1383b72b --- /dev/null +++ b/cypress/integration/repository/category_spec.js @@ -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') + // }) + }) +}) diff --git a/cypress/integration/tests-collection/collection_spec.js b/cypress/integration/repository/collection/collection_spec.js similarity index 77% rename from cypress/integration/tests-collection/collection_spec.js rename to cypress/integration/repository/collection/collection_spec.js index 522f47149..17d3ce7db 100644 --- a/cypress/integration/tests-collection/collection_spec.js +++ b/cypress/integration/repository/collection/collection_spec.js @@ -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') diff --git a/cypress/integration/tests-collection/field/field_category_spec.js b/cypress/integration/repository/collection/field/field_category_spec.js similarity index 92% rename from cypress/integration/tests-collection/field/field_category_spec.js rename to cypress/integration/repository/collection/field/field_category_spec.js index fe2bf72c4..873889f1e 100644 --- a/cypress/integration/tests-collection/field/field_category_spec.js +++ b/cypress/integration/repository/collection/field/field_category_spec.js @@ -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() diff --git a/cypress/integration/tests-collection/field/field_date_spec.js b/cypress/integration/repository/collection/field/field_date_spec.js similarity index 92% rename from cypress/integration/tests-collection/field/field_date_spec.js rename to cypress/integration/repository/collection/field/field_date_spec.js index a98e2b289..e4e08069e 100644 --- a/cypress/integration/tests-collection/field/field_date_spec.js +++ b/cypress/integration/repository/collection/field/field_date_spec.js @@ -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 wasn’t 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() diff --git a/cypress/integration/tests-collection/field/field_numeric_spec.js b/cypress/integration/repository/collection/field/field_numeric_spec.js similarity index 89% rename from cypress/integration/tests-collection/field/field_numeric_spec.js rename to cypress/integration/repository/collection/field/field_numeric_spec.js index 3ab936454..2379d1b9d 100644 --- a/cypress/integration/tests-collection/field/field_numeric_spec.js +++ b/cypress/integration/repository/collection/field/field_numeric_spec.js @@ -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 wasn’t 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() diff --git a/cypress/integration/tests-collection/field/field_relationship_spec.js b/cypress/integration/repository/collection/field/field_relationship_spec.js similarity index 91% rename from cypress/integration/tests-collection/field/field_relationship_spec.js rename to cypress/integration/repository/collection/field/field_relationship_spec.js index fc6fed38b..809cc7ac6 100644 --- a/cypress/integration/tests-collection/field/field_relationship_spec.js +++ b/cypress/integration/repository/collection/field/field_relationship_spec.js @@ -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() diff --git a/cypress/integration/repository/collection/field/field_selectbox_spec.js b/cypress/integration/repository/collection/field/field_selectbox_spec.js new file mode 100644 index 000000000..68a915516 --- /dev/null +++ b/cypress/integration/repository/collection/field/field_selectbox_spec.js @@ -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 wasn’t 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') + }) + }) +}) diff --git a/cypress/integration/tests-collection/field/field_textArea_spec.js b/cypress/integration/repository/collection/field/field_textArea_spec.js similarity index 92% rename from cypress/integration/tests-collection/field/field_textArea_spec.js rename to cypress/integration/repository/collection/field/field_textArea_spec.js index fd26376a3..ce24486f4 100644 --- a/cypress/integration/tests-collection/field/field_textArea_spec.js +++ b/cypress/integration/repository/collection/field/field_textArea_spec.js @@ -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 wasn’t 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() diff --git a/cypress/integration/tests-collection/field/field_text_spec.js b/cypress/integration/repository/collection/field/field_text_spec.js similarity index 92% rename from cypress/integration/tests-collection/field/field_text_spec.js rename to cypress/integration/repository/collection/field/field_text_spec.js index 3130daca9..a4a6b0b0a 100644 --- a/cypress/integration/tests-collection/field/field_text_spec.js +++ b/cypress/integration/repository/collection/field/field_text_spec.js @@ -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 wasn’t 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() diff --git a/cypress/integration/tests-collection/item_spec.js b/cypress/integration/repository/collection/item_spec.js similarity index 77% rename from cypress/integration/tests-collection/item_spec.js rename to cypress/integration/repository/collection/item_spec.js index b3ec14673..c5d043316 100644 --- a/cypress/integration/tests-collection/item_spec.js +++ b/cypress/integration/repository/collection/item_spec.js @@ -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') diff --git a/cypress/integration/tests-collection/field/field_selectbox_spec.js b/cypress/integration/tests-collection/field/field_selectbox_spec.js deleted file mode 100644 index a65f6f6da..000000000 --- a/cypress/integration/tests-collection/field/field_selectbox_spec.js +++ /dev/null @@ -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 wasn’t 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') - // }) - // }) -}) diff --git a/docs/class-reference-fields.md b/docs/class-reference-fields.md index b48f1d0f8..d5be6dbdd 100644 --- a/docs/class-reference-fields.md +++ b/docs/class-reference-fields.md @@ -276,13 +276,6 @@ Return if field is key Return the mask -**Returns:** string - -### `function get_privacy()` - -Return the privacy type - - **Returns:** string ### `function get_default_value()` diff --git a/docs/garbage-collector.md b/docs/garbage-collector.md index 41396fea6..bc93979a4 100644 --- a/docs/garbage-collector.md +++ b/docs/garbage-collector.md @@ -1,4 +1,5 @@ * everything auto draft * post_meta of deleted fields -* post_meta of deleted instaces of a multiple compound Field. post_meta of a field that is child of a compound field, but which the ID does not appear in any array of a compound field meta_value \ No newline at end of file +* post_meta of deleted instaces of a multiple compound Field. post_meta of a field that is child of a compound field, but which the ID does not appear in any array of a compound field meta_value +* orphan terms (with taxonomy that does not exist) \ No newline at end of file diff --git a/docs/internal-api.md b/docs/internal-api.md index e07c6a69b..50160fbbf 100644 --- a/docs/internal-api.md +++ b/docs/internal-api.md @@ -24,7 +24,7 @@ This layer is based on a Repository pattern. Each entity Tainacan deals with hav Repositories are the classes that comunicate with the database and know where everything is stored and how to find things. It is a singleton class, so it have only one instance available to be used by any part of the application. ```PHP -$fields_repo = Tainacan\Repositories\Fields::getInstance(); +$fields_repo = Tainacan\Repositories\Fields::get_instance(); ``` Entities classes are the representation of the individual of each repository. @@ -46,7 +46,7 @@ Tainacan will automatically map the values of the attributes to and from where t When you want to fetch entities from the database, this abstraction layer steps aside and let you use all the power and flexibility of `WP_Query`, which you know and love. For example: ```PHP -Repositories\Fields::getInstance()->fetch('s=test'); +Repositories\Fields::get_instance()->fetch('s=test'); ``` The `fetch` method from the repositories accept exactly the same arguments accepted by `WP_Query` and uses it internally. In fact, you could use `WP_Query` directly if you prefer, but using the repository class gives you some advantages. You dont have to know the name of the post type, you can also fetch by some mapped attribute calling it directly, withour having to use `meta_query` (or even know wether a property is stored as a post attribute or post_meta). See more details in the Fetch section below. @@ -68,7 +68,7 @@ $collection = new Tainacan\Entities\Collection($collection_id); This will have the same effect as calling the `fetch` method from the repository passing an integer as argument. THe repository will assume it is the collection ID. ```PHP -$collection = Tainacan\Repositories\Collections::getInstance()->fetch($collection_id); +$collection = Tainacan\Repositories\Collections::get_instance()->fetch($collection_id); ``` ### Fethcing many individuals @@ -80,8 +80,8 @@ To fetch collections (or any other entity) based on a query search, you may call Examples: ```PHP -$repo = Tainacan\Repositories\Collections::getInstance(); -$items_repo = Tainacan\Repositories\Collections::getInstance(); +$repo = Tainacan\Repositories\Collections::get_instance(); +$items_repo = Tainacan\Repositories\Collections::get_instance(); $collections = $repo->fetch(); // get all public collections (or any private collections current user can view. It works exactly the same way WP_Query) @@ -106,7 +106,7 @@ $items = $items_repo->fetch([ Note that you can use the mapped attribute names to build your query, but it is just fine if you want to use the native WordPress names. The same can be achievied with attributes stored as post_meta: ```PHP -$repo = Tainacan\Repositories\Fields::getInstance(); +$repo = Tainacan\Repositories\Fields::get_instance(); $fields = $repo->fetch([ 'required' => 'yes' @@ -143,7 +143,7 @@ However, before insertion, you must validate the entity, calling the `validate() So this is a typical routine for creating an entity: ```PHP -$collectionsRepo = \Tainacan\Repositories\Collections::getInstance(); +$collectionsRepo = \Tainacan\Repositories\Collections::get_instance(); $collection = new \Tainacan\Entities\Collection(); $collection->set_name('New Collection'); @@ -187,7 +187,7 @@ $itemMetadada = new \Tainacan\Entities\ItemMetadataEntity($item, $field); $itemMetadata->set_value('Red'); if ($itemMetadata->validate()) { - $ItemMetadataRepo = \Tainacan\Repositories\ItemMetadata::getInstance(); + $ItemMetadataRepo = \Tainacan\Repositories\ItemMetadata::get_instance(); $ItemMetadata = $ItemMetadataRepo->insert($ItemMetadata); } else { $errors = $ItemMetadata->get_errors(); @@ -313,7 +313,7 @@ $item->can_edit(); So now you know how to check the permision when a user wants to update an item. Here is the complete code: ```PHP -$collectionsRepo = \Tainacan\Repositories\Collections::getInstance(); +$collectionsRepo = \Tainacan\Repositories\Collections::get_instance(); $collection = new \Tainacan\Entities\Collection(23); if ($collection->can_edit()) { diff --git a/docs/key-concepts.md b/docs/key-concepts.md index 2d30ccc5b..9d78e1249 100644 --- a/docs/key-concepts.md +++ b/docs/key-concepts.md @@ -21,6 +21,14 @@ Items are the actual content of yout repository. The painting, the film, the boo In WordPress language, each item is a post and its post type represents its collection. +### Document + +Document is the main information of the item. It is the object which all metadata refer to. Tainacan accepts 3 different document types: + +* Attachment: A file attached to the item. An image, video, pdf, audio or other media file. +* URL: An URL pointing to an external website or file. It can be a general website, a specific file, or media services. In the case of media services, Tainacan recognizes addresses and displays the appropriate player, using [oEmbed](https://oembed.com/) +* Text: A plain text, stored directly in the database, the user can type upon creating or editing an item + ## Fields Every collection have a set of fields. They are the description of the items of this collection. diff --git a/docs/tainacan-api.md b/docs/tainacan-api.md index bc09af60e..43bc174c5 100644 --- a/docs/tainacan-api.md +++ b/docs/tainacan-api.md @@ -139,7 +139,6 @@ A REST API for Tainacan Plugin. This API uses the Wordpress REST API. "collection_key": "string", "multiple": "string", "cardinality": "string", - "privacy": "string", "mask": "string", "default_value": "string", "field_type_options": "string", diff --git a/run-cypress.sh b/run-cypress.sh index 35ef9376c..b4566e3f9 100755 --- a/run-cypress.sh +++ b/run-cypress.sh @@ -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 diff --git a/src/admin/admin.vue b/src/admin/admin.vue index 13dc0eac3..97a8b22ff 100644 --- a/src/admin/admin.vue +++ b/src/admin/admin.vue @@ -45,6 +45,7 @@ margin: 0 auto; position: relative; overflow-y: auto; + height: 100%; @media screen and (max-width: 769px) { & { @@ -59,15 +60,21 @@ .is-secondary-content { padding: 0px; - margin: 78px auto 0 auto; + margin: $header-height auto 0 auto; position: relative; overflow-y: auto; + height: calc(100% - 58px); @media screen and (max-width: 769px) { & { overflow-y: visible; } } + + .columns { + margin-left: 0px; + margin-right: 0px; + } } diff --git a/src/admin/class-tainacan-admin.php b/src/admin/class-tainacan-admin.php index 5a5f3da14..6dc2875b5 100644 --- a/src/admin/class-tainacan-admin.php +++ b/src/admin/class-tainacan-admin.php @@ -8,7 +8,7 @@ class Admin { private $menu_slug = 'tainacan_admin'; private static $instance = null; - public static function getInstance() { + public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } @@ -110,11 +110,11 @@ class Admin { function get_admin_js_localization_params() { global $TAINACAN_BASE_URL; - $Tainacan_Collections = \Tainacan\Repositories\Collections::getInstance(); - $Tainacan_Fields = \Tainacan\Repositories\Fields::getInstance(); - $Tainacan_Filters = \Tainacan\Repositories\Filters::getInstance(); - $Tainacan_Items = \Tainacan\Repositories\Items::getInstance(); - $Tainacan_Taxonomies = \Tainacan\Repositories\Taxonomies::getInstance(); + $Tainacan_Collections = \Tainacan\Repositories\Collections::get_instance(); + $Tainacan_Fields = \Tainacan\Repositories\Fields::get_instance(); + $Tainacan_Filters = \Tainacan\Repositories\Filters::get_instance(); + $Tainacan_Items = \Tainacan\Repositories\Items::get_instance(); + $Tainacan_Taxonomies = \Tainacan\Repositories\Taxonomies::get_instance(); $tainacan_admin_i18n = require( 'tainacan-admin-i18n.php' ); diff --git a/src/admin/components/edition/category-edition-form.vue b/src/admin/components/edition/category-edition-form.vue index 5b2abdea0..dfe690f93 100644 --- a/src/admin/components/edition/category-edition-form.vue +++ b/src/admin/components/edition/category-edition-form.vue @@ -147,7 +147,7 @@ mixins: [ wpAjax ], data(){ return { - categoryId: Number, + categoryId: String, activeTab: 0, category: null, isLoadingCategory: false, @@ -179,12 +179,40 @@ components: { TermsList }, + beforeRouteLeave( to, from, next ) { + let formNotSaved = false; + + if (this.category.name != this.form.name) + formNotSaved = true; + if (this.category.description != this.form.description) + formNotSaved = true; + if (this.category.slug != this.form.slug) + formNotSaved = true; + if (this.category.allow_insert != this.form.allowInsert) + formNotSaved = true; + if (this.category.status != this.form.status) + formNotSaved = true; + + if (formNotSaved) { + this.$dialog.confirm({ + message: this.$i18n.get('info_warning_category_not_saved'), + onConfirm: () => { + next(); + }, + cancelText: this.$i18n.get('cancel'), + confirmText: this.$i18n.get('continue'), + type: 'is-secondary' + }); + } else { + next() + } + }, methods: { ...mapActions('category', [ 'createCategory', 'updateCategory', 'fetchCategory', - 'fetchOnlySlug', + 'fetchOnlySlug' ]), ...mapGetters('category',[ 'getCategory', @@ -212,7 +240,7 @@ this.form.slug = this.category.slug; this.form.description = this.category.description; this.form.status = this.category.status; - this.allowInsert = this.category.allow_insert; + this.form.allowInsert = this.category.allow_insert; this.isLoadingCategory = false; this.formErrorMessage = ''; diff --git a/src/admin/components/edition/item-edition-form.vue b/src/admin/components/edition/item-edition-form.vue index 75fd1c02b..ad22e6546 100644 --- a/src/admin/components/edition/item-edition-form.vue +++ b/src/admin/components/edition/item-edition-form.vue @@ -8,118 +8,127 @@ v-if="!isLoading" class="tainacan-form" label-width="120px"> - - - - - - - - -
- -
-

- -

-

{{ $i18n.get('instruction_image_upload_box') }}

-
-
-
-
- -
-
- - - - -
-
-
-
- - - - - -
-
+
+
+ - -
+
+

- +

{{ $i18n.get('instruction_image_upload_box') }}

-
-
-
-
-
- - {{ file.name }} -
-
+ + + +
+
+ + +
+
+

+ +

+

{{ $i18n.get('instruction_image_upload_box') }}

+
+
+
+
+
+
+ + {{ file.name }} +
+
+
+
+
+
+ +
+
+
+ +
+ + + + + + + + + +
-
-
- -
-
+
+ >{{ $i18n.get('save') }}

{{ formErrorMessage }}

@@ -214,14 +223,10 @@ export default { }) .catch((errors) => { for (let error of errors.errors) { - for (let attribute of Object.keys(error)){ - //this.editFormErrors[attribute] = error[attribute]; - this.$console.log(error); - - eventBus.errors.push({ field_id: 7031, errors: error[attribute]}); + for (let field of Object.keys(error)){ + eventBus.errors.push({ field_id: field, errors: error[field]}); } } - this.$console.log(eventBus.errors); this.formErrorMessage = errors.error_message; this.isLoading = false; @@ -267,7 +272,8 @@ export default { }); }, cancelBack(){ - this.$router.push(this.$routerHelper.getCollectionPath(this.collectionId)); + this.$console.log(this.fieldList); + //this.$router.push(this.$routerHelper.getCollectionPath(this.collectionId)); }, uploadAttachment($event) { @@ -317,7 +323,15 @@ export default { return this.getFields(); }, formHasErrors(){ - return eventBus.errors.length > 0; + // for (let field of this.fieldList) { + // if (field.field.required == 'yes' && + // (field.value == '' || field.value == undefined) && + // this.form.status == 'publish') { + // return true; + // } + // } + + return false; } }, created(){ diff --git a/src/admin/components/edition/term-edition-form.vue b/src/admin/components/edition/term-edition-form.vue index b8bf8d928..d8f6c96c7 100644 --- a/src/admin/components/edition/term-edition-form.vue +++ b/src/admin/components/edition/term-edition-form.vue @@ -6,13 +6,11 @@ + :type="(formErrors.name != '' && formErrors.name != undefined) ? 'is-danger' : ''" + :message="formErrors.name"> - +
@@ -61,6 +61,11 @@ import { mapActions, mapGetters } from 'vuex'; export default { name: 'TermEditionForm', + data () { + return { + formErrors: {} + } + }, props: { editForm: Object, categoryId: '' @@ -84,11 +89,16 @@ export default { }) .then(() => { this.editForm = {}; + this.formErrors = {}; this.$emit('onEditionFinished'); }) - .catch((error) => { + .catch((errors) => { + for (let error of errors.errors) { + for (let field of Object.keys(error)){ + this.$set(this.formErrors, field, (this.formErrors[field] != undefined ? this.formErrors[field] : '') + error[field] + '\n'); + } + } this.$emit('onErrorFound'); - this.$console.log(error); }); } else { @@ -101,11 +111,16 @@ export default { }) .then(() => { this.editForm.saved = true; + this.formErrors = {}; this.$emit('onEditionFinished'); }) - .catch((error) => { + .catch((errors) => { + for (let error of errors.errors) { + for (let field of Object.keys(error)){ + this.$set(this.formErrors, field, (this.formErrors[field] != undefined ? this.formErrors[field] : '') + error[field] + '\n'); + } + } this.$emit('onErrorFound'); - this.$console.log(error); }); } }, diff --git a/src/admin/components/lists/collections-list.vue b/src/admin/components/lists/collections-list.vue index af690fe8a..f10a11325 100644 --- a/src/admin/components/lists/collections-list.vue +++ b/src/admin/components/lists/collections-list.vue @@ -9,6 +9,7 @@ @click="deleteSelectedCollections()">{{ $i18n.get('instruction_delete_selected_collections') }} + - - - +

+

{{ $i18n.get('info_no_collection_created') }}

+ + {{ $i18n.getFrom('collections', 'new_item') }} + +
+ + @@ -157,7 +159,7 @@ export default { position: 'is-bottom', type: 'is-secondary', queue: true - }) + }); for (let i = 0; i < this.selectedCollections.length; i++) { if (this.selectedCollections[i].id == this.collectionId) this.selectedCollections.splice(i, 1); diff --git a/src/admin/components/lists/events-list.vue b/src/admin/components/lists/events-list.vue index ffd857ea1..40888a614 100644 --- a/src/admin/components/lists/events-list.vue +++ b/src/admin/components/lists/events-list.vue @@ -13,11 +13,9 @@ ref="eventsTable" :data="events" :checked-rows.sync="selectedEvents" - checkable :loading="isLoading" hoverable striped - selectable backend-sorting> - - - + @@ -179,20 +157,12 @@ export default { goToItemEditPage(itemId) { this.$router.push(this.$routerHelper.getItemEditPath(this.collectionId, itemId)); }, - showValue( metadata ){ + renderMetadata( metadata ){ - if( ! metadata || metadata.value === false || metadata.value == undefined || metadata.value == '' ) + if( !metadata ) return ''; - - if( metadata.value instanceof Array ){ - let result = []; - for( let val of metadata.value ){ - result.push( ( val.name ) ? val.name : val ) - } - return result.join(', '); - } else { - return metadata.value.name ? metadata.value.name : metadata.value - } + else + return metadata.value_as_html; } } } diff --git a/src/admin/components/lists/terms-list.vue b/src/admin/components/lists/terms-list.vue index 0b030a6c0..ebc9653cf 100644 --- a/src/admin/components/lists/terms-list.vue +++ b/src/admin/components/lists/terms-list.vue @@ -97,37 +97,19 @@ export default { watch: { termsList() { this.generateOrderedTerms(); + }, + categoryId() { + this.loadTerms(); } }, components: { TermEditionForm }, - beforeRouteUpdate ( to, from, next ) { - let hasUnsavedForms = false; - for (let term in this.orderedTermsList) { - if (!term.saved || term.opened || term.id == 'new') - hasUnsavedForms = true; - } - if (hasUnsavedForms) { - this.$dialog.confirm({ - message: this.$i18n.get('info_warning_terms_not_saved'), - onConfirm: () => { - this.onEditionCanceled(); - next(); - }, - cancelText: this.$i18n.get('cancel'), - confirmText: this.$i18n.get('continue'), - type: 'is-secondary' - }); - } else { - next() - } - }, methods: { ...mapActions('category', [ - 'fetchTerms', 'updateTerm', - 'deleteTerm' + 'deleteTerm', + 'fetchTerms' ]), ...mapGetters('category',[ 'getTerms' @@ -299,7 +281,8 @@ export default { term.opened = (this.orderedTermsList[term.id].opened == undefined ? false : this.orderedTermsList[term.id].opened); term.saved = (this.orderedTermsList[term.id].saved == undefined ? true : this.orderedTermsList[term.id].saved); } - this.orderedTermsList.push(JSON.parse(JSON.stringify(term))); + if (term.taxonomy != null) + this.orderedTermsList.push(JSON.parse(JSON.stringify(term))); this.buildOrderedTermsList(term.id, termDepth + 1); } @@ -314,22 +297,26 @@ export default { return this.termsList[originalIndex].name; else return term.name; + }, + loadTerms() { + this.isLoadingTerms = true; + this.fetchTerms(this.categoryId) + .then(() => { + // Fill this.form data with current data. + this.isLoadingTerms = false; + this.generateOrderedTerms(); + }) + .catch((error) => { + this.$console.log(error); + }); } }, created() { - - this.isLoadingTerms = true; - - this.fetchTerms(this.categoryId) - .then(() => { - // Fill this.form data with current data. - this.isLoadingTerms = false; - this.generateOrderedTerms(); - }) - .catch((error) => { - this.$console.log(error); - }); + if (this.categoryId !== String) { + this.loadTerms(); + } } + } diff --git a/src/admin/components/navigation/primary-menu.vue b/src/admin/components/navigation/primary-menu.vue index a6e006da8..ca7f8de12 100644 --- a/src/admin/components/navigation/primary-menu.vue +++ b/src/admin/components/navigation/primary-menu.vue @@ -23,23 +23,6 @@