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/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..7f6fe0a03 100644 --- a/src/admin/admin.vue +++ b/src/admin/admin.vue @@ -59,7 +59,7 @@ .is-secondary-content { padding: 0px; - margin: 78px auto 0 auto; + margin: $header-height auto 0 auto; position: relative; overflow-y: auto; @@ -68,6 +68,11 @@ overflow-y: visible; } } + + .columns { + margin-left: 0px; + margin-right: 0px; + } } diff --git a/src/admin/components/edition/item-edition-form.vue b/src/admin/components/edition/item-edition-form.vue index 90784536e..ad22e6546 100644 --- a/src/admin/components/edition/item-edition-form.vue +++ b/src/admin/components/edition/item-edition-form.vue @@ -224,7 +224,7 @@ export default { .catch((errors) => { for (let error of errors.errors) { for (let field of Object.keys(error)){ - eventBus.errors.push({ field_id: attribute, errors: error[field]}); + eventBus.errors.push({ field_id: field, errors: error[field]}); } } this.formErrorMessage = errors.error_message; diff --git a/src/admin/components/navigation/tainacan-header.vue b/src/admin/components/navigation/tainacan-header.vue index 5abaac6e5..7bf934983 100644 --- a/src/admin/components/navigation/tainacan-header.vue +++ b/src/admin/components/navigation/tainacan-header.vue @@ -5,19 +5,17 @@ :class="{'secondary-page': onSecondaryPage}">