From 53b165f45ca61d12f7b635335a22f23ac4910249 Mon Sep 17 00:00:00 2001 From: weryques Date: Wed, 11 Apr 2018 16:02:29 -0300 Subject: [PATCH 1/9] Improves method diff, Improves method insert, Adds i18n, Fixes log tests, Removes column description from event list --- src/admin/components/lists/events-list.vue | 58 ++++++++++++------- src/admin/pages/singles/event-page.vue | 12 ++-- src/admin/tainacan-admin-i18n.php | 4 ++ .../repositories/class-tainacan-fields.php | 14 ++--- .../repositories/class-tainacan-logs.php | 43 +++++++++++--- .../class-tainacan-repository.php | 4 +- src/js/store/modules/event/actions.js | 2 +- tests/test-collections.php | 6 +- 8 files changed, 94 insertions(+), 49 deletions(-) diff --git a/src/admin/components/lists/events-list.vue b/src/admin/components/lists/events-list.vue index 40888a614..76f1e6edd 100644 --- a/src/admin/components/lists/events-list.vue +++ b/src/admin/components/lists/events-list.vue @@ -10,6 +10,7 @@ {{ props.row.title }} - - - {{ props.row.description }} - - + + + + + + + + + + + + + + + @@ -78,19 +83,28 @@ - - - + @click.prevent.stop="notApprove(props.row.id)" /> +
+
+
+

+ + {{ this.$i18n.get('info_no_events') }} +

+
+
+
+ diff --git a/src/admin/pages/singles/event-page.vue b/src/admin/pages/singles/event-page.vue index a6ce6b1f5..ffcb12510 100644 --- a/src/admin/pages/singles/event-page.vue +++ b/src/admin/pages/singles/event-page.vue @@ -6,7 +6,7 @@
-
Before change
+
{{ this.$i18n.get('info_logs_before') }}
-
What was changed
+
{{ this.$i18n.get('info_logs_after') }}
@@ -31,13 +31,13 @@

+ :class="{'has-text-success': !diff.old, 'back-hlight': !diff.old }"> {{ `${key.replace('_', ' ')}:` }}
{{ d }}
@@ -84,5 +84,7 @@ \ No newline at end of file diff --git a/src/admin/tainacan-admin-i18n.php b/src/admin/tainacan-admin-i18n.php index 7b77b17e1..78b3d8fc3 100644 --- a/src/admin/tainacan-admin-i18n.php +++ b/src/admin/tainacan-admin-i18n.php @@ -134,6 +134,7 @@ return [ 'label_inherited' => __( 'Inherited', 'tainacan' ), 'label_sorting' => __( 'Sorting', 'tainacan' ), 'label_who_when' => __( 'Who and when', 'tainacan' ), + 'label_event_title' => __( 'Event', 'tainacan' ), // Instructions. More complex sentences to guide user and placeholders 'instruction_dragndrop_fields_collection' => __( 'Drag and drop Fields here to Collection.', 'tainacan' ), @@ -182,6 +183,9 @@ return [ 'info_warning_terms_not_saved' => __('Are you sure? There are terms not saved, changes will be lost.', 'tainacan'), 'info_warning_orphan_terms' => __('Are you sure? This term is parent of other terms. These will be converted to root terms.', 'tainacan'), 'info_there_is_no_field' => __('There is no field here.', 'tainacan' ), + 'info_no_events' => __( 'No events', 'tainacan' ), + 'info_logs_before' => __( 'Before updating', 'tainacan' ), + 'info_logs_after' => __( 'What was updated', 'tainacan' ), // Tainacan Field Types 'tainacan-text' => __( 'Text', 'tainacan' ), diff --git a/src/classes/repositories/class-tainacan-fields.php b/src/classes/repositories/class-tainacan-fields.php index 5384c8427..36401c991 100644 --- a/src/classes/repositories/class-tainacan-fields.php +++ b/src/classes/repositories/class-tainacan-fields.php @@ -22,10 +22,8 @@ class Fields extends Repository { private static $instance = null; - public static function getInstance() - { - if(!isset(self::$instance)) - { + public static function getInstance() { + if(!isset(self::$instance)) { self::$instance = new self(); } @@ -617,6 +615,7 @@ class Fields extends Repository { * @param $field_id * * @return array|null|object + * @throws \Exception */ public function fetch_all_field_values($collection_id, $field_id){ global $wpdb; @@ -736,15 +735,16 @@ class Fields extends Repository { } $this->current_taxonomy = $current_tax; } - + /** * Triggers hooks when saving a Category Field, indicating wich taxonomy was added or removed from a collection. * * This is used by Taxonomies repository to update the collections_ids property of the taxonomy as * a field type category is inserted or removed - * + * * @param [type] $field [description] - * @return [type] [description] + * + * @return void [type] [description] */ private function update_category_field($field) { $field_type = $field->get_field_type_object(); diff --git a/src/classes/repositories/class-tainacan-logs.php b/src/classes/repositories/class-tainacan-logs.php index e29d221d7..50d646642 100644 --- a/src/classes/repositories/class-tainacan-logs.php +++ b/src/classes/repositories/class-tainacan-logs.php @@ -210,14 +210,14 @@ class Logs extends Repository { public function fetch_last() { $args = [ 'post_type' => Entities\Log::get_post_type(), - 'posts_per_page' => -1, - 'orderby' => 'date', + 'posts_per_page' => 1, + 'orderby' => 'ID', 'order' => 'DESC' ]; $logs = $this->fetch( $args, 'OBJECT' ); - return array_pop( $logs ); + return array_pop($logs); } /** @@ -234,16 +234,28 @@ class Logs extends Repository { if ( is_object( $new_value ) ) { // do not log a log - if ( method_exists( $new_value, 'get_post_type' ) && $new_value->get_post_type() == 'tainacan-log' ) { + if ( method_exists( $new_value, 'get_post_type' ) && $new_value->get_post_type() == 'tainacan-log' || $new_value->get_status() === 'auto-draft' ) { return; } + if($new_value instanceof Entities\Field){ + $type = $new_value->get_field_type(); + + if($type === 'Tainacan\Field_Types\Core_Title' || $type === 'Tainacan\Field_Types\Core_Description'){ + return; + } + } + $type = get_class( $new_value ); $class_name = explode('\\', $type)[2]; $name = method_exists($new_value, 'get_name') ? $new_value->get_name() : (method_exists($new_value, 'get_title') ? $new_value->get_title() : $new_value->get_field()->get_name()); + if(!$name){ + $name = $new_value->get_status(); + } + $articleA = 'A'; $articleAn = 'An'; $vowels = 'aeiou'; @@ -251,19 +263,32 @@ class Logs extends Repository { if($is_update){ if(substr_count($vowels, strtolower(substr($class_name, 0, 1))) > 0){ $msn = sprintf( __( '%s %s has been updated.', 'tainacan' ), $articleAn, $class_name); - $description = sprintf( __("The \"%s\" %s has been updated.", 'tainacan' ), $name, strtolower($class_name)); } else { $msn = sprintf( __( '%s %s has been updated.', 'tainacan' ), $articleA, $class_name); - $description = sprintf( __("The \"%s\" %s has been updated.", 'tainacan' ), $name, strtolower($class_name)); } - + $description = sprintf( __("The \"%s\" %s has been updated.", 'tainacan' ), $name, strtolower($class_name)); } else { if(substr_count($vowels, strtolower(substr($class_name, 0, 1))) > 0){ $msn = sprintf( __( '%s %s has been created.', 'tainacan' ), $articleAn, $class_name); - $description = sprintf( __("The \"%s\" %s has been created.", 'tainacan' ), $name, strtolower($class_name)); } else { $msn = sprintf( __( '%s %s has been created.', 'tainacan' ), $articleA, $class_name); - $description = sprintf( __("The \"%s\" %s has been created.", 'tainacan' ), $name, strtolower($class_name)); + } + + if($new_value instanceof Entities\Field){ + $collection = $new_value->get_collection(); + $parent = $collection; + + if($collection) { + $parent = $collection->get_name(); + + if ( ! $parent ) { + $parent = $collection->get_status(); + } + } + + $description = sprintf( __( "The \"%s\" %s has been created on %s.", 'tainacan' ), $name, strtolower( $class_name ), $parent ); + } else { + $description = sprintf( __( "The \"%s\" %s has been created.", 'tainacan' ), $name, strtolower( $class_name ) ); } } } diff --git a/src/classes/repositories/class-tainacan-repository.php b/src/classes/repositories/class-tainacan-repository.php index 0220c9618..66e07024c 100644 --- a/src/classes/repositories/class-tainacan-repository.php +++ b/src/classes/repositories/class-tainacan-repository.php @@ -637,7 +637,7 @@ abstract class Repository { foreach ( $map as $prop => $mapped ) { if ( $old_entity->get_mapped_property( $prop ) != $new_entity->get_mapped_property( $prop ) ) { - if ( $mapped['map'] == 'meta_multi' ) { + if ( $mapped['map'] == 'meta_multi' || is_array($new_entity->get_mapped_property( $prop ))) { // Array of diffs with index of diff in new array $array_diff_with_index = array_diff_assoc($new_entity->get_mapped_property( $prop ), $old_entity->get_mapped_property( $prop )); @@ -650,7 +650,7 @@ abstract class Repository { 'diff_with_index' => $array_diff_with_index, ]; } - } else { + } else if($mapped['map'] !== 'post_modified') { $new_as_array = explode(' ', $new_entity->get_mapped_property( $prop )); $old_as_array = explode(' ', $old_entity->get_mapped_property( $prop )); diff --git a/src/js/store/modules/event/actions.js b/src/js/store/modules/event/actions.js index 0b7aa749c..5ff5f0ac9 100644 --- a/src/js/store/modules/event/actions.js +++ b/src/js/store/modules/event/actions.js @@ -3,7 +3,7 @@ import axios from '../../../axios/axios' export const fetchEvents = ({ commit }, { page, eventsPerPage } ) => { return new Promise((resolve, reject) => { - axios.tainacan.get(`/logs?paged=${page}&perpage=${eventsPerPage}`) + axios.tainacan.get(`/logs?paged=${page}&perpage=${eventsPerPage}&context=edit`) .then(res => { let events = res.data; diff --git a/tests/test-collections.php b/tests/test-collections.php index ed23daf70..9a35c2f09 100644 --- a/tests/test-collections.php +++ b/tests/test-collections.php @@ -306,11 +306,11 @@ class Collections extends TAINACAN_UnitTestCase { $diff = $x->diff(); $this->assertEquals(3, count($diff)); - $this->assertEquals($diff['name']['new'], 'OtherValue'); + $this->assertEquals($diff['name']['new'][0], 'OtherValue'); $this->assertEquals($diff['name']['old'], 'testeDiff'); - $this->assertEquals($diff['description']['new'], 'testeDiff2'); + $this->assertEquals($diff['description']['new'][0], 'testeDiff2'); $this->assertEquals($diff['description']['old'], 'adasdasdsa'); - $this->assertEquals([1 => 4, 2 => 5], $diff['moderators_ids']['diff']); + $this->assertEquals([1 => 4, 2 => 5, 0 => 3], $diff['moderators_ids']['diff_with_index']); } } From 730d6289bb04f1a53b803e382f5fde7ee8466a30 Mon Sep 17 00:00:00 2001 From: juliannyas Date: Wed, 11 Apr 2018 16:39:21 -0300 Subject: [PATCH 2/9] 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