From 1a18ab3d385ec981927f8d806fba26e0927dcfac Mon Sep 17 00:00:00 2001 From: WMDE-Fisch Date: Fri, 29 Mar 2019 19:00:27 +0100 Subject: [PATCH] Add a few more selenium tests for the filter options Change-Id: I7bb14987e2f2ef452953fb2b71aae7f697a4d820 --- tests/selenium/pageobjects/diff.page.js | 12 +++-- tests/selenium/specs/filterhighlighting.js | 54 +++++++++++++++++++++- 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/tests/selenium/pageobjects/diff.page.js b/tests/selenium/pageobjects/diff.page.js index e53e218a..fe2a8db4 100644 --- a/tests/selenium/pageobjects/diff.page.js +++ b/tests/selenium/pageobjects/diff.page.js @@ -2,14 +2,16 @@ const Page = require( 'wdio-mediawiki/Page' ), Api = require( 'wdio-mediawiki/Api' ), BlankPage = require( 'wdio-mediawiki/BlankPage' ), Util = require( 'wdio-mediawiki/Util' ), - MWBot = require( 'mwbot' ); + MWBot = require( 'mwbot' ), + USER_BUBBLE_SELECTOR = '.mw-revslider-username-row .mw-revslider-bubble', + TAG_BUBBLE_SELECTOR = '.mw-revslider-tag-row:last-of-type .mw-revslider-bubble'; class DiffPage extends Page { get rsMain() { return browser.element( '.mw-revslider-revision-slider' ); } get rsToggleButton() { return browser.element( '.mw-revslider-toggle-button' ); } - get rsUserFilterBubble() { return browser.element( '.mw-revslider-username-row .mw-revslider-bubble' ); } - get rsTagFilterBubble() { return browser.element( '.mw-revslider-tag-row:last-of-type .mw-revslider-bubble' ); } + get rsUserFilterBubble() { return browser.element( USER_BUBBLE_SELECTOR ); } + get rsTagFilterBubble() { return browser.element( TAG_BUBBLE_SELECTOR ); } getRevision( num ) { return browser.element( '.mw-revslider-revision[data-pos="' + num + '"]' ); } @@ -141,6 +143,10 @@ class DiffPage extends Page { browser.waitForVisible( '.mw-revslider-revision-tooltip-' + num ); } + dwellTagFilterBubble() { + browser.moveToObject( TAG_BUBBLE_SELECTOR ); + } + abondonBubbleDwell() { // make sure we do not dwell the line/bubble after clicking browser.moveToObject( '.mw-revslider-revision-tooltip p:first-of-type' ); diff --git a/tests/selenium/specs/filterhighlighting.js b/tests/selenium/specs/filterhighlighting.js index bbffeeef..5146980c 100644 --- a/tests/selenium/specs/filterhighlighting.js +++ b/tests/selenium/specs/filterhighlighting.js @@ -38,7 +38,10 @@ describe( 'RevisionSlider filter highlighting', function () { DiffPage.clickUserFilterBubble(); DiffPage.clickUserFilterBubble(); - assert( !DiffPage.highlightsBubble( DiffPage.rsUserFilterBubble ) ); + assert( + !DiffPage.highlightsBubble( DiffPage.rsUserFilterBubble ), + 'the user filter bubble should not be highlighted' + ); assert( !DiffPage.highlightsRevision( 1 ) && !DiffPage.highlightsRevision( 2 ) && @@ -65,4 +68,53 @@ describe( 'RevisionSlider filter highlighting', function () { ); } ); + it( 'highlights revisions that have the same tag when I use the tag filter after I used the user filter', function () { + DiffPage.dwellRevision( 4 ); + DiffPage.clickUserFilterBubble(); + DiffPage.clickTagFilterBubble(); + + assert( + !DiffPage.highlightsBubble( DiffPage.rsUserFilterBubble ), + 'the user filter bubble should not be highlighted' + ); + assert( + DiffPage.highlightsBubble( DiffPage.rsTagFilterBubble ), + 'the tag filter bubble should be highlighted' + ); + assert( + DiffPage.highlightsRevision( 4 ), + 'does highlight revisions with the selected tag' + ); + assert( + !DiffPage.highlightsRevision( 1 ) && + !DiffPage.highlightsRevision( 2 ) && + !DiffPage.highlightsRevision( 3 ), + 'does not highlight revisions without the selected tag' + ); + } ); + + it( 'only highlights revisions that have the same tag when I selected a user but hover a tag filter', function () { + DiffPage.dwellRevision( 4 ); + DiffPage.clickUserFilterBubble(); + DiffPage.dwellTagFilterBubble(); + + assert( + DiffPage.highlightsBubble( DiffPage.rsUserFilterBubble ), + 'the user filter bubble should still be highlighted' + ); + assert( + DiffPage.highlightsBubble( DiffPage.rsTagFilterBubble ), + 'the tag filter bubble should be highlighted' + ); + assert( + DiffPage.highlightsRevision( 4 ), + 'does highlight revisions with the selected tag' + ); + assert( + !DiffPage.highlightsRevision( 1 ) && + !DiffPage.highlightsRevision( 2 ) && + !DiffPage.highlightsRevision( 3 ), + 'does not highlight revisions without the selected tag' + ); + } ); } );