@@ -19,10 +19,18 @@ const {
1919 pressElement,
2020 goToPage,
2121 getFirstRow,
22- getAllDataFields ,
22+ getColumnCellsInnerTexts ,
2323 checkColumnBalloon,
2424} = require ( '../defaults' ) ;
25- const { reloadPage, waitForNetworkIdleAndRedraw, fillInput, getInnerText, getPopoverSelector, waitForTimeout } = require ( '../defaults.js' ) ;
25+ const {
26+ reloadPage,
27+ waitForNetworkIdleAndRedraw,
28+ fillInput,
29+ getInnerText,
30+ getPopoverSelector,
31+ waitForTimeout,
32+ waitForTableDataReload,
33+ } = require ( '../defaults.js' ) ;
2634
2735const { expect } = chai ;
2836
@@ -204,7 +212,32 @@ module.exports = () => {
204212 expect ( unfilteredNumberOfRows ) . to . equal ( originalNumberOfRows ) ;
205213 } ) ;
206214
215+ it ( 'should successfully provide an easy to access button to filter in/out anonymous logs' , async ( ) => {
216+ await reloadPage ( page ) ;
217+ {
218+ const authors = await getColumnCellsInnerTexts ( page , 'author' ) ;
219+ expect ( authors . some ( ( author ) => author === 'Anonymous' ) ) . to . be . true ;
220+ }
221+
222+ await waitForTableDataReload ( page , ( ) => pressElement ( page , '#main-action-bar > div:nth-child(1) .switch' ) ) ;
223+
224+ {
225+ const authors = await getColumnCellsInnerTexts ( page , 'author' ) ;
226+ expect ( authors . every ( ( author ) => author !== 'Anonymous' ) ) . to . be . true ;
227+ }
228+
229+ await waitForTableDataReload ( page , ( ) => pressElement ( page , '#main-action-bar > div:nth-child(1) .switch' ) ) ;
230+
231+ {
232+ const authors = await getColumnCellsInnerTexts ( page , 'author' ) ;
233+ expect ( authors . some ( ( author ) => author === 'Anonymous' ) ) . to . be . true ;
234+ }
235+ } ) ;
236+
207237 it ( 'can filter by creation date' , async ( ) => {
238+ await pressElement ( page , '#openFilterToggle' ) ;
239+ await waitForTimeout ( 20 ) ;
240+
208241 // Increase the amount of items displayed to see logs count difference above 10
209242 await page . evaluate ( ( ) => {
210243 // eslint-disable-next-line no-undef
@@ -509,7 +542,7 @@ module.exports = () => {
509542 await waitForTimeout ( 300 ) ;
510543
511544 // Expect the log titles to be in alphabetical order
512- const firstTitles = await getAllDataFields ( page , 'title' ) ;
545+ const firstTitles = await getColumnCellsInnerTexts ( page , 'title' ) ;
513546 expect ( firstTitles ) . to . deep . equal ( firstTitles . sort ( ) ) ;
514547 // Hover something else to have title sort displayed
515548 await page . hover ( 'th#author' ) ;
@@ -522,15 +555,15 @@ module.exports = () => {
522555 await waitForTimeout ( 300 ) ;
523556
524557 // Expect the log titles to be in reverse alphabetical order
525- const secondTitles = await getAllDataFields ( page , 'title' ) ;
558+ const secondTitles = await getColumnCellsInnerTexts ( page , 'title' ) ;
526559 expect ( secondTitles ) . to . deep . equal ( secondTitles . sort ( ( a , b ) => b . localeCompare ( a ) ) ) ;
527560
528561 // Toggle to clear this sorting
529562 await titleHeader . evaluate ( ( button ) => button . click ( ) ) ;
530563 await waitForTimeout ( 300 ) ;
531564
532565 // Expect the log titles to no longer be sorted in any way
533- const thirdTitles = await getAllDataFields ( page , 'title' ) ;
566+ const thirdTitles = await getColumnCellsInnerTexts ( page , 'title' ) ;
534567 expect ( thirdTitles ) . to . not . deep . equal ( firstTitles ) ;
535568 expect ( thirdTitles ) . to . not . deep . equal ( secondTitles ) ;
536569
@@ -540,7 +573,7 @@ module.exports = () => {
540573 await waitForTimeout ( 300 ) ;
541574
542575 // Expect the authors to be in alphabetical order
543- const firstAuthors = await getAllDataFields ( page , 'author' ) ;
576+ const firstAuthors = await getColumnCellsInnerTexts ( page , 'author' ) ;
544577 expect ( firstAuthors ) . to . deep . equal ( firstAuthors . sort ( ) ) ;
545578
546579 // Sort by creation date in ascending manner
@@ -549,7 +582,7 @@ module.exports = () => {
549582 await waitForTimeout ( 300 ) ;
550583
551584 // Expect the log author column to be unsorted
552- const secondAuthors = await getAllDataFields ( page , 'author' ) ;
585+ const secondAuthors = await getColumnCellsInnerTexts ( page , 'author' ) ;
553586 expect ( secondAuthors ) . to . not . deep . equal ( firstAuthors ) ;
554587 } ) ;
555588
0 commit comments