Skip to content

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

Draft
wants to merge 6 commits into
base: 4.6
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions behat_suites.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ browser:
- Ibexa\AdminUi\Behat\BrowserContext\AdminUpdateContext
- Ibexa\AdminUi\Behat\BrowserContext\BookmarkContext
- Ibexa\AdminUi\Behat\BrowserContext\ContentPreviewContext
- Ibexa\AdminUi\Behat\BrowserContext\ContentTreeContext
- Ibexa\AdminUi\Behat\BrowserContext\ContentTypeContext
- Ibexa\AdminUi\Behat\BrowserContext\ContentUpdateContext
- Ibexa\AdminUi\Behat\BrowserContext\ContentViewContext
Expand Down
11 changes: 11 additions & 0 deletions dependencies.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"recipesEndpoint": "",
"packages": [
{
"requirement": "dev-IBX-9519-behat-coverage-contenttree as 4.6.x-dev",
"repositoryUrl": "https://github.com/ibexa/behat",
"package": "ibexa/behat",
"shouldBeAddedAsVCS": false
}
]
}
31 changes: 31 additions & 0 deletions features/standard/ContentTree.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@IbexaOSS @IbexaHeadless @IbexaCommerce @IbexaExperience @javascript

Feature: Content tree basic operations
Scenario: Content tree can be displayed
# Given I am logged as admin
Given I open Login page in admin SiteAccess
And I log in as admin with password publish
And I should be on Dashboard page
When I go to "Content structure" in Content tab
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
And I'm on Content view Page for "root/art1"

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 | Arttest |
| Short title | arttest |
| Intro | TestArticleIntro |
And I perform the "Publish" action
And I should be on Content view Page for "root/art1/arttest"
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 @@ -33,6 +33,8 @@ services:

Ibexa\AdminUi\Behat\Component\UserNotificationPopup: ~

Ibexa\AdminUi\Behat\Component\ContentTree: ~

Ibexa\AdminUi\Behat\Component\ContentTypePicker: ~

Ibexa\AdminUi\Behat\Component\LanguagePicker: ~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ services:

Ibexa\AdminUi\Behat\BrowserContext\UDWContext: ~

Ibexa\AdminUi\Behat\BrowserContext\ContentTreeContext: ~

Ibexa\AdminUi\Behat\BrowserContext\ContentTypeContext: ~

Ibexa\AdminUi\Behat\BrowserContext\NavigationContext: ~
Expand Down
31 changes: 31 additions & 0 deletions src/lib/Behat/BrowserContext/ContentTreeContext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?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();
}
}
31 changes: 31 additions & 0 deletions src/lib/Behat/Component/ContentTree.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?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;

class ContentTree extends Component
{
public function verifyIsLoaded(): void
{
$this->getHTMLPage()->find($this->getLocator('header'))->assert()->textEquals('Content tree');
// $this->getHTMLPage()->setTimeout(10)->find($this->getLocator('item'))->assert()->isVisible();
}

protected function specifyLocators(): array
{
return [
new VisibleCSSLocator('header', '.ibexa-content-tree-container .c-tb-header__name-content,.c-header .c-header__name'),
// new VisibleCSSLocator('optionsButton', '.c-tb-contextual-menu__toggler'),
// new VisibleCSSLocator('menuOption', '.c-tb-action-list__item'),
// new VisibleCSSLocator('item', '.c-tb-list-item-single__element .c-tb-list-item-single__element--main')
];
}
}
Loading