Skip to content
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

Merged

Conversation

The root problem has been resolved in silverstripe/admin
Comment on lines -18 to +20
-
-
SilverStripe\BehatExtension\Context\FixtureContext:
- '%paths.modules.linkfield%/tests/behat/features/files/'
- '%paths.modules.linkfield%/tests/behat/files/'
Copy link
Member Author

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
Copy link
Member Author

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.

Copy link
Member Author

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"
Copy link
Member Author

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

Comment on lines 95 to 124
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
Copy link
Member Author

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

Comment on lines 185 to 207
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
Copy link
Member Author

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.

@GuySartorelli GuySartorelli force-pushed the pulls/4/remove-workaround branch from 432d2fb to eb07d70 Compare February 27, 2024 02:38
Copy link
Contributor

@sabina-talipova sabina-talipova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Tested locally.

@sabina-talipova
Copy link
Contributor

sabina-talipova commented Mar 1, 2024

@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 silverstripe/behat-extension is 5.1.0 instead of 5.x-dev(See here). Is it possible to fix this issue by adding new behat methods in 5.1 or somehow else?

@GuySartorelli
Copy link
Member Author

Tagged 5.2.0 of behat-extensions, rerunning CI

@sabina-talipova sabina-talipova force-pushed the pulls/4/remove-workaround branch 2 times, most recently from beecfec to 3879a5f Compare March 4, 2024 03:46
And I press the "Back" HTML field button
# open "folder1"
And I click on the ".gallery__folders label[for='item-1']" element
Copy link
Member Author

@GuySartorelli GuySartorelli Mar 4, 2024

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.

Copy link
Member Author

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.

@GuySartorelli GuySartorelli force-pushed the pulls/4/remove-workaround branch from 3879a5f to 654a1fd Compare March 4, 2024 20:55
@sabina-talipova sabina-talipova merged commit 746cb83 into silverstripe:4 Mar 4, 2024
12 checks passed
@sabina-talipova sabina-talipova deleted the pulls/4/remove-workaround branch March 4, 2024 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants