Пример #1
0
 /**
  * Constructs a test case with the given name and browser to test execution
  *
  * @param  string $name Test case name(by default = null)
  * @param  array  $data Test case data array(by default = array())
  * @param  string $dataName Name of Data set(by default = '')
  * @param  array  $browser Array of browser configuration settings: 'name', 'browser', 'host', 'port', 'timeout',
  * 'httpTimeout' (by default = array())
  */
 public function __construct($name = null, array $data = array(), $dataName = '', array $browser = array())
 {
     $this->_testConfig = Mage_Selenium_TestConfiguration::getInstance();
     $this->_configHelper = $this->_testConfig->getHelper('config');
     $this->_uimapHelper = $this->_testConfig->getHelper('uimap');
     $this->_dataHelper = $this->_testConfig->getHelper('data');
     $this->_paramsHelper = $this->_testConfig->getHelper('params');
     $this->_dataGeneratorHelper = $this->_testConfig->getHelper('dataGenerator');
     parent::__construct($name, $data, $dataName, $browser);
     if (isset($browser['timeout'])) {
         $this->_browserTimeoutPeriod = $browser['timeout'] * 1000;
     }
     $config = $this->_configHelper->getConfigFramework();
     $this->captureScreenshotOnFailure = $config['captureScreenshotOnFailure'];
     $this->screenshotPath = $this->screenshotUrl = $this->_configHelper->getScreenshotDir();
     $this->_saveHtmlPageOnFailure = $config['saveHtmlPageOnFailure'];
     $this->coverageScriptUrl = $config['coverageScriptUrl'];
 }
Пример #2
0
 /**
  * @covers Mage_Selenium_Helper_Config::setScreenshotDir
  * @covers Mage_Selenium_Helper_Config::getScreenshotDir
  */
 public function testGetSetScreenshotDir()
 {
     $configHelper = new Mage_Selenium_Helper_Config($this->_config);
     //Default directory
     $this->assertEquals(SELENIUM_TESTS_SCREENSHOTDIR, $configHelper->getScreenshotDir());
     //Create a directory
     $parentDir = 'test testGetSetScreenshotDir';
     $dirName = $parentDir . '/ss-dir-test';
     $this->assertTrue(!is_dir($dirName) || rmdir($dirName) && rmdir($parentDir));
     $this->assertInstanceOf('Mage_Selenium_Helper_Config', $configHelper->setScreenshotDir($dirName));
     $this->assertTrue(is_dir($dirName));
     $this->assertEquals($dirName, $configHelper->getScreenshotDir());
     //Set to existing directory
     $this->assertInstanceOf('Mage_Selenium_Helper_Config', $configHelper->setScreenshotDir($dirName));
     $this->assertTrue(is_dir($dirName));
     $this->assertEquals($dirName, $configHelper->getScreenshotDir());
     //Cleanup
     rmdir($dirName);
     rmdir($parentDir);
 }
Пример #3
0
 /**
  * Get default screenshot path (config)
  *
  * @return string
  */
 public function getDefaultScreenshotPath()
 {
     return $this->_configHelper->getScreenshotDir();
 }