diff --git a/tests/js/system/data/acf4.php b/tests/js/system/data/acf4.php index 3f4af7de..dd2c7fac 100644 --- a/tests/js/system/data/acf4.php +++ b/tests/js/system/data/acf4.php @@ -100,4 +100,42 @@ ), 'menu_order' => 0, )); + + register_field_group(array ( + 'id' => 'acf_non-public-cpt', + 'title' => 'Non Public CPT', + 'fields' => array ( + array ( + 'key' => 'field_59e897a8755dc', + 'label' => 'Text', + 'name' => 'yoast_acf_analysis_text', + 'type' => 'text', + 'default_value' => '', + 'placeholder' => '', + 'prepend' => '', + 'append' => '', + 'formatting' => 'html', + 'maxlength' => '', + ), + ), + 'location' => array ( + array ( + array ( + 'param' => 'post_type', + 'operator' => '==', + 'value' => 'test_non_public_cpt', + 'order_no' => 0, + 'group_no' => 0, + ), + ), + ), + 'options' => array ( + 'position' => 'normal', + 'layout' => 'no_box', + 'hide_on_screen' => array ( + ), + ), + 'menu_order' => 0, + )); + } diff --git a/tests/js/system/data/acf5.php b/tests/js/system/data/acf5.php index c373195e..acc0339f 100644 --- a/tests/js/system/data/acf5.php +++ b/tests/js/system/data/acf5.php @@ -336,4 +336,50 @@ 'description' => '', )); + acf_add_local_field_group(array ( + 'key' => 'group_59e89863c6498', + 'title' => 'Non Public CPT', + 'fields' => array ( + array ( + 'key' => 'field_59e897a8755dc', + 'label' => 'Text', + 'name' => 'yoast_acf_analysis_text', + 'type' => 'text', + 'value' => NULL, + 'instructions' => '', + 'required' => 0, + 'conditional_logic' => 0, + 'wrapper' => array ( + 'width' => '', + 'class' => '', + 'id' => '', + ), + 'default_value' => '', + 'placeholder' => '', + 'prepend' => '', + 'append' => '', + 'formatting' => 'html', + 'maxlength' => '', + ), + ), + 'location' => array ( + array ( + array ( + 'param' => 'post_type', + 'operator' => '==', + 'value' => 'test_non_public_cpt', + ), + ), + ), + 'menu_order' => 0, + 'position' => 'normal', + 'style' => 'seamless', + 'label_placement' => 'top', + 'instruction_placement' => 'label', + 'hide_on_screen' => array ( + ), + 'active' => 1, + 'description' => '', + )); + endif; \ No newline at end of file diff --git a/tests/js/system/data/test-data-loader.php b/tests/js/system/data/test-data-loader.php index 0ad4dc46..21f713a5 100644 --- a/tests/js/system/data/test-data-loader.php +++ b/tests/js/system/data/test-data-loader.php @@ -21,4 +21,13 @@ function yoast_acf_analysis_test_data_loader() { require_once AC_SEO_ACF_ANALYSIS_PLUGIN_PATH . '/tests/js/system/data/acf' . $version . '.php'; + $args = array( + 'public' => false, + 'show_ui' => true, + 'supports' => array( 'thumbnail' ), + 'label' => 'Non Public CPT', + ); + + register_post_type( 'test_non_public_cpt', $args ); + } diff --git a/tests/js/system/pages/WordPressHelper.js b/tests/js/system/pages/WordPressHelper.js index 400407e6..a27b092a 100644 --- a/tests/js/system/pages/WordPressHelper.js +++ b/tests/js/system/pages/WordPressHelper.js @@ -29,8 +29,12 @@ module.exports = { this.click('@submitButton'); return this.waitForElementVisible('#adminmenu #menu-dashboard .current', 15000); }, - newPost: function(){ - this.api.url( this.api.launchUrl + '/wp/wp-admin/post-new.php' ); + newPost: function(cpt){ + if(cpt !== undefined){ + cpt = '?post_type=' + cpt; + } + cpt = cpt || ''; + this.api.url( this.api.launchUrl + '/wp/wp-admin/post-new.php' + cpt ); this.waitForElementVisible('body.post-new-php', 15000); return this.api.execute(function() { diff --git a/tests/js/system/tests/general/cpt.js b/tests/js/system/tests/general/cpt.js new file mode 100644 index 00000000..e924443b --- /dev/null +++ b/tests/js/system/tests/general/cpt.js @@ -0,0 +1,38 @@ +var simpleField = require('../../helpers/simpleField'); +var Logger = require('nightwatch/lib/util/logger.js'); + +module.exports = { + tags: ['acf4', 'acf5', 'cpt'], + + before: function (browser) { + var page = browser.page.WordPressHelper(); + page.newPost('test_non_public_cpt'); + }, + + beforeEach: function (browser) { + }, + + 'Custom Post Type (non public->no metabox)' : function (browser) { + browser.getLog('browser', function(logEntriesArray) { + + var errors = logEntriesArray.filter(function(log){ + return log.level === 'SEVERE'; + }); + + browser.assert.ok( errors.length === 0, "No JS errors thrown." ) + + var warnings = logEntriesArray.filter(function(log){ + return log.level === 'WARNING'; + }); + + warnings.forEach(function(log){ + console.log(Logger.colors.light_purple(' WARNING: ' + log.message)); + }); + + }); + }, + + after : function(browser) { + browser.end(); + } +};