diff --git a/tests/selenium/specs/savepreviewdiff.js b/tests/selenium/specs/savepreviewdiff.js
index 64d44bfd7..ed0fe8497 100644
--- a/tests/selenium/specs/savepreviewdiff.js
+++ b/tests/selenium/specs/savepreviewdiff.js
@@ -1,225 +1,150 @@
'use strict';
const assert = require( 'assert' ),
EditConflictPage = require( '../pageobjects/editconflict.page' ),
FinishedConflictPage = require( '../pageobjects/finishedconflict.page' ),
TestAccounts = require( '../test_accounts' ),
Util = require( 'wdio-mediawiki/Util' );
describe( 'TwoColConflict save and preview', function () {
before( function () {
EditConflictPage.prepareEditConflict();
} );
- it( 'should resolve the conflict successfully', function () {
+ it( 'should save a resolved conflict successfully', function () {
EditConflictPage.showSimpleConflict();
- EditConflictPage.otherParagraphSelection.click();
-
+ EditConflictPage.yourParagraphSelection.click();
+ EditConflictPage.getEditButton( 'your' ).click();
+ EditConflictPage.getEditor( 'your' ).setValue( 'Dummy Text' );
EditConflictPage.submitButton.click();
assert.strictEqual(
FinishedConflictPage.pageWikitext,
- 'Line1\n\nChange A'
+ 'Line1\n\nDummy Text'
);
} );
- it( 'should resolve the ongoing conflict successfully when another user edits a different section in the meantime', function () {
+ it( 'should save a resolved conflict successfully when another user edits a different section in the meantime', function () {
const title = Util.getTestString( 'conflict-title-' );
// an initial conflict in a specific section
EditConflictPage.createConflict(
'==A==\nSectionA\n==B==\nSectionB',
'==A==\nSectionA\n==B==\nEdit1 Other',
'==B==\nEdit2\\r Your',
title,
2
);
EditConflictPage.waitForJS();
// a user editing a different section while the initial conflict is still being resolved
EditConflictPage.editPage(
TestAccounts.other,
title,
'==A==\nEdit3\n==B==\nEdit1 Other'
);
EditConflictPage.yourParagraphSelection.click();
EditConflictPage.getEditButton( 'your' ).click();
EditConflictPage.submitButton.click();
assert.strictEqual(
FinishedConflictPage.pageWikitext,
'==A==\nEdit3\n==B==\nEdit2\\r Your'
);
} );
it( 'should trigger a new conflict when another user edits in the same lines in the meantime', function () {
const title = Util.getTestString( 'conflict-title-' );
// an initial conflict
EditConflictPage.createConflict(
'Line1\nLine2',
'Line1\nChange A',
'Line1\nChange B',
title
);
EditConflictPage.waitForJS();
// a user editing in a line affected by the conflict above
EditConflictPage.editPage(
TestAccounts.other,
title,
'Line1\nThird Change C'
);
EditConflictPage.yourParagraphSelection.click();
EditConflictPage.getEditButton( 'your' ).click();
EditConflictPage.getEditor( 'your' ).setValue( 'Merged AB' );
EditConflictPage.submitButton.click();
assert(
EditConflictPage.conflictHeader.isExisting() &&
EditConflictPage.conflictView.isExisting(),
'there will be another edit conflict'
);
assert.strictEqual(
EditConflictPage.getDiffText( 'other' ).getText(),
'Third Change C',
'the other text will be the text of the third edit'
);
assert.strictEqual(
EditConflictPage.getDiffText( 'your' ).getText(),
'Merged AB',
'your text will be the result of the first merge'
);
} );
- it( 'should resolve the conflict successfully when unsaved edits in selected paragraphs are present', function () {
- EditConflictPage.showSimpleConflict();
-
- EditConflictPage.yourParagraphSelection.click();
- EditConflictPage.getEditButton( 'your' ).click();
- EditConflictPage.getEditor( 'your' ).setValue( 'Dummy Text' );
- EditConflictPage.submitButton.click();
-
- assert.strictEqual(
- FinishedConflictPage.pageWikitext,
- 'Line1\n\nDummy Text'
- );
- } );
-
- it( 'should show a preview page', function () {
- EditConflictPage.showSimpleConflict();
-
- EditConflictPage.otherParagraphSelection.click();
-
- EditConflictPage.previewButton.click();
-
- assert(
- EditConflictPage.previewView.waitForDisplayed(),
- 'I see a preview page for my changes'
- );
-
- assert.strictEqual(
- EditConflictPage.previewText.getText(),
- 'Line1\n\nChange A',
- 'text preview shows correctly'
- );
- } );
-
- it( 'should show a correct preview page when unsaved edits in selected paragraphs are present', function () {
- EditConflictPage.showSimpleConflict();
-
- EditConflictPage.yourParagraphSelection.click();
- EditConflictPage.getEditButton( 'your' ).click();
- EditConflictPage.getEditor( 'your' ).setValue( 'Dummy Text' );
- EditConflictPage.previewButton.click();
-
- assert(
- EditConflictPage.previewView.waitForDisplayed(),
- 'I see a preview page for my changes'
- );
-
- assert.strictEqual(
- EditConflictPage.previewText.getText(),
- 'Line1\n\nDummy Text'
- );
- } );
-
- it( 'should show a correct preview page when using pre-save transforms', function () {
+ it( 'should show a correct preview page when changes are present', function () {
EditConflictPage.showSimpleConflict();
EditConflictPage.yourParagraphSelection.click();
EditConflictPage.getEditButton( 'your' ).click();
+ // make sure that pre-save transforms are rendered correctly
EditConflictPage.getEditor( 'your' ).setValue( 'Dummy Text [[title (topic)|]]' );
EditConflictPage.previewButton.click();
assert(
EditConflictPage.previewView.waitForDisplayed(),
'I see a preview page for my changes'
);
assert.strictEqual(
EditConflictPage.previewText.getText(),
'Line1\n\nDummy Text title'
);
} );
it( 'should be possible to edit and preview the left ("other") side', function () {
EditConflictPage.showSimpleConflict();
EditConflictPage.otherParagraphSelection.click();
EditConflictPage.getEditButton( 'other' ).click();
EditConflictPage.getEditor( 'other' ).setValue( 'Other, but improved' );
EditConflictPage.previewButton.click();
assert(
EditConflictPage.previewView.waitForDisplayed(),
'The preview appears'
);
assert.strictEqual(
EditConflictPage.previewText.getText(),
'Line1\n\nOther, but improved',
'My edit appears in the preview'
);
assert.strictEqual(
EditConflictPage.getEditor( 'other' ).getValue(),
'Other, but improved',
'I can continue the edit I started'
);
} );
- it( 'editor should not decode html entities', function () {
- EditConflictPage.createConflict(
- 'α\nβ',
- 'α\nγ A',
- 'α\nγ B'
- );
- EditConflictPage.waitForJS();
-
- EditConflictPage.otherParagraphSelection.click();
-
- EditConflictPage.getEditButton( 'other' ).click();
-
- assert.strictEqual(
- EditConflictPage.getEditor().getValue(),
- 'α\n',
- 'unchanged text editor did not decode html entities'
- );
-
- assert.strictEqual(
- EditConflictPage.getEditor( 'other' ).getValue(),
- 'γ A\n',
- 'selectable text editor did not decode html entities'
- );
- } );
-
after( function () {
browser.deleteCookies();
} );
} );
diff --git a/tests/selenium/specs/twocolconflict.js b/tests/selenium/specs/twocolconflict.js
index 26a1f728a..2a7eab2bd 100644
--- a/tests/selenium/specs/twocolconflict.js
+++ b/tests/selenium/specs/twocolconflict.js
@@ -1,81 +1,106 @@
'use strict';
const assert = require( 'assert' ),
EditConflictPage = require( '../pageobjects/editconflict.page' ),
PreferencesPage = require( '../pageobjects/preferences.page' );
describe( 'TwoColConflict', function () {
before( function () {
EditConflictPage.prepareEditConflict();
} );
it( 'labels change according to selected column', function () {
EditConflictPage.showSimpleConflict();
const initialText = EditConflictPage.selectionLabel.getText();
EditConflictPage.yourParagraphSelection.click();
const yourSelectionText = EditConflictPage.selectionLabel.getText();
assert(
initialText !== yourSelectionText,
'Your side is selected when you click the row\'s radio button'
);
EditConflictPage.otherParagraphAllSelection.click();
const otherSelectionText = EditConflictPage.selectionLabel.getText();
assert(
yourSelectionText !== otherSelectionText && initialText !== otherSelectionText,
'The other side is selected when you click the other side\'s select all button'
);
} );
+ it( 'editor should not decode html entities', function () {
+ EditConflictPage.createConflict(
+ 'α\nβ',
+ 'α\nγ A',
+ 'α\nγ B'
+ );
+ EditConflictPage.waitForJS();
+
+ EditConflictPage.otherParagraphSelection.click();
+
+ EditConflictPage.getEditButton( 'other' ).click();
+
+ assert.strictEqual(
+ EditConflictPage.getEditor().getValue(),
+ 'α\n',
+ 'unchanged text editor did not decode html entities'
+ );
+
+ assert.strictEqual(
+ EditConflictPage.getEditor( 'other' ).getValue(),
+ 'γ A\n',
+ 'selectable text editor did not decode html entities'
+ );
+ } );
+
it( 'shows a dismissible hint on the core edit conflict interface', function () {
try {
PreferencesPage.openBetaFeaturesPreferences();
} catch ( e ) {
this.skip( 'Failed to load beta preferences.' );
}
if ( PreferencesPage.hasBetaFeatureSetting() ) {
this.skip( 'Is run in beta feature mode.' );
}
PreferencesPage.shouldUseTwoColConflict( false );
PreferencesPage.resetCoreHintVisibility();
EditConflictPage.createConflict(
'A',
'B',
'C'
);
assert(
EditConflictPage.coreUiHint.isDisplayed(),
'the core conflict UI shows a hint to enable the new interface'
);
EditConflictPage.waitForJS();
EditConflictPage.coreUiHintCloseButton.click();
assert(
!EditConflictPage.coreUiHint.isDisplayed(),
'the hint on the core conflict is hidden'
);
EditConflictPage.createConflict(
'A',
'B',
'C'
);
assert(
!EditConflictPage.coreUiHint.isDisplayed(),
'the hint on the core conflict is hidden on the next conflict'
);
} );
after( function () {
browser.deleteCookies();
} );
} );