mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
Merge branch '3.2.x'
This commit is contained in:
commit
aa1f07960c
1 changed files with 47 additions and 0 deletions
|
@ -192,6 +192,13 @@ class phpbb_ui_test_case extends phpbb_test_case
|
|||
}
|
||||
}
|
||||
|
||||
$install_config_file = $phpbb_root_path . 'store/install_config.php';
|
||||
|
||||
if (file_exists($install_config_file))
|
||||
{
|
||||
unlink($install_config_file);
|
||||
}
|
||||
|
||||
$container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx);
|
||||
$container = $container_builder
|
||||
->with_environment('installer')
|
||||
|
@ -205,6 +212,7 @@ class phpbb_ui_test_case extends phpbb_test_case
|
|||
],
|
||||
'cache.driver.class' => 'phpbb\cache\driver\file'
|
||||
])
|
||||
->with_config(new \phpbb\config_php_file($phpbb_root_path, $phpEx))
|
||||
->without_compiled_container()
|
||||
->get_container();
|
||||
|
||||
|
@ -416,6 +424,12 @@ class phpbb_ui_test_case extends phpbb_test_case
|
|||
{
|
||||
if (!$this->cache)
|
||||
{
|
||||
global $phpbb_container, $phpbb_root_path;
|
||||
|
||||
$phpbb_container = new phpbb_mock_container_builder();
|
||||
$phpbb_container->setParameter('core.environment', PHPBB_ENVIRONMENT);
|
||||
$phpbb_container->setParameter('core.cache_dir', $phpbb_root_path . 'cache/' . PHPBB_ENVIRONMENT . '/');
|
||||
|
||||
$this->cache = new \phpbb\cache\driver\file;
|
||||
}
|
||||
|
||||
|
@ -667,4 +681,37 @@ class phpbb_ui_test_case extends phpbb_test_case
|
|||
|
||||
$this->getDriver()->takeScreenshot($screenshot);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for AJAX. Should be called after an AJAX action is made.
|
||||
*
|
||||
* @param string $framework javascript frameworks jquery|prototype|dojo
|
||||
* @throws \Facebook\WebDriver\Exception\NoSuchElementException
|
||||
* @throws \Facebook\WebDriver\Exception\TimeOutException
|
||||
*/
|
||||
public function waitForAjax($framework = 'jquery')
|
||||
{
|
||||
switch ($framework)
|
||||
{
|
||||
case 'jquery':
|
||||
$code = 'return jQuery.active;';
|
||||
break;
|
||||
case 'prototype':
|
||||
$code = 'return Ajax.activeRequestCount;';
|
||||
break;
|
||||
case 'dojo':
|
||||
$code = 'return dojo.io.XMLHTTPTransport.inFlight.length;';
|
||||
break;
|
||||
default:
|
||||
throw new \RuntimeException('Unsupported framework');
|
||||
break;
|
||||
}
|
||||
// wait for at most 30s, retry every 2000ms (2s)
|
||||
$driver = $this->getDriver();
|
||||
$driver->wait(30, 2000)->until(
|
||||
function () use ($driver, $code) {
|
||||
return !$driver->executeScript($code);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue