From 730d6289bb04f1a53b803e382f5fde7ee8466a30 Mon Sep 17 00:00:00 2001 From: juliannyas Date: Wed, 11 Apr 2018 16:39:21 -0300 Subject: [PATCH] configuration to run the cypress in different ways according to the need of verification --- .../collection/field/field_category_spec.js | 20 ++--- .../collection/field/field_date_spec.js | 52 ++++++------- .../collection/field/field_numeric_spec.js | 52 ++++++------- .../field/field_relationship_spec.js | 18 ++--- .../collection/field/field_selectbox_spec.js | 75 +++++++++---------- .../collection/field/field_textArea_spec.js | 61 +++++++-------- .../collection/field/field_text_spec.js | 61 +++++++-------- .../repository/collection/item_spec.js | 26 +------ run-cypress.sh | 21 +++--- run-tests.sh | 2 +- 10 files changed, 177 insertions(+), 211 deletions(-) diff --git a/cypress/integration/repository/collection/field/field_category_spec.js b/cypress/integration/repository/collection/field/field_category_spec.js index 873889f1e..ccdec71f3 100644 --- a/cypress/integration/repository/collection/field/field_category_spec.js +++ b/cypress/integration/repository/collection/field/field_category_spec.js @@ -9,7 +9,7 @@ context('Category field test', function(){ 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.location('hash').should('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') @@ -21,7 +21,7 @@ context('Category field test', function(){ it('create taxonomies for create relationship', function(){ cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections') - cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get(':nth-child(8) > a > .menu-text').click() cy.get('.button').click() cy.get('#tainacan-text-name').type('Cat 1') @@ -62,7 +62,7 @@ context('Category field test', function(){ it('canceled create category-type field public', function(){ cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections') - cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -78,7 +78,7 @@ context('Category field test', function(){ it('create category-type field public - input type = radio', function(){ cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections') - cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -96,7 +96,7 @@ context('Category field test', function(){ it('create category-type field public - input type = selectbox', function(){ cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections') - cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -114,7 +114,7 @@ context('Category field test', function(){ it('create category-type field private', function(){ cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections') - cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -132,7 +132,7 @@ context('Category field test', function(){ it('create category-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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -150,7 +150,7 @@ context('Category field test', function(){ it('create category-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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -168,7 +168,7 @@ context('Category field test', function(){ it('create category-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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -186,7 +186,7 @@ context('Category field test', function(){ 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(7) > a').click() diff --git a/cypress/integration/repository/collection/field/field_date_spec.js b/cypress/integration/repository/collection/field/field_date_spec.js index e4e08069e..53da10f47 100644 --- a/cypress/integration/repository/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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() diff --git a/cypress/integration/repository/collection/field/field_numeric_spec.js b/cypress/integration/repository/collection/field/field_numeric_spec.js index 2379d1b9d..bc465957b 100644 --- a/cypress/integration/repository/collection/field/field_numeric_spec.js +++ b/cypress/integration/repository/collection/field/field_numeric_spec.js @@ -9,7 +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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('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') @@ -22,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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -37,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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -47,7 +47,7 @@ describe('Numeric field test', function() { it('create code field', function(){ cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections') - cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -62,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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -72,7 +72,7 @@ describe('Numeric field test', function() { it('edit code field', function(){ cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections') - cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -87,7 +87,7 @@ describe('Numeric field test', function() { it('create number field', function(){ cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections') - cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -102,7 +102,7 @@ describe('Numeric field test', function() { it('delete number field', function(){ cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections') - cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -114,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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -126,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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -141,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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -152,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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -164,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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -184,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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -196,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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -211,7 +211,7 @@ describe('Numeric field test', function() { 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -225,7 +225,7 @@ describe('Numeric field test', function() { context('"Not saved" label vs. "cancel button"', function(){ it('create amount field', function(){ cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections') - cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -240,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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -257,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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -283,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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -298,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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -314,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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -330,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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -348,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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -370,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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -429,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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() diff --git a/cypress/integration/repository/collection/field/field_relationship_spec.js b/cypress/integration/repository/collection/field/field_relationship_spec.js index 809cc7ac6..51e671189 100644 --- a/cypress/integration/repository/collection/field/field_relationship_spec.js +++ b/cypress/integration/repository/collection/field/field_relationship_spec.js @@ -9,7 +9,7 @@ context('Relationship field test', function(){ 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.location('hash').should('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') @@ -21,7 +21,7 @@ context('Relationship field test', function(){ it('create collection for create relationship', function(){ cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections') - cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.contains('New Collection').click() cy.get('#tainacan-text-name').type('Book relationship') cy.get('#tainacan-text-description').type('Descrição book relationship') @@ -33,7 +33,7 @@ context('Relationship field test', function(){ it('canceled create relationship-type field public', function(){ cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections') - cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get(':nth-child(2) > [data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -49,7 +49,7 @@ context('Relationship field test', function(){ it('create relationship-type field public', function(){ cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections') - cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get(':nth-child(2) > [data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -68,7 +68,7 @@ context('Relationship field test', function(){ it('create relationship-type field private', function(){ cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections') - cy.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get(':nth-child(2) > [data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -87,7 +87,7 @@ context('Relationship field test', function(){ it('create relationship-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.location('hash').should('eq', '#/collections') cy.get(':nth-child(2) > [data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -107,7 +107,7 @@ context('Relationship field test', function(){ it('create relationship-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.location('hash').should('eq', '#/collections') cy.get(':nth-child(2) > [data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -127,7 +127,7 @@ context('Relationship field test', function(){ it('create relationship-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.location('hash').should('eq', '#/collections') cy.get(':nth-child(2) > [data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -147,7 +147,7 @@ context('Relationship field test', function(){ 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.location('hash').should('eq', '#/collections') cy.get(':nth-child(2) > [data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() diff --git a/cypress/integration/repository/collection/field/field_selectbox_spec.js b/cypress/integration/repository/collection/field/field_selectbox_spec.js index 68a915516..f32492d04 100644 --- a/cypress/integration/repository/collection/field/field_selectbox_spec.js +++ b/cypress/integration/repository/collection/field/field_selectbox_spec.js @@ -9,7 +9,7 @@ describe('Selectbox field test', function() { 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.location('hash').should('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') @@ -22,7 +22,7 @@ describe('Selectbox field test', function() { 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -38,7 +38,7 @@ describe('Selectbox field test', function() { 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -48,7 +48,7 @@ describe('Selectbox field test', function() { 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -64,7 +64,7 @@ describe('Selectbox field test', function() { 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -74,7 +74,7 @@ describe('Selectbox field test', function() { 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -90,7 +90,7 @@ describe('Selectbox field test', function() { 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -106,7 +106,7 @@ describe('Selectbox field test', function() { 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -118,7 +118,7 @@ describe('Selectbox field test', function() { 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -130,7 +130,7 @@ describe('Selectbox field test', function() { 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -146,7 +146,7 @@ describe('Selectbox field test', function() { 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -157,7 +157,7 @@ describe('Selectbox field test', function() { 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -169,7 +169,7 @@ describe('Selectbox field test', function() { 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -190,7 +190,7 @@ describe('Selectbox field test', function() { 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -202,7 +202,7 @@ describe('Selectbox field test', function() { 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -210,30 +210,29 @@ describe('Selectbox field test', function() { 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('#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') - // }) + 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -249,7 +248,7 @@ describe('Selectbox 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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -267,7 +266,7 @@ describe('Selectbox 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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -295,7 +294,7 @@ describe('Selectbox field test', 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -311,7 +310,7 @@ describe('Selectbox field test', function() { 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -328,7 +327,7 @@ describe('Selectbox field test', function() { 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -345,7 +344,7 @@ describe('Selectbox field test', function() { 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -364,7 +363,7 @@ describe('Selectbox 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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -386,7 +385,7 @@ describe('Selectbox field test', function() { 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -455,7 +454,7 @@ describe('Selectbox field test', function() { 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.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() diff --git a/cypress/integration/repository/collection/field/field_textArea_spec.js b/cypress/integration/repository/collection/field/field_textArea_spec.js index ce24486f4..41827a163 100644 --- a/cypress/integration/repository/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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -380,55 +380,46 @@ describe('TextArea field test', function() { cy.get('.textarea').type('description textArea') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(2) > .button').click() - cy.wait(500) cy.get('.field > :nth-child(2) > :nth-child(2)').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 2') cy.get('.textarea').type('description textArea') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(2) > .button').click() - cy.wait(500) cy.get('.field > :nth-child(2) > :nth-child(2)').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 3') cy.get('.textarea').type('description textArea') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(2) > .button').click() - cy.wait(500) cy.get('.field > :nth-child(2) > :nth-child(2)').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 4') cy.get('.textarea').type('description textArea') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(2) > .button').click() - cy.wait(500) cy.get('.field > :nth-child(2) > :nth-child(2)').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 5') cy.get('.textarea').type('description textArea') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(2) > .button').click() - cy.wait(500) cy.get('.field > :nth-child(2) > :nth-child(2)').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 6') cy.get('.textarea').type('description textArea') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(2) > .button').click() - cy.wait(500) cy.get('.field > :nth-child(2) > :nth-child(2)').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 7') cy.get('.textarea').type('description textArea') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(2) > .button').click() - cy.wait(500) cy.get('.field > :nth-child(2) > :nth-child(2)').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 8') cy.get('.textarea').type('description textArea') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(2) > .button').click() - cy.wait(500) cy.get('.field > :nth-child(2) > :nth-child(2)').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 9') cy.get('.textarea').type('description textArea') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(2) > .button').click() - cy.wait(500) cy.get('.field > :nth-child(2) > :nth-child(2)').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}TextArea 10') cy.get('.textarea').type('description textArea') @@ -438,7 +429,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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() diff --git a/cypress/integration/repository/collection/field/field_text_spec.js b/cypress/integration/repository/collection/field/field_text_spec.js index a4a6b0b0a..0914e5032 100644 --- a/cypress/integration/repository/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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -196,7 +196,7 @@ 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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() @@ -380,55 +380,46 @@ describe('Text field test', function() { cy.get('.textarea').type('description text') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(2) > .button').click() - cy.wait(500) cy.get('[draggable="false"]').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text 2') cy.get('.textarea').type('description text') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(2) > .button').click() - cy.wait(500) cy.get('[draggable="false"]').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text 3') cy.get('.textarea').type('description text') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(2) > .button').click() - cy.wait(500) cy.get('[draggable="false"]').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text 4') cy.get('.textarea').type('description text') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(2) > .button').click() - cy.wait(500) cy.get('[draggable="false"]').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text 5') cy.get('.textarea').type('description text') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(2) > .button').click() - cy.wait(500) cy.get('[draggable="false"]').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text 6') cy.get('.textarea').type('description text') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(2) > .button').click() - cy.wait(500) cy.get('[draggable="false"]').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text 7') cy.get('.textarea').type('description text') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(2) > .button').click() - cy.wait(500) cy.get('[draggable="false"]').click() /cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text 8') cy.get('.textarea').type('description text') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(2) > .button').click() - cy.wait(500) cy.get('[draggable="false"]').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text 9') cy.get('.textarea').type('description text') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(2) > .button').click() - cy.wait(500) cy.get('.field > :nth-child(2) > :nth-child(1)').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('{selectall}{del}Text 10') cy.get('.textarea').type('description text') @@ -438,7 +429,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.location().should((loc) => {expect(loc.hash).to.eq('#/collections')}) + cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(5) > a').click() diff --git a/cypress/integration/repository/collection/item_spec.js b/cypress/integration/repository/collection/item_spec.js index c5d043316..888a9e3c3 100644 --- a/cypress/integration/repository/collection/item_spec.js +++ b/cypress/integration/repository/collection/item_spec.js @@ -7,38 +7,20 @@ describe('Item tests', function () { cy.clearDB() }) - Cypress.Commands.add('createCollection', (name) => { + 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(name) - cy.get('#tainacan-text-description').type('description'+name) + 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', name) + cy.get('.b-table').should('contain', 'Book Items') }) - 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') diff --git a/run-cypress.sh b/run-cypress.sh index b4566e3f9..c5f89e170 100755 --- a/run-cypress.sh +++ b/run-cypress.sh @@ -1,11 +1,11 @@ #!/bin/bash -if [ $# - lt 2 ]; then - echo "usage: $0 [skip-head]" -exit 1 +if [ $# -lt 1 ]; then + echo -e "* Enter