Exemplo n.º 1
0
 protected function login()
 {
     $baseUrl = TEST_HOST;
     $mink = Mink::getInstance();
     $session = $mink->getSession();
     $session->reset();
     try {
         $session->visit($baseUrl);
     } catch (JavascriptError $e) {
     }
     $this->currentSession = $session;
     return $session;
 }
Exemplo n.º 2
0
 protected function setUp()
 {
     parent::setUp();
     define('ROOT', getcwd());
     define('TEST_HOST', 'file://' . getcwd() . '/tests/fixtures/html/admin-collected-list.html');
     $file = 'tests/fixtures/module-map.json';
     $phantom = PhantomJs::getInstance();
     $mink = Mink::getInstance();
     $mink->setUp($phantom->getPort());
     Map::setHost('tests/fixtures');
     Map::setConfigFile($file);
     Map::generate();
 }
Exemplo n.º 3
0
 /**
  * @param $config
  * @return bool|Elements
  */
 public static function getElements($config)
 {
     $elements = new Elements();
     try {
         $provider = new self::$providerClass();
         if ($provider->init($config)) {
             $page = $provider->getPage();
             $content = $page->findById('content');
             DataTable::reverse($content, $elements);
             Inputs::reverseAll($content, $elements);
             Buttons::reverseAll($content, $elements);
         } else {
             $x = 1;
             $log = $provider->getConsoleLog();
             return false;
         }
     } catch (Exception $e) {
         $x = 1;
         Mink::getInstance()->ss('error-revers');
         return false;
     }
     return $elements;
 }
Exemplo n.º 4
0
 private static function reverseOptions(NodeElement $content, dTable $dt)
 {
     $headColumns = $content->findAll('css', 'thead th');
     if ($headColumns) {
         /** @var NodeElement $column */
         foreach ($headColumns as $key => $column) {
             $text = $column->getText();
             if (strtolower($text) === 'opcje') {
                 $row = $content->find('css', 'tbody tr td:nth-child(' . ($key + 1) . ')');
                 //$o = $row->getOuterHtml();
                 //$t = $row->getText();
                 if ($row) {
                     $options = $row->findAll('css', 'ul.table-controls li a');
                     foreach ($options as $option) {
                         $actionOption = new ActionOption();
                         $actionOption->setNode($option);
                         self::reverseActionOption($option, $actionOption);
                         $dt->addActionOption($actionOption);
                     }
                     continue;
                 } else {
                     Mink::getInstance()->ss('nodatatableoptions');
                     throw new \LogicException('dt options not found');
                 }
             }
         }
     } else {
         Mink::getInstance()->ss('nodatatableoptions');
         throw new \LogicException('dt options not found');
     }
     //determine option colunm
     //get options
 }
Exemplo n.º 5
0
 /** @noinspection MoreThanThreeArgumentsInspection
  * @param Module $module
  * @param Session $session
  * @param int $wait
  * @param bool $makeSS
  */
 private function openModule(Module $module, Session $session, $wait = 100, $makeSS = false)
 {
     $page = $session->getPage();
     $nav = $page->findById('nav');
     $container = $nav->findById('mi_' . $module->getId());
     $link = $container->find('css', 'a:first-child');
     $link->click();
     $this->wait($wait);
     if ($makeSS) {
         Mink::getInstance()->ss();
     }
 }