Add a few more selenium tests for the filter options

Change-Id: I7bb14987e2f2ef452953fb2b71aae7f697a4d820
This commit is contained in:
WMDE-Fisch 2019-03-29 19:00:27 +01:00
parent 9993e07546
commit 1a18ab3d38
2 changed files with 62 additions and 4 deletions

View file

@ -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' );

View file

@ -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'
);
} );
} );