Selenium: More explicitly target reference links

The previous selector in the case of the first reference link
matches two elements - one in the "Reference links" section
and one in the "References" section.

My hunch is this leads to the test failures we have been seeing

Bug: T344072
Change-Id: Icda37b4f46add4049344f7a8c452082d7b0df5c8
This commit is contained in:
Jon Robson 2023-09-21 15:47:24 -07:00 committed by Jdlrobson
parent 0d591abfe7
commit a11d459ef1
2 changed files with 6 additions and 6 deletions

View file

@ -84,8 +84,8 @@ class PopupsPage extends Page {
await $( PAGE_POPUPS_LINK_SELECTOR ).moveTo();
}
async dwellReferenceLink( num ) {
await this.dwellLink( `.reference:nth-of-type(${num}) a` );
async dwellReferenceLink( id ) {
await this.dwellLink( `#${id} a` );
}
async dwellReferenceInceptionLink() {

View file

@ -21,7 +21,7 @@ describe( 'Dwelling on a valid reference link', function () {
if ( !( await page.hasReferencePopupsEnabled() ) ) {
this.skip();
}
await page.dwellReferenceLink( 1 );
await page.dwellReferenceLink( 'cite_ref-1' );
assert( await page.seeReferencePreview(), 'Reference preview is shown.' );
assert( !( await page.seeScrollableReferencePreview() ), 'Reference preview is not scrollable.' );
assert( !( await page.seeFadeoutOnReferenceText() ), 'Reference preview has no fading effect' );
@ -31,7 +31,7 @@ describe( 'Dwelling on a valid reference link', function () {
if ( !( await page.hasReferencePopupsEnabled() ) ) {
this.skip();
}
await page.dwellReferenceLink( 1 );
await page.dwellReferenceLink( 'cite_ref-1' );
await page.abandonLink();
assert( await page.doNotSeeReferencePreview(), 'Reference preview is kept hidden.' );
} );
@ -41,7 +41,7 @@ describe( 'Dwelling on a valid reference link', function () {
if ( !( await page.hasReferencePopupsEnabled() ) ) {
this.skip();
}
await page.dwellReferenceLink( 2 );
await page.dwellReferenceLink( 'cite_ref-2' );
assert( await page.seeScrollableReferencePreview(), 'Reference preview is scrollable' );
assert( await page.seeFadeoutOnReferenceText(), 'Reference preview has a fading effect' );
} );
@ -50,7 +50,7 @@ describe( 'Dwelling on a valid reference link', function () {
if ( !( await page.hasReferencePopupsEnabled() ) ) {
this.skip();
}
await page.dwellReferenceLink( 3 );
await page.dwellReferenceLink( 'cite_ref-3' );
await page.dwellReferenceInceptionLink();
assert( await page.seeReferenceInceptionPreview(), 'The reference preview is still showing.' );
} );