HEX
Server: Apache
System: Linux webm019.cluster128.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: petsclubcc (68997)
PHP: 5.4.45
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/petsclubcc/magento/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/Section.php
<?php
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

namespace Magento\Ui\Test\Block\Adminhtml;

use Magento\Mtf\Client\Locator;

/**
 * Is used to represent any (collapsible) section on the page.
 */
class Section extends AbstractContainer
{
    /**
     * Field with error.
     *
     * @var string
     */
    protected $errorField = '//fieldset/*[contains(@class,"field ")][.//*[contains(@class,"error")]]';

    /**
     * Error label.
     *
     * @var string
     */
    protected $errorLabel = './/*[contains(@class,"label")]';

    /**
     * Error text.
     *
     * @var string
     */
    protected $errorText = './/label[contains(@class,"error")]';

    /**
     * Locator for section.
     *
     * @var string
     */
    protected $section = '[data-index="%s"]';

    /**
     * Get array of label => validation error text.
     *
     * @return array
     */
    public function getValidationErrors()
    {
        $data = [];
        $elements = $this->_rootElement->getElements($this->errorField, Locator::SELECTOR_XPATH);
        foreach ($elements as $element) {
            $error = $element->find($this->errorText, Locator::SELECTOR_XPATH);
            if ($error->isVisible()) {
                $label = $element->find($this->errorLabel, Locator::SELECTOR_XPATH)->getText();
                $data[$label] = $error->getText();
            }
        }
        return $data;
    }

    /**
     * Check whether section is visible.
     *
     * @param string $sectionName
     * @return bool
     */
    public function isSectionVisible($sectionName)
    {
        return $this->_rootElement->find(sprintf($this->section, $sectionName))->isVisible();
    }
}