User:Tgr (WMF)/DifferenceEngine/test plan


High priority[edit]

(probably should be tested before merging)
  • display diff page by going into page history and using the "Compare selected revisions" button
    • should have title , headers (two blocks with links to revisions, undo/edit links, user etc), diff, the HTML view of the right-hand version - compare with a diff in production
    • should have warning below the headers iff the revisions are not direct neighbors
    • the actual diff rendering logic was not touched, no
  • test that the right revisions get diffed when giving the parameters in various ways (mostly the same code path - no need to check all details, just verify that the right revisions are diffed):
    • "cur" link in page history"
    • prev link in page history
    • try non-existing revision id for the oldid and diff parameters (already somewhat broken - T201218)
  • test with left, right, both revision hidden/suppressed from the user
  • test diff ("view changes") when editing a page
    • try for page creation, and when editing an existing page
  • test edit conflict diff (edit concurrently with two different users to trigger)
    • also with multi-slot diff (only shows main slot; that needs to be fixed in EditPage, out of scope)
  • test diff on Special:Undelete (between one live and one deleted, two deleted revisions) (only shows main slot; like above)


  • create some multi-content revision (see below)
    • test diffs with multiple slots
    • test diff where some slot only exists on the left/right side
    • (the rendered HTML will only show the main slot; this is OK)
  • test multi-slot diff in mobile view (with MobileFrontend) - broken
    • multiple slots should display sanely
  • test multi-slot diff where main slot is Wikibase
    • multiple slots should display sanely
    • header should have a "restore" link
    • diff should reflect user language

Medium priority[edit]

(probably fine to test post-merge on Beta)
  • test multi-content diff where some slot is not text (e.g. Wikibase, see below for creating EntityContent objects)
  • test diff shown after rollback
  • test Special:ComparePages
  • Extension:Translate? (has lots of entry points, hook calls etc. for diff; I don't know it well enough to tell how to trigger them or whether they are important, though)

Low priority[edit]

(probably OK not to test)
  • test with left, right, both ID invalid (also with diff=prev/next when there is no prev/next revision)
  • test other diff engines (set $wgExternalDiffEngine to /dev/null, false (needs the wikidiff2 vagrant module) (is there a way to test the external executable path?)
  • test revision selection when ids are swapped in the URL
  • test with left, right, both revision hidden when the user has permission to see it
  • test with left, right, both revision suppressed when the user does / does not have permission to see it
  • ProofreadPage index/page diffs
  • diffto/difftotext parameters to prop=revisions API
  • recent changes RSS feed
  • test FlaggedRevs diff (where page has a non-current stable version) with diff=review (should make diff between current and stable revision)
  • other Wikimedia-deployed DifferenceEngine subclasses: JsonConfig, MassMessage, Newsletter
  • other Wikimedia-deployed DifferenceEngine callers: AbuseFilter (filter diff), Flow (diffs + undo) (caused T202454 for Flow)
  • other Wikimedia-deployed DifferenceEngine hook implementers: RevisionSlider (???), Thanks (thank link in header),
  • multi-slot diff in VisualEditor (no idea if that should work, probably depends on phab:T191795)

Creating test revisions[edit]

Set $wgMultiContentRevisionSchemaMigrationStage = SCHEMA_COMPAT_WRITE_BOTH | SCHEMA_COMPAT_READ_NEW, run foreachwiki populateContentTables.php (to convert existing revisions to the new schema), then use mwscript shell.php and run something like

$t = Title::newFromText( 'MCR test page' );
$wp = WikiPage::factory( $t );
$u = User::newSystemUser( 'MCR test user' );
$c = WikitextContentHandler::makeContent( 'some wikitext content', $t );
$c2 = WikitextContentHandler::makeContent( 'another wikitext content', $t );
$s = CommentStoreComment::newUnsavedComment( 'change slot and main' );
$pu = $wp->newPageUpdater( $u );
$pu->setContent( 'main', $c ); // this is the slot that's normally visible
$pu->setContent( 'slot', $c2 ); // 'slot' is the slot name, should be the same across revisions
// actually does not work, use something like psysh's sudo instead:
// sudo $pu->slotsUpdate->modifyContent( 'slot', $c );

To create Wikibase EntityContent, on a wiki that has the WikibaseRepo extension enabled:

$item = new \Wikibase\DataModel\Entity\Item( new \Wikibase\DataModel\Entity\ItemId( "Q12345" ) );
$item->setLabel( 'en', 'Test' );
$item->setLabel( 'ru', 'Тест' );

$factory = \Wikibase\Repo\Wikibaserepo::getDefaultInstance()->getEntityContentFactory();
$content = $factory->newFromEntity( $item );

Note that Wikibase entities may not render correctly when forced into pages that do not belong to an entity namespace. Also note that ItemIds that do not match the page title may cause some confusion, since this breaks basic assumptions made by Wikibase. Bu for showing diffs, this should be fine.

To directly create and Item page on a wiki that has the WikibaseRepo extension enabled, use Special:NewItem.