Create E2E tests that cover the full lifecycle for subreferences in VisualEditor: create, edit, copy/reuse and delete.
Implement two separate test files:
- For pages using <references />
- For pages using the {{reflist}} template.
Starting scenario / fixture:
The page should already contain main and subrefs, and at least one main plus details reference.
Load the page in VisualEditor.
Scenarios for both test files:
- Create a new subreference for existing main ref
Given I have Wikitext with a ref and a reuse of a ref
And I load the VisualEditor
When I convert both references into sub-references.
Then It appears correctly in the article and references section.
And the references section displays the updated sub-reference content.
When I save the page.
Then the Wikitext reflects the updated sub-reference content and that the main content moved to a sub-ref.
- Edit the existing sub-reference
Given I have a main+details reference in Wikitext
And I load the VisualEditor
When I select and modify the sub-reference content.
Then the changes are reflected correctly in the article preview.
And the references section displays the updated sub-reference content.
And footnote numbers and backlinks remain consistent.
When I save the page.
Then the Wikitext reflects the updated sub-reference content.
- Delete the main reference to sub-reference
Given I have a named reference and a sub-reference to that main Wikitext
And I load the VisualEditor
When I remove the main reference
Then it is removed from the article
And the references list still shows it's content together with the indented sub-ref
When I save the page.
Then the Wikitext shows that the main content moved to the sub-ref.
Optional and only if possible
- Copy or reuse the subreference elsewhere in the article
When I select the subreference and use the reuse/copy dialog.
Then the subreference appears in the new location.
And footnote numbers, backlinks, and content remain consistent.