Пример #1
0
 /**
  * @covers Mage_Selenium_Helper_File::loadYamlFiles
  * @depends test__construct
  */
 public function testLoadYamlFiles()
 {
     $fileHelper = new Mage_Selenium_Helper_File($this->_config);
     $filePath = SELENIUM_TESTS_BASEDIR . DIRECTORY_SEPARATOR . 'fixture' . DIRECTORY_SEPARATOR . 'default' . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . '*.yml';
     $allYmlData = $fileHelper->loadYamlFiles($filePath);
     $this->assertInternalType('array', $allYmlData);
     $this->assertNotEmpty($allYmlData);
     $this->assertGreaterThanOrEqual(25, count($allYmlData));
     $this->assertEmpty($fileHelper->loadYamlFiles(''));
     $this->assertEmpty($fileHelper->loadYamlFiles('*.yml'));
 }
 /**
  * Load and merge data files
  *
  * @param string $area Application area ('frontend'|'admin')
  *
  * @return Mage_Selenium_TestConfiguration
  */
 protected function _loadUimapData($area)
 {
     $files = SELENIUM_TESTS_BASEDIR . DIRECTORY_SEPARATOR . 'uimaps' . DIRECTORY_SEPARATOR . $area . DIRECTORY_SEPARATOR . '*.yml';
     $pages = $this->_fileHelper->loadYamlFiles($files);
     foreach ($pages as $pageKey => $pageContent) {
         if (!empty($pageContent)) {
             $this->_uimapData[$area][$pageKey] = new Mage_Selenium_Uimap_Page($pageKey, $pageContent);
         }
     }
     return $this;
 }
Пример #3
0
 /**
  * @covers Mage_Selenium_Uimap_Page::getMainButtons
  */
 public function testGetMainButtons()
 {
     $fileHelper = new Mage_Selenium_Helper_File($this->_config);
     $pageContainers = $fileHelper->loadYamlFile(SELENIUM_TESTS_BASEDIR . '\\fixture\\default\\core\\Mage\\UnitTest\\uimap\\frontend\\UnitTests.yml');
     $uipage = new Mage_Selenium_Uimap_Page('pageId', $pageContainers['get_main_buttons']);
     $mainButtons = $uipage->getMainButtons();
     $this->assertInstanceOf('Mage_Selenium_Uimap_ElementsCollection', $mainButtons);
     $pageContainers = array();
     $uipage = new Mage_Selenium_Uimap_Page('pageId', $pageContainers);
     $mainButtons = $uipage->getMainButtons();
     $this->assertNull($mainButtons);
 }
Пример #4
0
 /**
  * @covers Mage_Selenium_Uimap_Tab::getFieldsetNames
  */
 public function testGetFieldsetNames()
 {
     $fileHelper = new Mage_Selenium_Helper_File($this->_config);
     $dataArray = $fileHelper->loadYamlFile(SELENIUM_TESTS_BASEDIR . '\\fixture\\default\\core\\Mage\\UnitTest\\data\\UimapTests.yml');
     $tabContainer = $dataArray['tab'];
     $instance = new Mage_Selenium_Uimap_Tab('tabId', $tabContainer);
     $elements = $instance->getFieldsetNames();
     $this->assertInternalType('array', $elements);
     $this->assertContains('first_fieldset', $elements);
     $this->assertContains('second_fieldset', $elements);
     $tabContainer = array();
     $instance = new Mage_Selenium_Uimap_Tab('tabId', $tabContainer);
     $elements = $instance->getFieldsetNames();
     $this->assertInternalType('array', $elements);
     $this->assertEmpty($elements);
 }
Пример #5
0
 /**
  * @covers Mage_Selenium_Uimap_Fieldset::getFieldsetElements
  */
 public function testGetFieldsetElements()
 {
     $fileHelper = new Mage_Selenium_Helper_File($this->_config);
     $dataArray = $fileHelper->loadYamlFile(SELENIUM_TESTS_BASEDIR . '\\fixture\\default\\core\\Mage\\UnitTest\\data\\UimapTests.yml');
     $fieldsetContainer = $dataArray['fieldset'];
     $instance = new Mage_Selenium_Uimap_Fieldset('fieldsetId', $fieldsetContainer);
     $elements = $instance->getFieldsetElements();
     $this->assertInternalType('array', $elements);
     $this->assertArrayHasKey('button', $elements);
     $this->assertArrayHasKey('checkbox', $elements);
     $this->assertEquals($elements['checkbox']['first_checkbox'], "//div[@class='the-fieldset']//input[@id='the-first-checkbox']");
     $fieldsetContainer = array();
     $instance = new Mage_Selenium_Uimap_Fieldset('fieldsetId', $fieldsetContainer);
     $elements = $instance->getFieldsetElements();
     $this->assertInternalType('array', $elements);
     $this->assertEmpty($elements);
 }