mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-23 22:45:20 +00:00
[Cypress] Retry toolbar clicks to open submenu
Introducing a little helper function that retries clicks until some element becomes visible. Bug: T360026 Change-Id: I45b7802c8009b9b552b41c1fcaf861f2a7afb495
This commit is contained in:
parent
4e935abb2e
commit
66996fe45d
|
@ -5,6 +5,17 @@ export function waitForVEToLoad() {
|
|||
.should( 'be.visible' );
|
||||
}
|
||||
|
||||
function clickUntilVisible( clickElement, expectedSelector ) {
|
||||
cy.get( expectedSelector ).then( ( $element ) => {
|
||||
if ( $element.is( ':visible' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
clickElement.click();
|
||||
clickUntilVisible( clickElement, expectedSelector );
|
||||
} );
|
||||
}
|
||||
|
||||
export function getTestString( prefix = '' ) {
|
||||
return prefix + Math.random().toString();
|
||||
}
|
||||
|
@ -81,7 +92,10 @@ export function getVEReferenceEditDialog() {
|
|||
}
|
||||
|
||||
export function openVECiteReuseDialog() {
|
||||
cy.get( '.ve-ui-toolbar-group-cite' ).click();
|
||||
clickUntilVisible(
|
||||
cy.get( '.ve-ui-toolbar-group-cite' ),
|
||||
'.ve-ui-toolbar .oo-ui-tool-name-reference-existing'
|
||||
);
|
||||
cy.get( '.ve-ui-toolbar .oo-ui-tool-name-reference-existing' ).click();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue