-
Notifications
You must be signed in to change notification settings - Fork 60
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
IBX-579: Behat coverage for user with CT limitation adding location #1783
Conversation
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.
We can't hardcode the root Content Item name, it will fail on different editions.
Other remarks are rather nitpicks, but imho there's no need to divide the location adding action into two separate steps.
@@ -0,0 +1,12 @@ | |||
@javascript @addLocation | |||
Feature: Verify that an Editor with Content Type limitation on conten/create policy can add location |
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.
Feature: Verify that an Editor with Content Type limitation on conten/create policy can add location | |
Feature: Verify that an Editor with Content Type limitation on content/create policy can add location |
public function addContentFromUDW($location): void | ||
{ | ||
$udw = ElementFactory::createElement($this->context, UniversalDiscoveryWidget::ELEMENT_NAME); | ||
$udw->selectContent('Ibexa Digital Experience Platform/' . $location); |
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 will fail on Ibexa OSS, where the root Content Item is named Ibexa Platform
. (https://github.com/ezsystems/ezplatform-admin-ui/blob/master/src/lib/Behat/Environment/PlatformEnvironmentConstants.php#L17)
And I go to "Content structure" in "Content" tab | ||
And I navigate to content "NewArticle" of type "Article" in root | ||
When I go to "Locations" tab in Content structure of item "NewArticle" | ||
And I click on Add Location button of item "NewArticle" |
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'd combine these two steps into one:
I add a new Location to item :itemName under :newLocationPath
If the path is under root (as it's here) use:
I add a new Location to item "NewArticle" under "root/Destination"
@@ -132,6 +133,29 @@ public function navigateToPath(string $path): void | |||
} | |||
} | |||
|
|||
/** | |||
* @param string $tabName |
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.
Please remove redundant doc block.
} | ||
|
||
/** | ||
* @param $location |
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.
Please remove redundant doc block.
$this->context->getElementByText($tabName, '#ez-tab-list-location-view .ez-tabs__tab')->click(); | ||
} | ||
|
||
public function addLocation(): void |
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.
When the two steps are combined this method cood look like this:
public function addLocation(string $newLocationPath): void
{
$this->context->findElement('#ez-tab-location-view-locations .ez-table-header__tools .btn--udw-add')->click();
$udw = ElementFactory::createElement($this->context, UniversalDiscoveryWidget::ELEMENT_NAME);
$udw->verifyVisibility();
$udw->selectContent($newLocationPath);
$udw->confirm();
}
(I've also added a verifyVisibility
call to make sure the UDW is loaded correctly before we interact with it.
public function iClickAddLocationButton($item): void | ||
{ | ||
$contentItemPage = PageObjectFactory::createPage($this->browserContext, ContentItemPage::PAGE_NAME, $item); | ||
$contentItemPage->addLocation(); |
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.
Here we need to replace the root
keyword with the actual root Content Item name.
It could look like this:
$newLocationPath = $this->argumentParser->replaceRootKeyword($newLocationPath);
$contentItemPage = PageObjectFactory::createPage($this->browserContext, ContentItemPage::PAGE_NAME, $item);
$contentItemPage->addLocation($newLocationPath);
Argument Parser code for reference:
https://github.com/ezsystems/BehatBundle/blob/master/src/lib/Core/Behat/ArgumentParser.php#L60-L72
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.
Thanks for the review! All should be applied in 66d0502.
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.
Looks good!
PR for 4.0: #1789 |
Admin UI part of the test checking whether user with Content Type limitation on content/create policy can add another location.
Related PRs:
ezsystems/BehatBundle#185
Passing build (first job): https://travis-ci.com/github/ezsystems/ezplatform-page-builder/builds/231129567
Checklist:
$ composer fix-cs
)