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

[Behat] IBX-6335: Added PropertiesList component #898

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/bundle/Resources/config/services/test/components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,5 @@ services:
Ibexa\AdminUi\Behat\Component\IbexaDropdown: ~

Ibexa\AdminUi\Behat\Component\CreateNewPopup: ~

Ibexa\AdminUi\Behat\Component\PropertiesList: ~
40 changes: 40 additions & 0 deletions src/lib/Behat/Component/PropertiesList.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\AdminUi\Behat\Component;

use Ibexa\Behat\Browser\Component\Component;
use Ibexa\Behat\Browser\Element\Criterion\ChildElementTextCriterion;
use Ibexa\Behat\Browser\Locator\VisibleCSSLocator;

class PropertiesList extends Component
{
public function verifyIsLoaded(): void
{
$this->getHTMLPage()->find($this->getLocator('tabContent'))->assert()->isVisible();
}

public function verifyValue(string $label, string $value): void
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a better name than the one I came up with 😄 💪

{
$this->getHTMLPage()
->findAll($this->getLocator('globalPropertiesItem'))
->getByCriterion(new ChildElementTextCriterion($this->getLocator('globalPropertiesLabel'), $label))
->find($this->getLocator('globalPropertiesValue'))
->assert()->textEquals($value);
}

protected function specifyLocators(): array
{
return [
new VisibleCSSLocator('tabContent', 'ibexa-tab-content'),
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is a valid CSS selector (I guess a dot is missing) - which makes me thing that the verifyIsLoaded method is never called

new VisibleCSSLocator('globalPropertiesItem', '.ibexa-details__item'),
new VisibleCSSLocator('globalPropertiesLabel', '.ibexa-details__item-label'),
new VisibleCSSLocator('globalPropertiesValue', '.ibexa-details__item-content'),
];
}
}
Loading