@@ -22,6 +22,7 @@ import expect from '@kbn/expect';
2222export default function ( { getService, getPageObjects } ) {
2323 const PageObjects = getPageObjects ( [ 'dashboard' , 'header' , 'common' ] ) ;
2424 const browser = getService ( 'browser' ) ;
25+ const listingTable = getService ( 'listingTable' ) ;
2526
2627 describe ( 'dashboard listing page' , function describeIndexTests ( ) {
2728 const dashboardName = 'Dashboard Listing Test' ;
@@ -41,7 +42,8 @@ export default function({ getService, getPageObjects }) {
4142 await PageObjects . dashboard . saveDashboard ( dashboardName ) ;
4243
4344 await PageObjects . dashboard . gotoDashboardLandingPage ( ) ;
44- const countOfDashboards = await PageObjects . dashboard . getDashboardCountWithName (
45+ const countOfDashboards = await listingTable . searchAndGetItemsCount (
46+ 'dashboard' ,
4547 dashboardName
4648 ) ;
4749 expect ( countOfDashboards ) . to . equal ( 1 ) ;
@@ -53,7 +55,8 @@ export default function({ getService, getPageObjects }) {
5355 } ) ;
5456
5557 it ( 'is not shown when there are no dashboards shown during a search' , async function ( ) {
56- const countOfDashboards = await PageObjects . dashboard . getDashboardCountWithName (
58+ const countOfDashboards = await listingTable . searchAndGetItemsCount (
59+ 'dashboard' ,
5760 'gobeldeguck'
5861 ) ;
5962 expect ( countOfDashboards ) . to . equal ( 0 ) ;
@@ -65,29 +68,31 @@ export default function({ getService, getPageObjects }) {
6568
6669 describe ( 'delete' , function ( ) {
6770 it ( 'default confirm action is cancel' , async function ( ) {
68- await PageObjects . dashboard . searchForDashboardWithName ( dashboardName ) ;
69- await PageObjects . dashboard . checkDashboardListingSelectAllCheckbox ( ) ;
70- await PageObjects . dashboard . clickDeleteSelectedDashboards ( ) ;
71+ await listingTable . searchForItemWithName ( dashboardName ) ;
72+ await listingTable . checkListingSelectAllCheckbox ( ) ;
73+ await listingTable . clickDeleteSelected ( ) ;
7174
7275 await PageObjects . common . expectConfirmModalOpenState ( true ) ;
7376
7477 await PageObjects . common . pressEnterKey ( ) ;
7578
7679 await PageObjects . common . expectConfirmModalOpenState ( false ) ;
7780
78- const countOfDashboards = await PageObjects . dashboard . getDashboardCountWithName (
81+ const countOfDashboards = await listingTable . searchAndGetItemsCount (
82+ 'dashboard' ,
7983 dashboardName
8084 ) ;
8185 expect ( countOfDashboards ) . to . equal ( 1 ) ;
8286 } ) ;
8387
8488 it ( 'succeeds on confirmation press' , async function ( ) {
85- await PageObjects . dashboard . checkDashboardListingSelectAllCheckbox ( ) ;
86- await PageObjects . dashboard . clickDeleteSelectedDashboards ( ) ;
89+ await listingTable . checkListingSelectAllCheckbox ( ) ;
90+ await listingTable . clickDeleteSelected ( ) ;
8791
8892 await PageObjects . common . clickConfirmOnModal ( ) ;
8993
90- const countOfDashboards = await PageObjects . dashboard . getDashboardCountWithName (
94+ const countOfDashboards = await listingTable . searchAndGetItemsCount (
95+ 'dashboard' ,
9196 dashboardName
9297 ) ;
9398 expect ( countOfDashboards ) . to . equal ( 0 ) ;
@@ -96,44 +101,45 @@ export default function({ getService, getPageObjects }) {
96101
97102 describe ( 'search' , function ( ) {
98103 before ( async ( ) => {
99- await PageObjects . dashboard . clearSearchValue ( ) ;
104+ await listingTable . clearSearchFilter ( ) ;
100105 await PageObjects . dashboard . clickNewDashboard ( ) ;
101106 await PageObjects . dashboard . saveDashboard ( 'Two Words' ) ;
107+ await PageObjects . dashboard . gotoDashboardLandingPage ( ) ;
102108 } ) ;
103109
104110 it ( 'matches on the first word' , async function ( ) {
105- await PageObjects . dashboard . searchForDashboardWithName ( 'Two' ) ;
106- const countOfDashboards = await PageObjects . dashboard . getCountOfDashboardsInListingTable ( ) ;
111+ await listingTable . searchForItemWithName ( 'Two' ) ;
112+ const countOfDashboards = await listingTable . getItemsCount ( 'dashboard' ) ;
107113 expect ( countOfDashboards ) . to . equal ( 1 ) ;
108114 } ) ;
109115
110116 it ( 'matches the second word' , async function ( ) {
111- await PageObjects . dashboard . searchForDashboardWithName ( 'Words' ) ;
112- const countOfDashboards = await PageObjects . dashboard . getCountOfDashboardsInListingTable ( ) ;
117+ await listingTable . searchForItemWithName ( 'Words' ) ;
118+ const countOfDashboards = await listingTable . getItemsCount ( 'dashboard' ) ;
113119 expect ( countOfDashboards ) . to . equal ( 1 ) ;
114120 } ) ;
115121
116122 it ( 'matches the second word prefix' , async function ( ) {
117- await PageObjects . dashboard . searchForDashboardWithName ( 'Wor' ) ;
118- const countOfDashboards = await PageObjects . dashboard . getCountOfDashboardsInListingTable ( ) ;
123+ await listingTable . searchForItemWithName ( 'Wor' ) ;
124+ const countOfDashboards = await listingTable . getItemsCount ( 'dashboard' ) ;
119125 expect ( countOfDashboards ) . to . equal ( 1 ) ;
120126 } ) ;
121127
122128 it ( 'does not match mid word' , async function ( ) {
123- await PageObjects . dashboard . searchForDashboardWithName ( 'ords' ) ;
124- const countOfDashboards = await PageObjects . dashboard . getCountOfDashboardsInListingTable ( ) ;
129+ await listingTable . searchForItemWithName ( 'ords' ) ;
130+ const countOfDashboards = await listingTable . getItemsCount ( 'dashboard' ) ;
125131 expect ( countOfDashboards ) . to . equal ( 0 ) ;
126132 } ) ;
127133
128134 it ( 'is case insensitive' , async function ( ) {
129- await PageObjects . dashboard . searchForDashboardWithName ( 'two words' ) ;
130- const countOfDashboards = await PageObjects . dashboard . getCountOfDashboardsInListingTable ( ) ;
135+ await listingTable . searchForItemWithName ( 'two words' ) ;
136+ const countOfDashboards = await listingTable . getItemsCount ( 'dashboard' ) ;
131137 expect ( countOfDashboards ) . to . equal ( 1 ) ;
132138 } ) ;
133139
134140 it ( 'is using AND operator' , async function ( ) {
135- await PageObjects . dashboard . searchForDashboardWithName ( 'three words' ) ;
136- const countOfDashboards = await PageObjects . dashboard . getCountOfDashboardsInListingTable ( ) ;
141+ await listingTable . searchForItemWithName ( 'three words' ) ;
142+ const countOfDashboards = await listingTable . getItemsCount ( 'dashboard' ) ;
137143 expect ( countOfDashboards ) . to . equal ( 0 ) ;
138144 } ) ;
139145 } ) ;
@@ -176,7 +182,7 @@ export default function({ getService, getPageObjects }) {
176182 } ) ;
177183
178184 it ( 'preloads search filter bar when there is no match' , async function ( ) {
179- const searchFilter = await PageObjects . dashboard . getSearchFilterValue ( ) ;
185+ const searchFilter = await listingTable . getSearchFilterValue ( ) ;
180186 expect ( searchFilter ) . to . equal ( '"nodashboardsnamedme"' ) ;
181187 } ) ;
182188
@@ -196,7 +202,7 @@ export default function({ getService, getPageObjects }) {
196202 } ) ;
197203
198204 it ( 'preloads search filter bar when there is more than one match' , async function ( ) {
199- const searchFilter = await PageObjects . dashboard . getSearchFilterValue ( ) ;
205+ const searchFilter = await listingTable . getSearchFilterValue ( ) ;
200206 expect ( searchFilter ) . to . equal ( '"two words"' ) ;
201207 } ) ;
202208
0 commit comments