-
Notifications
You must be signed in to change notification settings - Fork 18
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
FIX Remove workaround for nested redux form. #239
FIX Remove workaround for nested redux form. #239
Conversation
The root problem has been resolved in silverstripe/admin
- | ||
- | ||
SilverStripe\BehatExtension\Context\FixtureContext: | ||
- '%paths.modules.linkfield%/tests/behat/features/files/' | ||
- '%paths.modules.linkfield%/tests/behat/files/' |
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.
Unrelated refactoring - matches asset-admin. Files are not features, so they don't go in the features directory.
# Create ExternalLink in MultiLinkField | ||
# Create PhoneLink in MultiLinkField |
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.
Unrelated refactoring - this looks like it was a copy/paste error.
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.
I've refactored this slightly to make it easier to test individual bits locally. There's no sense waiting for all the "the dropdown shows these items" tests to pass when all you want to test is link creation.
Scenario: I click on the link fields and see the list of allowed link types with icons for LinkFields | ||
And I go to "/dev/build?flush" | ||
And a "page" "Link Page" | ||
And a "image" "folder1/file1.jpg" |
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.
Adding this file is new
When I click on the "[data-field-id='Form_EditForm_HasManyLinks'] button" element | ||
Then I should see "Phone number" in the "[data-field-id='Form_EditForm_HasManyLinks'] .dropdown-item:nth-of-type(5)" element | ||
When I click on the "[data-field-id='Form_EditForm_HasManyLinks'] .dropdown-item:nth-of-type(5)" element | ||
And I wait for 5 seconds | ||
Then I should see "Phone number" in the ".modal-header" element | ||
Then I fill in "LinkText" with "Phone" | ||
Then I fill in "Phone" with "12345678" | ||
And I should not see "Open in new window" in the ".modal-content" element | ||
And I press the "Create link" button | ||
And I wait for 2 seconds | ||
|
||
# Create FileLink in MultiLinkField | ||
|
||
When I click on the "[data-field-id='Form_EditForm_HasManyLinks'] button" element | ||
Then I should see "Link to a file" in the "[data-field-id='Form_EditForm_HasManyLinks'] .dropdown-item:nth-of-type(2)" element | ||
When I click on the "[data-field-id='Form_EditForm_HasManyLinks'] .dropdown-item:nth-of-type(2)" element | ||
And I wait for 5 seconds | ||
Then I should see "Link to a file" in the ".modal-header" element | ||
And I should see "Open in new window" in the ".modal-content" element | ||
When I fill in "LinkText" with "File link" | ||
And I click "Choose existing" in the ".uploadfield" element | ||
And I press the "Back" HTML field button | ||
# open "folder1" | ||
And I click on the ".gallery__folders label[for='item-1']" element | ||
# select "file1" | ||
And I click on the ".gallery__files .gallery-item[role='button']" element | ||
And I press the "Insert" button | ||
And I press the "Create link" button | ||
And I wait for 2 seconds |
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.
Creating these two link types is new - wasn't being tested before
When I click on the "[data-field-id='Form_EditForm_HasManyLinks'] button" element | ||
Then I should see "Link to a file" in the "[data-field-id='Form_EditForm_HasManyLinks'] .dropdown-item:nth-of-type(2)" element | ||
When I click on the "[data-field-id='Form_EditForm_HasManyLinks'] .dropdown-item:nth-of-type(2)" element | ||
And I wait for 5 seconds | ||
Then I should see "Link to a file" in the ".modal-header" element | ||
And I should see "Open in new window" in the ".modal-content" element | ||
When I fill in "LinkText" with "File link" | ||
And I click "Choose existing" in the ".uploadfield" element | ||
And I press the "Back" HTML field button | ||
# open "folder1" | ||
And I click on the ".gallery__folders label[for='item-1']" element | ||
# select "file1" | ||
And I click on the ".gallery__files .gallery-item[role='button']" element | ||
# Resize screen so we have "insert file" instead of just "insert" - they're actually buttons for completely different forms. | ||
And I set the screen width to 700px | ||
And I press the "Insert file" button | ||
And I press the "Create link" button | ||
And I reset the screen size | ||
And I wait for 2 seconds | ||
|
||
And I should see "Link to a file" in the "[data-field-id='Form_EditForm_HasManyLinks'] .link-picker__link--is-first" element | ||
And I should see "folder1/file1.jpg" in the "[data-field-id='Form_EditForm_HasManyLinks'] .link-picker__link--is-first" element | ||
And I should see "Draft" in the "[data-field-id='Form_EditForm_HasManyLinks'] .link-picker__link--is-first" element |
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.
This test is new - it validates that the fix for nested redux forms works.
432d2fb
to
eb07d70
Compare
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.
LGTM. Tested locally.
@GuySartorelli, I've approved since I tested locally all PRs together and tests were passed. But there is a small issue in CI. Installed version of |
Tagged 5.2.0 of behat-extensions, rerunning CI |
beecfec
to
3879a5f
Compare
And I press the "Back" HTML field button | ||
# open "folder1" | ||
And I click on the ".gallery__folders label[for='item-1']" element |
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.
It turns out "item-1" isn't the first item, it's the item with ID=1 (I think you tried to tell me that Sabina, sorry I didn't understand at the time).
Not sure why the separate behat runs had different IDs but either way relying on IDs is bad.
To resolve this, I need to get the nth (in this case 1st) child of .gallery__folders
(which will be the nth folder's holder element), and then get the label that is a child of that element.
I'll make that change now.
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.
Done - behat should pass now.
3879a5f
to
654a1fd
Compare
Requires silverstripe/silverstripe-admin#1694 and silverstripe/silverstripe-behat-extension#266
Issue