mediawiki-extensions-Cite/cypress/e2e/utils/functions.helper.js
mareikeheuer 0f801ea550 Port Cite web test suite to Cypress
Steps to implement:

 Copy over and adapt setup files, to install Cypress in the Cite code base.
 Port tests/selenium/specs/backlinks.js and supporting file cite.page.js to run under the Cypress environment, in a second patchset.
 Run the new suite in CI, replacing the previous selenium integration.
 Delete the selenium test suite.

Bug: T353436
Change-Id: Ie76371e18d8612daa7c7be741432c6f3e0b783b5
2024-01-17 11:45:04 +01:00

23 lines
648 B
JavaScript

export function getReference( num ) {
return cy.get( `#mw-content-text .reference:nth-of-type(${ num })` );
}
export function getCiteSubBacklink( num ) {
return cy.get( `.mw-cite-backlink sup:nth-of-type(${ num }) a` );
}
export function getCiteMultiBacklink( num ) {
return cy.get( `.references li:nth-of-type(${ num }) .mw-cite-up-arrow-backlink` );
}
export function getCiteSingleBacklink( num ) {
return cy.get( `.references li:nth-of-type(${ num }) .mw-cite-backlink a` );
}
export function getFragmentFromLink( linkElement ) {
return linkElement.invoke( 'attr', 'href' ).then( ( href ) => {
return href.split( '#' )[ 1 ];
} );
}