From f8fbe3793680af1dae2db2829cfc84068831c52f Mon Sep 17 00:00:00 2001 From: rxu Date: Wed, 28 Jun 2017 00:58:03 +0700 Subject: [ticket/14972] replace all occurrences of sizeof() with the count() PHPBB3-14972 --- tests/test_framework/phpbb_ui_test_case.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/test_framework/phpbb_ui_test_case.php') diff --git a/tests/test_framework/phpbb_ui_test_case.php b/tests/test_framework/phpbb_ui_test_case.php index b875d3212b..d38d14f45c 100644 --- a/tests/test_framework/phpbb_ui_test_case.php +++ b/tests/test_framework/phpbb_ui_test_case.php @@ -317,7 +317,7 @@ class phpbb_ui_test_case extends phpbb_test_case $meta_refresh = $this->find_element('cssSelector', 'meta[http-equiv="refresh"]'); // Wait for extension to be fully enabled - while (sizeof($meta_refresh)) + while (count($meta_refresh)) { preg_match('#url=.+/(adm+.+)#', $meta_refresh->getAttribute('content'), $match); $this->getDriver()->execute(array('method' => 'post', 'url' => $match[1])); -- cgit v1.2.1 From 4a2b12a0c8d7fc3761dde815ca3cfd5685c6a8c6 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Mon, 1 Oct 2018 13:56:37 -0700 Subject: [ticket/15824] Fix cache initialization in UI framework PHPBB3-15824 --- tests/test_framework/phpbb_ui_test_case.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/test_framework/phpbb_ui_test_case.php') diff --git a/tests/test_framework/phpbb_ui_test_case.php b/tests/test_framework/phpbb_ui_test_case.php index d38d14f45c..72d15ae0b0 100644 --- a/tests/test_framework/phpbb_ui_test_case.php +++ b/tests/test_framework/phpbb_ui_test_case.php @@ -338,6 +338,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; } -- cgit v1.2.1 From b487a3d9efbefc97aa7562ffbd4fa23577d7a8e8 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Mon, 1 Oct 2018 17:29:13 -0700 Subject: [ticket/15824] Make UI test framework correctly install exts PHPBB3-15824 --- tests/test_framework/phpbb_ui_test_case.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/test_framework/phpbb_ui_test_case.php') diff --git a/tests/test_framework/phpbb_ui_test_case.php b/tests/test_framework/phpbb_ui_test_case.php index 72d15ae0b0..d16ac78c4b 100644 --- a/tests/test_framework/phpbb_ui_test_case.php +++ b/tests/test_framework/phpbb_ui_test_case.php @@ -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,11 +212,14 @@ 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(); $container->register('installer.install_finish.notify_user')->setSynthetic(true); $container->set('installer.install_finish.notify_user', new phpbb_mock_null_installer_task()); + $container->register('installer.install_finish.install_extensions')->setSynthetic(true); + $container->set('installer.install_finish.install_extensions', new phpbb_mock_null_installer_task()); $container->compile(); $language = $container->get('language'); -- cgit v1.2.1 From 253b42372f05f38c57da95fa174eed92d7ff863a Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Wed, 3 Oct 2018 18:50:30 -0700 Subject: [ticket/15824] Add UI test method to wait for AJAX requests PHPBB3-15824 --- tests/test_framework/phpbb_ui_test_case.php | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'tests/test_framework/phpbb_ui_test_case.php') diff --git a/tests/test_framework/phpbb_ui_test_case.php b/tests/test_framework/phpbb_ui_test_case.php index d16ac78c4b..15a1cd375e 100644 --- a/tests/test_framework/phpbb_ui_test_case.php +++ b/tests/test_framework/phpbb_ui_test_case.php @@ -606,4 +606,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); + } + ); + } } -- cgit v1.2.1 From 220d388cac09883d554b9640976a082d8ebc5f9d Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 19 Mar 2019 21:20:38 +0100 Subject: [ticket/15997] Use higher than default timeout for webdriver connections PHPBB3-15997 --- tests/test_framework/phpbb_ui_test_case.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tests/test_framework/phpbb_ui_test_case.php') diff --git a/tests/test_framework/phpbb_ui_test_case.php b/tests/test_framework/phpbb_ui_test_case.php index 15a1cd375e..7b950a7d5d 100644 --- a/tests/test_framework/phpbb_ui_test_case.php +++ b/tests/test_framework/phpbb_ui_test_case.php @@ -80,7 +80,12 @@ class phpbb_ui_test_case extends phpbb_test_case try { $capabilities = DesiredCapabilities::firefox(); - self::$webDriver = RemoteWebDriver::create(self::$host . ':' . self::$port, $capabilities); + self::$webDriver = RemoteWebDriver::create( + self::$host . ':' . self::$port, + $capabilities, + 60 * 1000, // 60 seconds connection timeout + 60 * 1000 // 60 seconds request timeout + ); } catch (WebDriverCurlException $e) { self::markTestSkipped('PhantomJS webserver is not running.'); } -- cgit v1.2.1 From 34a6493fb529bbac4f4c1b6a4831960ecb0de582 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 6 Jun 2019 18:51:52 +0200 Subject: [ticket/16078] Use chrome as webdriver PHPBB3-16078 --- tests/test_framework/phpbb_ui_test_case.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/test_framework/phpbb_ui_test_case.php') diff --git a/tests/test_framework/phpbb_ui_test_case.php b/tests/test_framework/phpbb_ui_test_case.php index 7b950a7d5d..e76c8cd159 100644 --- a/tests/test_framework/phpbb_ui_test_case.php +++ b/tests/test_framework/phpbb_ui_test_case.php @@ -79,12 +79,12 @@ class phpbb_ui_test_case extends phpbb_test_case } try { - $capabilities = DesiredCapabilities::firefox(); + $capabilities = DesiredCapabilities::chrome(); self::$webDriver = RemoteWebDriver::create( self::$host . ':' . self::$port, $capabilities, - 60 * 1000, // 60 seconds connection timeout - 60 * 1000 // 60 seconds request timeout + 30 * 1000, // 30 seconds connection timeout + 30 * 1000 // 30 seconds request timeout ); } catch (WebDriverCurlException $e) { self::markTestSkipped('PhantomJS webserver is not running.'); -- cgit v1.2.1 From 1be392a16a8ff5923e28bac080f7c21659f52be5 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 19 Jun 2019 07:32:52 +0200 Subject: [ticket/16078] Use headless chrome and disable gpu acceleration This is to hopefully get rid of some of the issues with timeouts. PHPBB3-16078 --- tests/test_framework/phpbb_ui_test_case.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/test_framework/phpbb_ui_test_case.php') diff --git a/tests/test_framework/phpbb_ui_test_case.php b/tests/test_framework/phpbb_ui_test_case.php index e76c8cd159..a17fd608c1 100644 --- a/tests/test_framework/phpbb_ui_test_case.php +++ b/tests/test_framework/phpbb_ui_test_case.php @@ -80,6 +80,8 @@ class phpbb_ui_test_case extends phpbb_test_case try { $capabilities = DesiredCapabilities::chrome(); + $chromeOptions = (new ChromeOptions)->addArguments(['headless', 'disable-gpu']); + $capabilities->setCapability(ChromeOptions::CAPABILITY, $chromeOptions); self::$webDriver = RemoteWebDriver::create( self::$host . ':' . self::$port, $capabilities, -- cgit v1.2.1 From 3002c1b22af3b4ca139b98fe069a84cb8cb3b8de Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 19 Jun 2019 08:29:34 +0200 Subject: [ticket/16078] Add use statement for ChromeOptions PHPBB3-16078 --- tests/test_framework/phpbb_ui_test_case.php | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/test_framework/phpbb_ui_test_case.php') diff --git a/tests/test_framework/phpbb_ui_test_case.php b/tests/test_framework/phpbb_ui_test_case.php index a17fd608c1..4d88d7d9cb 100644 --- a/tests/test_framework/phpbb_ui_test_case.php +++ b/tests/test_framework/phpbb_ui_test_case.php @@ -11,6 +11,7 @@ * */ +use Facebook\WebDriver\Chrome\ChromeOptions; use Facebook\WebDriver\WebDriverBy; use Facebook\WebDriver\Exception\WebDriverCurlException; use Facebook\WebDriver\Remote\RemoteWebDriver; -- cgit v1.2.1