-
-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUGFIX: Reflect discard of node move changes correctly in the UI #3503
Merged
mhsdesign
merged 7 commits into
neos:8.3
from
grebaldi:bugfix/3184/document-move-discard
May 14, 2024
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cca5757
TASK: Add E2E test fixture for #3184
grebaldi df23920
BUGFIX: Provide better error message if node could not be found on di…
grebaldi 859c1f2
BUGFIX: Properly update node info after node move changes have been d…
grebaldi 2445c2a
BUGFIX: Use omniscient content context configuration for node changes
grebaldi 302da1d
TASK: Temporarily patch test distribution with neos/neos-development-…
grebaldi 588fe34
Merge remote-tracking branch 'origin/8.3' into bugfix/3184/document-m…
mhsdesign 95a370e
TASK: Remove obsolete patch for testing
mhsdesign File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'); | ||
Comment on lines
+146
to
+148
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
); |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yikes with the assignment in the elseif