2024-01-30 13:37:11 +00:00
|
|
|
import * as helpers from './../../utils/functions.helper.js';
|
2024-03-14 12:47:21 +00:00
|
|
|
const title = helpers.getTestString( 'CiteTest-title' );
|
2024-01-30 13:37:11 +00:00
|
|
|
|
2024-03-15 18:15:57 +00:00
|
|
|
const refText1 = 'This is citation #1 for reference #1 and #2';
|
2024-03-15 18:29:11 +00:00
|
|
|
const refText2 = 'This is citation #2 for reference #3';
|
|
|
|
|
2024-03-15 18:15:57 +00:00
|
|
|
const wikiText = `This is reference #1: <ref name="a">${ refText1 }</ref><br> ` +
|
|
|
|
'This is reference #2 <ref name="a" /><br>' +
|
2024-03-15 18:29:11 +00:00
|
|
|
`This is reference #3 <ref>${ refText2 }</ref><br>` +
|
2024-03-15 18:15:57 +00:00
|
|
|
'<references />';
|
|
|
|
|
2024-01-30 13:37:11 +00:00
|
|
|
describe( 'Visual Editor Cite Integration', () => {
|
|
|
|
before( () => {
|
|
|
|
cy.visit( '/index.php' );
|
2024-03-15 18:15:57 +00:00
|
|
|
helpers.editPage( title, wikiText );
|
|
|
|
} );
|
2024-01-30 13:37:11 +00:00
|
|
|
|
2024-03-15 18:15:57 +00:00
|
|
|
beforeEach( () => {
|
|
|
|
helpers.visitTitle( title );
|
2024-01-30 13:37:11 +00:00
|
|
|
|
|
|
|
cy.window().then( async ( win ) => {
|
2024-03-14 12:47:21 +00:00
|
|
|
win.localStorage.setItem( 've-beta-welcome-dialog', 1 );
|
2024-01-30 13:37:11 +00:00
|
|
|
} );
|
|
|
|
|
2024-03-14 12:47:21 +00:00
|
|
|
helpers.visitTitle( title, { veaction: 'edit' } );
|
2024-03-15 18:15:57 +00:00
|
|
|
} );
|
2024-01-30 13:37:11 +00:00
|
|
|
|
2024-03-15 18:15:57 +00:00
|
|
|
it( 'should edit and verify reference content in Visual Editor', () => {
|
2024-01-30 13:37:11 +00:00
|
|
|
helpers.getVEFootnoteMarker( 'a', 1, 1 ).click();
|
2024-03-15 18:15:57 +00:00
|
|
|
|
2024-01-30 13:37:11 +00:00
|
|
|
// Popup appears containing ref content
|
|
|
|
helpers.getVEReferencePopup()
|
|
|
|
.should( 'be.visible' )
|
2024-03-15 18:15:57 +00:00
|
|
|
.should( 'contain.text', refText1 );
|
2024-01-30 13:37:11 +00:00
|
|
|
|
|
|
|
// Open edit popup
|
|
|
|
cy.contains( '.oo-ui-buttonElement-button', 'Edit' ).click();
|
|
|
|
|
|
|
|
// Dialog appears with ref content
|
|
|
|
helpers.getVEDialog()
|
|
|
|
.should( 'be.visible' )
|
2024-03-15 18:15:57 +00:00
|
|
|
.should( 'contain.text', refText1 );
|
2024-01-30 13:37:11 +00:00
|
|
|
} );
|
|
|
|
|
2024-03-15 18:29:11 +00:00
|
|
|
it( 'should display existing references in the Cite re-use dialog', () => {
|
|
|
|
helpers.openVECiteReuseDialog();
|
|
|
|
|
|
|
|
// Assert reference content for the first reference
|
|
|
|
helpers.getCiteReuseDialogRefName( 1 ).should( 'contain.text', 'a' );
|
|
|
|
helpers.getCiteReuseDialogRefNumber( 1 ).should( 'contain.text', '[1]' );
|
|
|
|
helpers.getCiteReuseDialogRefText( 1 ).should( 'have.text', refText1 );
|
|
|
|
|
|
|
|
// Assert reference content for the second reference
|
|
|
|
helpers.getCiteReuseDialogRefName( 2 ).should( 'contain.text', '' );
|
|
|
|
helpers.getCiteReuseDialogRefNumber( 2 ).should( 'contain.text', '[2]' );
|
|
|
|
helpers.getCiteReuseDialogRefText( 2 ).should( 'have.text', refText2 );
|
|
|
|
|
|
|
|
} );
|
|
|
|
|
2024-01-30 13:37:11 +00:00
|
|
|
} );
|