-
Notifications
You must be signed in to change notification settings - Fork 19
IBX-9519: [Behat] Added Behat content tree coverage #1685
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
84cdb65
Added Behat content tree coverage
juskora f518a58
Code fixes
juskora cbdbb22
Fixes
juskora 24ee92e
Added dependencies.json
juskora 2e9e7e6
Added composer.json
juskora 5889d82
Fixed branch name
juskora 1ebe422
Updated steps
juskora 618e6e1
Added context to admin-ui-full
juskora 2a5202b
Apply suggestions from code review
juskora a50ecf0
Added fixes
juskora 1823faa
Code after fixes
juskora a53934a
Fixes
juskora faf0521
Apply suggestions from code review
juskora b625eae
Fixed code style
juskora 2c6fe51
Fixed locators
juskora 9a7981a
Changes
juskora 453d3ea
Added changes
juskora 06b646d
Changed steps
juskora 7db98d3
Fixes
juskora a901df9
Deleted dependencies.json
juskora File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| @IbexaOSS @IbexaHeadless @IbexaCommerce @IbexaExperience @javascript | ||
| Feature: Content tree basic operations | ||
|
|
||
| Scenario: Content tree can be displayed | ||
| Given I am logged as admin | ||
| When I'm on Content view Page for "root" | ||
| Then I verify Content tree visibility | ||
|
|
||
| Scenario: It is possible to display items on Content tree | ||
| Given I create "article" Content items | ||
| | title | short_title | parentPath | language | | ||
| | Article1 | art1 | root | eng-GB | | ||
| | Article2 | art2 | root | eng-GB | | ||
| | Article3 | art3 | root | eng-GB | | ||
| And I am logged as admin | ||
| When I'm on Content view Page for "root/art1" | ||
| Then Content item "root/art1" exists in Content tree | ||
|
|
||
| Scenario: New Content item can be created under chosen nested node | ||
| Given I am logged as admin | ||
| And I'm on Content view Page for "root/art1" | ||
| When I start creating a new content "Article" | ||
| And I set content fields | ||
| | label | value | | ||
| | Title | TestArt | | ||
| | Short title | testart | | ||
| | Intro | TestArticleIntro| | ||
| And I perform the "Publish" action | ||
| And I'm on Content view Page for "root/art1/testart" | ||
| Then Content item "root/art1/testart" exists in Content tree | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <?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\BrowserContext; | ||
|
|
||
| use Behat\Behat\Context\Context; | ||
| use Ibexa\AdminUi\Behat\Component\ContentTree; | ||
|
|
||
| final class ContentTreeContext implements Context | ||
| { | ||
| private ContentTree $contentTree; | ||
|
|
||
| public function __construct(ContentTree $contentTree) | ||
| { | ||
| $this->contentTree = $contentTree; | ||
| } | ||
|
|
||
| /** | ||
| * @Then I verify Content tree visibility | ||
| */ | ||
| public function iAmOnContentTree(): void | ||
| { | ||
| $this->contentTree->verifyIsLoaded(); | ||
| } | ||
|
|
||
| /** | ||
| * @Then Content item :itemPath exists in Content tree | ||
| */ | ||
| public function contentItemExistsInContentTree(string $itemPath): void | ||
| { | ||
| $this->contentTree->verifyIsLoaded(); | ||
| $this->contentTree->verifyItemExists($itemPath); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| <?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\Locator\VisibleCSSLocator; | ||
| use PHPUnit\Framework\Assert; | ||
|
|
||
| final class ContentTree extends Component | ||
| { | ||
| public function verifyIsLoaded(): void | ||
| { | ||
| $this->getHTMLPage()->find($this->getLocator('header'))->assert()->textEquals('Content tree'); | ||
| } | ||
|
|
||
| public function verifyItemExists(string $itemPath): void | ||
| { | ||
| Assert::assertTrue($this->itemExists($itemPath)); | ||
| } | ||
|
|
||
| private function itemExists(string $itemPath): bool | ||
| { | ||
| $pathParts = explode('/', $itemPath); | ||
| $elements = $this->getHTMLPage()->findAll($this->getLocator('contentInTree')); | ||
|
|
||
| foreach ($elements as $element) { | ||
| if ($element->getText() === end($pathParts)) { | ||
| return true; | ||
| } | ||
| } | ||
|
|
||
| return false; | ||
| } | ||
|
|
||
| protected function specifyLocators(): array | ||
| { | ||
| return [ | ||
| new VisibleCSSLocator('header', '.ibexa-content-tree-container .c-tb-header__name-content,.c-header .c-header__name'), | ||
| new VisibleCSSLocator('contentInTree', '.c-tb-list-item-single__link, .c-list-item'), | ||
| ]; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.