| @@ -70,10 +70,30 @@ | ||
| 70 | 70 | |
| 71 | 71 | $this->_addAction( 'visualizer_chart_schedules_spl', 'addSplChartSchedules', null, 10, 3 ); |
| 72 | 72 | |
| 73 | 73 | $this->_addAction( 'admin_init', 'init' ); |
| 74 | + | |
| 75 | + if ( defined( 'TI_CYPRESS_TESTING' ) ) { | |
| 76 | + $this->load_cypress_hooks(); | |
| 77 | + } | |
| 78 | + | |
| 74 | 79 | } |
| 75 | 80 | |
| 81 | + /** | |
| 82 | + * Define the hooks that are needed for cypress. | |
| 83 | + * | |
| 84 | + * @since 3.4.0 | |
| 85 | + * @access private | |
| 86 | + */ | |
| 87 | + private function load_cypress_hooks() { | |
| 88 | + // all charts should load on the same page without pagination. | |
| 89 | + add_filter( | |
| 90 | + 'visualizer_query_args', function( $args ) { | |
| 91 | + $args['posts_per_page'] = 20; | |
| 92 | + return $args; | |
| 93 | + }, 10, 1 | |
| 94 | + ); | |
| 95 | + } | |
| 76 | 96 | |
| 77 | 97 | /** |
| 78 | 98 | * Add disabled `optgroup` schedules to the drop downs. |
| 79 | 99 | * |
| @@ -740,9 +760,9 @@ | ||
| 740 | 760 | $meta = isset( $query_args['meta_query'] ) ? $query_args['meta_query'] : array(); |
| 741 | 761 | $meta[] = $query; |
| 742 | 762 | $query_args['meta_query'] = $meta; |
| 743 | 763 | } |
| 744 | - $q = new WP_Query( $query_args ); | |
| 764 | + $q = new WP_Query( apply_filters( 'visualizer_query_args', $query_args ) ); | |
| 745 | 765 | return $q; |
| 746 | 766 | } |
| 747 | 767 | |
| 748 | 768 | /** |