<?php
namespace Magento\AcceptanceTest\_default\Backend;

use Magento\FunctionalTestingFramework\AcceptanceTester;
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\CredentialStore;
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\PersistedObjectHandler;
use \Codeception\Util\Locator;
use Yandex\Allure\Adapter\Annotation\Features;
use Yandex\Allure\Adapter\Annotation\Stories;
use Yandex\Allure\Adapter\Annotation\Title;
use Yandex\Allure\Adapter\Annotation\Description;
use Yandex\Allure\Adapter\Annotation\Parameter;
use Yandex\Allure\Adapter\Annotation\Severity;
use Yandex\Allure\Adapter\Model\SeverityLevel;
use Yandex\Allure\Adapter\Annotation\TestCaseId;

/**
 */
class SectionReplacementTestCest
{
	/**
	 * @Features({"TestModule"})
	 * @Parameter(name = "AcceptanceTester", value="$I")
	 * @param AcceptanceTester $I
	 * @return void
	 * @throws \Exception
	 */
	public function SectionReplacementTest(AcceptanceTester $I)
	{
		$I->click("#element");
		$I->click("#foo");
		$I->waitForPageLoad(30);
		$I->click("#element .stringLiteral");
		$I->click("#stringLiteral1 .stringLiteral2");
		$I->click("#stringLiteral1-stringLiteral2 .stringLiteral3");
		$I->click("#stringLiteral1-stringLiteral2 .stringLiteral1 [stringLiteral3]");
		$I->click("#element .John");
		$I->click("#John .Doe");
		$I->click("#John-Doe .Tiberius");
		$I->click("#John-Doe .John [Tiberius]");
		$I->click("#element ." . msq("uniqueData") . "John");
		$I->click("#" . msq("uniqueData") . "John .stringLiteral2");
		$I->click("#" . msq("uniqueData") . "John-stringLiteral2 .stringLiteral3");
		$I->click("#" . msq("uniqueData") . "John-stringLiteral2 ." . msq("uniqueData") . "John [stringLiteral3]");
		$I->click("#element .Doe" . msq("uniqueData"));
		$I->click("#Doe" . msq("uniqueData") . " .stringLiteral2");
		$I->click("#Doe" . msq("uniqueData") . "-stringLiteral2 .stringLiteral3");
		$I->click("#Doe" . msq("uniqueData") . "-stringLiteral2 .Doe" . msq("uniqueData") . " [stringLiteral3]");
		$I->amGoingTo("create entity that has the stepKey: createdData");
		PersistedObjectHandler::getInstance()->createEntity(
			"createdData",
			"test",
			"simpleData",
			[],
			null
		);
		$I->click("#element ." . PersistedObjectHandler::getInstance()->retrieveEntityField('createdData', 'firstname', 'test'));
		$I->click("#" . PersistedObjectHandler::getInstance()->retrieveEntityField('createdData', 'firstname', 'test') . " .stringLiteral2");
		$I->click("#" . PersistedObjectHandler::getInstance()->retrieveEntityField('createdData', 'firstname', 'test') . "-stringLiteral2 .stringLiteral3");
		$I->click("#" . PersistedObjectHandler::getInstance()->retrieveEntityField('createdData', 'firstname', 'test') . "-stringLiteral2 ." . PersistedObjectHandler::getInstance()->retrieveEntityField('createdData', 'firstname', 'test') . " [stringLiteral3]");
		$I->click("#element .{$data}");
		$I->click("#{$data1} .{$data2}");
		$I->click("#{$data1}-{$data2} .{$data3}");
		$I->click("#John-Doe .John [Tiberius]");
		$I->click("#stringLiteral1-" . PersistedObjectHandler::getInstance()->retrieveEntityField('createdData', 'firstname', 'test') . " .John");
		$I->click("#stringLiteral1-" . PersistedObjectHandler::getInstance()->retrieveEntityField('createdData', 'firstname', 'test') . " .{$data}");
		$I->click("#stringLiteral1-" . PersistedObjectHandler::getInstance()->retrieveEntityField('createdData', 'firstname', 'test') . " ." . msq("uniqueData") . "John");
		$I->click("#stringLiteral1-" . PersistedObjectHandler::getInstance()->retrieveEntityField('createdData', 'firstname', 'test') . " .Doe" . msq("uniqueData"));
		$I->click("#element .1#element .2");
		$I->click("#element .1#element .{$data}");
		$I->click("(//div[@data-role='slide'])[1]/a[@data-element='link'][contains(@href,'')]");
		$I->click("(//div[@data-role='slide'])[1]/a[@data-element='link'][contains(@href,' ')]");
	}
}