-
-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3503 from grebaldi/bugfix/3184/document-move-discard
BUGFIX: Reflect discard of node move changes correctly in the UI
- Loading branch information
Showing
5 changed files
with
203 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
150 changes: 150 additions & 0 deletions
150
Tests/IntegrationTests/Fixtures/1Dimension/issue-3184.e2e.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
import {beforeEach, checkPropTypes} from './../../utils.js'; | ||
import {Page, PublishDropDown} from './../../pageModel'; | ||
import { Selector } from 'testcafe'; | ||
|
||
/* global fixture:true */ | ||
|
||
// | ||
// Original Issue: https://github.com/neos/neos-ui/issues/3184 | ||
// | ||
fixture`FIX #3184: Discarded node move changes are reflected correctly in the document tree` | ||
.beforeEach(beforeEach) | ||
.afterEach(() => checkPropTypes()); | ||
|
||
// | ||
// This is an excerpt of the document tree in our E2E test distribution, | ||
// stripped down to only show the relevant document nodes for this test | ||
// scenario: | ||
// | ||
// 🗋 Home | ||
// ├─ 🗋 Discarding | ||
// └─ 🗋 Tree multiselect | ||
// ├─ 🗋 MultiA | ||
// ├─ 🗋 MultiB | ||
// └─ 🗋 MultiC | ||
// | ||
// In reference to that hierarchy, we're putting some selectors into variables | ||
// for later use in the concrete test cases, so we don't have to repeat the | ||
// long form over and over: | ||
// | ||
const Discarding = Page.getTreeNodeButton('Discarding'); | ||
const MultiA = Page.getTreeNodeButton('MultiA'); | ||
const MultiB = Page.getTreeNodeButton('MultiB'); | ||
const MultiC = Page.getTreeNodeButton('MultiC'); | ||
const withCmdClick = { | ||
modifiers: { | ||
ctrl: true | ||
} | ||
}; | ||
|
||
test( | ||
'Scenario #1: Moving nodes and then discarding that change does not lead to an error', | ||
async t => { | ||
// | ||
// Select 🗋 MultiA and 🗋 MultiB, then drag both documents INTO 🗋 MultiC. | ||
// | ||
await t | ||
.click(MultiA) | ||
.click(MultiB, withCmdClick) | ||
.dragToElement(MultiA, MultiC); | ||
|
||
// | ||
// Discard that change. | ||
// | ||
await PublishDropDown.discardAll(); | ||
|
||
// | ||
// Assert that no error flash message shows up. | ||
// | ||
await t | ||
.expect(Selector('[role="alert"][class*="error"]').exists) | ||
.notOk(); | ||
} | ||
); | ||
|
||
test( | ||
'Scenario #2: Moved nodes do not just disappear after discarding the move change', | ||
async t => { | ||
// | ||
// Select 🗋 MultiA and 🗋 MultiB, then drag both documents INTO 🗋 Discarding. | ||
// | ||
await t | ||
.click(MultiA) | ||
.click(MultiB, withCmdClick) | ||
.dragToElement(MultiA, Discarding); | ||
|
||
// | ||
// Go to 🗋 Tree multiselect, so we can check for stale metadata | ||
// coming from the guest frame. | ||
// We also need to reload to avoid Scenario #1. | ||
// | ||
await Page.goToPage('Tree multiselect'); | ||
await t.eval(() => location.reload(true)); | ||
await Page.waitForIframeLoading(); | ||
|
||
// | ||
// Discard the move change and wait for the guest frame to reload plus | ||
// some extra timeout, so there's a chance for stale metadata to | ||
// overwrite the tree state. | ||
// | ||
await PublishDropDown.discardAll(); | ||
await Page.waitForIframeLoading(); | ||
await t.wait(500); | ||
|
||
// | ||
// Assert that 🗋 MultiA and 🗋 MultiB can still be found. | ||
// | ||
await t | ||
.expect(MultiA.exists) | ||
.ok('🗋 MultiA has disappeared'); | ||
await t | ||
.expect(MultiB.exists) | ||
.ok('🗋 MultiB has disappeared'); | ||
} | ||
) | ||
|
||
test( | ||
'Scenario #3: Discarding a move change while being on a moved node does not' | ||
+ ' lead to an error in the guest frame', | ||
async t => { | ||
// | ||
// Select 🗋 MultiA and 🗋 MultiB, then drag both documents INTO 🗋 MultiC. | ||
// | ||
await t | ||
.click(MultiA) | ||
.click(MultiB, withCmdClick) | ||
.dragToElement(MultiA, MultiC); | ||
|
||
// | ||
// Go to 🗋 Home and reload the backend, so we avoid Scenario #1's | ||
// underlying issue. | ||
// | ||
await Page.goToPage('Home'); | ||
await t.eval(() => location.reload(true)); | ||
|
||
// | ||
// Go to 🗋 MultiA, so we are on a moved node in the guest frame. | ||
// | ||
await Page.goToPage('MultiA'); | ||
|
||
// | ||
// Discard the move change. | ||
// | ||
await PublishDropDown.discardAll(); | ||
|
||
// | ||
// Assert that there's no error showing up in the guest frame and | ||
// that we're instead seeing the next-higher document node. | ||
// | ||
await Page.waitForIframeLoading(); | ||
await t.switchToIframe('[name="neos-content-main"]'); | ||
await t | ||
.expect(Selector('.neos-error-screen').exists) | ||
.notOk('There\'s an unexpected error screen in the guest frame.'); | ||
|
||
await t.switchToMainWindow(); | ||
await t | ||
.expect(Selector('[role="treeitem"] [role="button"][class*="isFocused"]').textContent) | ||
.eql('MultiC'); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters