Skip to content
Open
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
2 changes: 2 additions & 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 Expand Up @@ -75,6 +76,7 @@ browser:
- Ibexa\AdminUi\Behat\BrowserContext\ContentActionsMenuContext
- 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
}
]
}
30 changes: 30 additions & 0 deletions features/standard/ContentTree.feature
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 | Arttest |
| Short title | arttest |
| Intro | TestArticleIntro|
And I perform the "Publish" action
And I'm on Content view Page for "root/art1/arttest"
Then Content item "root/art1/arttest" exists in Content tree
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
50 changes: 50 additions & 0 deletions src/lib/Behat/BrowserContext/ContentTreeContext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?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;
use Symfony\Component\Stopwatch\Stopwatch;

final class ContentTreeContext implements Context
{
private ContentTree $contentTree;

public function __construct(ContentTree $contentTree)
ContentTree $contentTree

Check failure on line 20 in src/lib/Behat/BrowserContext/ContentTreeContext.php

View workflow job for this annotation

GitHub Actions / Tests (8.1)

Syntax error, unexpected T_STRING, expecting ';' or '{' on line 20

Check failure on line 20 in src/lib/Behat/BrowserContext/ContentTreeContext.php

View workflow job for this annotation

GitHub Actions / Tests (7.4)

Syntax error, unexpected T_STRING, expecting ';' or '{' on line 20

Check failure on line 20 in src/lib/Behat/BrowserContext/ContentTreeContext.php

View workflow job for this annotation

GitHub Actions / Tests (8.0)

Syntax error, unexpected T_STRING, expecting ';' or '{' on line 20
)
{
$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

Check failure on line 37 in src/lib/Behat/BrowserContext/ContentTreeContext.php

View workflow job for this annotation

GitHub Actions / Tests (8.1)

Syntax error, unexpected T_PUBLIC on line 37

Check failure on line 37 in src/lib/Behat/BrowserContext/ContentTreeContext.php

View workflow job for this annotation

GitHub Actions / Tests (7.4)

Syntax error, unexpected T_PUBLIC on line 37

Check failure on line 37 in src/lib/Behat/BrowserContext/ContentTreeContext.php

View workflow job for this annotation

GitHub Actions / Tests (8.0)

Syntax error, unexpected T_PUBLIC on line 37
{
$this->contentTree->verifyIsLoaded();
$this->contentTree->verifyItemExists($itemPath);
}
/**
* @Given I wait :number seconds
*/
public function iWait(string $number): void

Check failure on line 45 in src/lib/Behat/BrowserContext/ContentTreeContext.php

View workflow job for this annotation

GitHub Actions / Tests (8.1)

Syntax error, unexpected T_PUBLIC on line 45

Check failure on line 45 in src/lib/Behat/BrowserContext/ContentTreeContext.php

View workflow job for this annotation

GitHub Actions / Tests (7.4)

Syntax error, unexpected T_PUBLIC on line 45

Check failure on line 45 in src/lib/Behat/BrowserContext/ContentTreeContext.php

View workflow job for this annotation

GitHub Actions / Tests (8.0)

Syntax error, unexpected T_PUBLIC on line 45
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems unused, please delete it if so.

{
$number = (int) $number;
sleep($number);
}
}

Check failure on line 50 in src/lib/Behat/BrowserContext/ContentTreeContext.php

View workflow job for this annotation

GitHub Actions / Tests (8.1)

Syntax error, unexpected '}', expecting EOF on line 50

Check failure on line 50 in src/lib/Behat/BrowserContext/ContentTreeContext.php

View workflow job for this annotation

GitHub Actions / Tests (7.4)

Syntax error, unexpected '}', expecting EOF on line 50

Check failure on line 50 in src/lib/Behat/BrowserContext/ContentTreeContext.php

View workflow job for this annotation

GitHub Actions / Tests (8.0)

Syntax error, unexpected '}', expecting EOF on line 50
44 changes: 44 additions & 0 deletions src/lib/Behat/Component/ContentTree.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

Check warning on line 1 in src/lib/Behat/Component/ContentTree.php

View workflow job for this annotation

GitHub Actions / Run code style check (8.0)

Found violation(s) of type: blank_line_before_statement

Check warning on line 1 in src/lib/Behat/Component/ContentTree.php

View workflow job for this annotation

GitHub Actions / Run code style check (8.0)

Found violation(s) of type: braces

Check warning on line 1 in src/lib/Behat/Component/ContentTree.php

View workflow job for this annotation

GitHub Actions / Run code style check (8.0)

Found violation(s) of type: class_attributes_separation

/**
* @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\ElementTextCriterion;
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);
$searchedElement = $this->getHTMLPage()->findAll($this->getLocator('contextInTree'))->getByCriterion(new ElementTextCriterion(end($pathParts)));
return $searchedElement !== null;
}

protected function specifyLocators(): array
{
return [
new VisibleCSSLocator('header', '.ibexa-content-tree-container .c-tb-header__name-content,.c-header .c-header__name'),
new VisibleCSSLocator('treeItem', '.c-tb-list-item-single__label'),
new VisibleCSSLocator('treeElement', '.ibexa-content-tree-container__root .c-tb-list-item-single__element'),
new VisibleCSSLocator('search', '.c-tb-search .ibexa-input'),
Comment on lines +38 to +40
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems unused, please delete it if so.

new VisibleCSSLocator('contentItemInTree', '.c-tb-list-item-single__link'),
];
}
}
Loading