Skip to content

Commit

Permalink
Merge pull request #1647 from ezsystems/adapt-system-info-tests
Browse files Browse the repository at this point in the history
[Behat] Adapted tests for the new System Information tab
  • Loading branch information
micszo committed Nov 4, 2020
2 parents 7308ea2 + 319ae9b commit 39b85ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
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

0 comments on commit 39b85ad

Please sign in to comment.