Skip to content

Commit c636111

Browse files
authored
IBX-6230: Fix incorrect CSS selectors in Behat code (#873)
* IBX-6230: Fix incorrect CSS selectors in Behat code * fix selector * fix-up: fix selector * fix another selector * fix matrix selector * fix cs
1 parent 8c4b409 commit c636111

File tree

6 files changed

+7
-13
lines changed

6 files changed

+7
-13
lines changed

src/lib/Behat/Component/Fields/Matrix.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
namespace Ibexa\AdminUi\Behat\Component\Fields;
1010

1111
use Ibexa\Behat\Browser\Element\Mapper\ElementTextMapper;
12-
use Ibexa\Behat\Browser\Locator\CSSLocatorBuilder;
1312
use Ibexa\Behat\Browser\Locator\LocatorInterface;
1413
use Ibexa\Behat\Browser\Locator\VisibleCSSLocator;
1514
use PHPUnit\Framework\Assert;
@@ -54,7 +53,6 @@ public function getFieldTypeIdentifier(): string
5453
protected function specifyLocators(): array
5554
{
5655
return [
57-
new VisibleCSSLocator('matrixCellSelectorFormat', '[name="ezplatform_content_forms_content_edit[fieldsData][ezmatrix][value][entries][%d][%s]"]'),
5856
new VisibleCSSLocator('row', '.ibexa-table__row'),
5957
new VisibleCSSLocator('addRowButton', '.ibexa-btn--add-matrix-entry'),
6058
new VisibleCSSLocator('viewModeTableHeaders', 'thead th'),
@@ -94,11 +92,7 @@ private function addRows(int $numberOfRows): void
9492

9593
private function internalSetValue(int $rowIndex, string $column, $value): void
9694
{
97-
$matrixCellSelector = CSSLocatorBuilder::combine(
98-
$this->getLocator('matrixCellSelectorFormat')->getSelector(),
99-
new VisibleCSSLocator('rowIndex', (string) $rowIndex),
100-
new VisibleCSSLocator('columnIndex', $column),
101-
);
95+
$matrixCellSelector = new VisibleCSSLocator('matrixCell', sprintf('[name="ezplatform_content_forms_content_edit[fieldsData][ezmatrix][value][entries][%d][%s]"]', $rowIndex, $column));
10296

10397
$this->getHTMLPage()->find($matrixCellSelector)->setValue($value);
10498
}

src/lib/Behat/Component/Table/TableBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function newTable(): self
5252
new VisibleCSSLocator('empty', '.ibexa-table__empty-table-cell'),
5353
new VisibleCSSLocator('columnHeader', '.ibexa-table__header-cell,th'),
5454
new VisibleCSSLocator('row', 'tr'),
55-
new VisibleCSSLocator('cell', '.ibexa-table__cell:nth-of-type(%d),td:nth-of-type(%d)'),
55+
new VisibleCSSLocator('cell', 'div.ibexa-table__cell:nth-of-type(%d),td:nth-of-type(%d)'),
5656
new VisibleCSSLocator('parent', '.ibexa-table'),
5757
]);
5858

src/lib/Behat/Component/UniversalDiscoveryWidget.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,10 @@ protected function specifyLocators(): array
211211
new VisibleCSSLocator('previewImage', '.c-content-meta-preview__preview'),
212212
// selectors for path traversal
213213
new CSSLocator('treeLevelFormat', '.c-finder-branch:nth-child(%d)'),
214-
new CSSLocator('treeLevelElementsFormat', '.c-finder-branch:nth-of-type(%d) .c-finder-leaf'),
214+
new CSSLocator('treeLevelElementsFormat', 'div.c-finder-branch:nth-of-type(%d) .c-finder-leaf'),
215215
new CSSLocator('elementName', '.c-finder-leaf__name'),
216216
new CSSLocator('input', '.c-udw-toggle-selection'),
217-
new CSSLocator('treeLevelSelectedFormat', '.c-finder-branch:nth-of-type(%d) .c-finder-leaf--marked'),
217+
new CSSLocator('treeLevelSelectedFormat', 'div.c-finder-branch:nth-of-type(%d) .c-finder-leaf--marked'),
218218
// itemActions
219219
new VisibleCSSLocator('contentPreview', '.c-content-meta-preview'),
220220
new CSSLocator('editButton', '.c-content-edit-button__btn'),

src/lib/Behat/Page/ContentTypePage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ protected function specifyLocators(): array
101101
new VisibleCSSLocator('createButton', '.btn-icon .ibexa-icon--create'),
102102
new VisibleCSSLocator('pageTitle', '.ibexa-page-title h1'),
103103
new VisibleCSSLocator('contentTypeDataTable', '.ibexa-details .ibexa-table'),
104-
new VisibleCSSLocator('contentFieldsTable', '.ibexa-fieldgroup:nth-of-type(2)'),
104+
new VisibleCSSLocator('contentFieldsTable', 'section.ibexa-fieldgroup:nth-of-type(1)'),
105105
new VisibleCSSLocator('globalPropertiesItem', '.ibexa-details__item'),
106106
new VisibleCSSLocator('globalPropertiesLabel', '.ibexa-details__item-label'),
107107
new VisibleCSSLocator('globalPropertiesValue', '.ibexa-details__item-content'),

src/lib/Behat/Page/ContentTypeUpdatePage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function addFieldDefinition(string $fieldName)
7878
$fieldSelector = new VisibleCSSLocator(
7979
'field',
8080
sprintf(
81-
'.ibexa-available-field-types__list > li:not(.ibexa-available-field-type--hidden) .ibexa-available-field-type__content:nth-of-type(%d)',
81+
'.ibexa-available-field-types__list > li:not(.ibexa-available-field-type--hidden) div.ibexa-available-field-type__content:nth-of-type(%d)',
8282
$fieldPosition
8383
)
8484
);

src/lib/Behat/Page/SystemInfoPage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected function getRoute(): string
8282
protected function specifyLocators(): array
8383
{
8484
return [
85-
new VisibleCSSLocator('packagesTable', '.tab-pane.active .ibexa-fieldgroup:nth-of-type(2)'),
85+
new VisibleCSSLocator('packagesTable', '.tab-pane.active section.ibexa-fieldgroup:nth-of-type(1)'),
8686
];
8787
}
8888

0 commit comments

Comments
 (0)