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] Adapted tests for the new System Information tab #1647

Merged
merged 2 commits into from
Nov 4, 2020
Merged
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
6 changes: 6 additions & 0 deletions features/standard/SystemInfo.feature
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@systemInformation
Feature: System info verification
As an administrator
In order to customize my eZ installation
Expand All @@ -7,6 +8,11 @@ Feature: System info verification
Given I am logged as "admin"
And I go to "System Information" in "Admin" tab

@javascript @common
Scenario: Check My Ibexa Information
When I go to "My Ibexa" tab in System Information
Then I see "Product" system information table

@javascript @common
Scenario: Check Composer System Information
When I go to "Composer" tab in System Information
Expand Down
18 changes: 6 additions & 12 deletions src/lib/Behat/PageObject/SystemInfoPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ class SystemInfoPage extends Page
{
public const PAGE_NAME = 'System Information';

/**
* @var AdminList[]
*/
public $adminLists;

/**
* @var NavLinkTabs
*/
Expand All @@ -37,9 +32,6 @@ class SystemInfoPage extends Page
public function __construct(BrowserContext $context)
{
parent::__construct($context);
$this->adminLists['Packages'] = ElementFactory::createElement($this->context, AdminList::ELEMENT_NAME, 'Packages', SimpleTable::ELEMENT_NAME, '.ez-main-container .tab-pane.active');
$this->adminLists['Bundles'] = ElementFactory::createElement($this->context, AdminList::ELEMENT_NAME, 'Bundles', SimpleTable::ELEMENT_NAME, '.ez-main-container .tab-pane.active');
$this->systemInfoTable = ElementFactory::createElement($context, SystemInfoTable::ELEMENT_NAME, '.ez-main-container .active .ez-fieldgroup:nth-of-type(1)');
$this->navLinkTabs = ElementFactory::createElement($context, NavLinkTabs::ELEMENT_NAME);
$this->siteAccess = 'admin';
$this->route = '/systeminfo';
Expand All @@ -50,18 +42,20 @@ public function __construct(BrowserContext $context)
public function verifyElements(): void
{
$this->navLinkTabs->verifyVisibility();
$this->adminLists['Packages']->verifyVisibility();
$this->verifySystemInfoTable('Product');
}

public function verifySystemInfoTable(string $tabName): void
{
$this->systemInfoTable->verifyHeader($tabName);
$systemInfoTable = ElementFactory::createElement($this->context, SystemInfoTable::ELEMENT_NAME, '.ez-main-container .active .ez-fieldgroup:nth-of-type(1)');
$systemInfoTable->verifyHeader($tabName);
}

public function verifySystemInfoRecords(string $tableName, array $records): void
{
$this->adminLists[$tableName]->verifyVisibility();
$tableHash = $this->adminLists[$tableName]->table->getTableHash();
$tab = ElementFactory::createElement($this->context, AdminList::ELEMENT_NAME, $tableName, SimpleTable::ELEMENT_NAME, '.ez-main-container .tab-pane.active');
$tab->verifyVisibility();
$tableHash = $tab->table->getTableHash();

foreach ($records as $desiredRecord) {
$found = false;
Expand Down