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-03-19 13:49:33 +00:00
|
|
|
describe.skip( 'Visual Editor Cite Integration', () => {
|
2024-01-30 13:37:11 +00:00
|
|
|
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-26 15:02:26 +00:00
|
|
|
helpers.waitForVEToLoad();
|
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
|
2024-03-15 18:36:42 +00:00
|
|
|
helpers.getVEReferenceContextItem()
|
2024-01-30 13:37:11 +00:00
|
|
|
.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:36:42 +00:00
|
|
|
// Open reference edit dialog
|
|
|
|
helpers.getVEReferenceContextItemEdit().click();
|
2024-01-30 13:37:11 +00:00
|
|
|
|
|
|
|
// Dialog appears with ref content
|
2024-03-15 18:36:42 +00:00
|
|
|
helpers.getVEReferenceEditDialog()
|
2024-01-30 13:37:11 +00:00
|
|
|
.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
|
2024-03-15 18:36:42 +00:00
|
|
|
helpers.getCiteReuseDialogRefResultName( 1 ).should( 'have.text', 'a' );
|
|
|
|
helpers.getCiteReuseDialogRefResultCitation( 1 ).should( 'have.text', '[1]' );
|
2024-03-15 18:29:11 +00:00
|
|
|
helpers.getCiteReuseDialogRefText( 1 ).should( 'have.text', refText1 );
|
|
|
|
|
|
|
|
// Assert reference content for the second reference
|
2024-03-15 18:36:42 +00:00
|
|
|
helpers.getCiteReuseDialogRefResultName( 2 ).should( 'have.text', '' );
|
|
|
|
helpers.getCiteReuseDialogRefResultCitation( 2 ).should( 'have.text', '[2]' );
|
2024-03-15 18:29:11 +00:00
|
|
|
helpers.getCiteReuseDialogRefText( 2 ).should( 'have.text', refText2 );
|
|
|
|
|
|
|
|
} );
|
|
|
|
|
2024-01-30 13:37:11 +00:00
|
|
|
} );
|