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

MNT Behat test for gridfield object on page #259

Conversation

sabina-talipova
Copy link

Description

New test function to find all elements by provided selector.

Parent issue

Copy link
Member

@emteknetnz emteknetnz left a comment

Choose a reason for hiding this comment

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

There's already an iClickOnTheElement() method in BasicContext, seems like we could just use that and repurpose it to allow for double clicking as well?

@@ -510,6 +510,9 @@ public function iClickInTheElement($clickType, $text, $selector)
$parentElement = $page->find('css', $selector);
Assert::assertNotNull($parentElement, sprintf('"%s" element not found', $selector));
$element = $parentElement->find('xpath', sprintf('//*[count(*)=0 and contains(.,"%s")]', $text));
if (is_null($element)) {
$element = $parentElement->find('xpath', sprintf('//*[text()[contains(.,"%s")]]', $text));
}
Copy link
Author

Choose a reason for hiding this comment

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

I added this as an additional check in case these changes might break existing tests. This expression also works with other elements in another behat tests (e.g. silverstripe-admin), but I'm afraid that in some tests the selected elements will not be clickable.
See: https://stackoverflow.com/questions/3655549/xpath-containstext-some-string-doesnt-work-when-used-with-node-with-more/71255563#71255563

@GuySartorelli
Copy link
Member

Closing - we can reference this PR if we decide to go forward with this work in the future, pending the spike.

@GuySartorelli GuySartorelli deleted the pulls/5/support-click-gridfield branch May 28, 2024 23:15
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.

3 participants