diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml
index ac84495540..b169aef65e 100644
--- a/.github/workflows/build-release.yml
+++ b/.github/workflows/build-release.yml
@@ -12,7 +12,7 @@ jobs:
container:
image: ghcr.io/mvorisek/image-php:latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml
index 4262066fdb..71d1530c37 100644
--- a/.github/workflows/test-unit.yml
+++ b/.github/workflows/test-unit.yml
@@ -24,7 +24,7 @@ jobs:
type: 'StaticAnalysis'
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Configure PHP
run: |
@@ -111,7 +111,7 @@ jobs:
ORACLE_PASSWORD: atk4_pass
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Configure PHP
run: |
@@ -245,6 +245,8 @@ jobs:
type: 'Firefox'
- php: 'latest'
type: 'Chrome Slow'
+ - php: 'latest'
+ type: 'Firefox Slow'
env:
LOG_COVERAGE: "${{ fromJSON('{true: \"1\", false: \"\"}')[matrix.php == '8.2' && matrix.type == 'Chrome' && (github.event_name == 'pull_request' || (github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master')))] }}"
services:
@@ -272,7 +274,7 @@ jobs:
ORACLE_PASSWORD: atk4_pass
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Configure PHP
run: |
@@ -292,7 +294,7 @@ jobs:
restore-keys: |
${{ runner.os }}-composer-
- - name: Install JS dependencies (only for coverage or Slow)
+ - name: Install JS dependencies (only for coverage or Chrome Slow)
if: env.LOG_COVERAGE || matrix.type == 'Chrome Slow'
run: |
if [ -n "$LOG_COVERAGE" ]; then
@@ -313,25 +315,25 @@ jobs:
(cd public/external && npm ci --loglevel=error && git clean -dxfq .)
fi
- - name: Lint JS files (only for Slow)
+ - name: Lint JS files (only for Chrome Slow)
if: matrix.type == 'Chrome Slow'
run: |
cp public/external/postinstall.js js
(cd js && npm run lint)
- - name: Compile HTML files (only for Slow)
+ - name: Compile HTML files (only for Chrome Slow)
if: matrix.type == 'Chrome Slow'
run: |
cp -r template template.orig
find template -not -type d -not -name '*.pug' -delete
(cd template && pug --doctype html --pretty --silent .)
- - name: Compile CSS files (only for Slow)
+ - name: Compile CSS files (only for Chrome Slow)
if: matrix.type == 'Chrome Slow'
run: |
lessc public/css/agileui.less public/css/agileui.min.css --clean-css="--s1 --advanced" --source-map
- - name: Compile JS files (only for coverage or Slow)
+ - name: Compile JS files (only for coverage or Chrome Slow)
if: env.LOG_COVERAGE || matrix.type == 'Chrome Slow'
run: |
if [ -n "$LOG_COVERAGE" ]; then
@@ -341,7 +343,7 @@ jobs:
(cd js && npm run build)
fi
- - name: Diff compiled files (only for Slow)
+ - name: Diff compiled files (only for Chrome Slow)
if: matrix.type == 'Chrome Slow'
run: |
diff -ru public.orig public
@@ -372,8 +374,8 @@ jobs:
ci_wait_until '[ -e /tmp/.X11-unix/X99 ]'
su browser -c 'java -Dwebdriver.chrome.whitelistedIps=127.0.0.1 -jar /opt/selenium-server-standalone.jar -role standalone -host 127.0.0.1 -port 4444 -sessionTimeout 15 -browserTimeout 12 > /dev/null 2>&1 &'
ci_wait_until 'nc -w 1 127.0.0.1 4444'
- if [ "${{ matrix.type }}" = "Firefox" ]; then sed -i "s~chrome~firefox~" behat.yml.dist; fi
- if [ "${{ matrix.type }}" = "Chrome Slow" ]; then echo 'sleep(1);' >> demos/init-app.php; fi
+ if [ "${{ matrix.type }}" = "Firefox" ] || [ "${{ matrix.type }}" = "Firefox Slow" ]; then sed -i "s~chrome~firefox~" behat.yml.dist; fi
+ if [ "${{ matrix.type }}" = "Chrome Slow" ] || [ "${{ matrix.type }}" = "Firefox Slow" ]; then echo 'usleep(500_000);' >> demos/init-app.php; fi
- name: "Run tests: SQLite"
run: |
@@ -463,7 +465,7 @@ jobs:
image: ghcr.io/mvorisek/image-php:latest
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Install Python and dependencies
run: |
diff --git a/src/App.php b/src/App.php
index 903afcce91..efc41481f9 100644
--- a/src/App.php
+++ b/src/App.php
@@ -299,7 +299,7 @@ public function caughtException(\Throwable $exception): void
// remove header
$this->layout->template->tryDel('Header');
- if (($this->isJsUrlRequest() || ($_SERVER['HTTP_X_REQUESTED_WITH'] ?? '') === 'XMLHttpRequest')
+ if (($this->isJsUrlRequest() || $this->getRequest()->getHeaderLine('X-Requested-With') === 'XMLHttpRequest')
&& !isset($_GET['__atk_tab'])) {
$this->outputResponseJson([
'success' => false,
diff --git a/src/Behat/Context.php b/src/Behat/Context.php
index 1b27c43e3b..b7d5e857fa 100644
--- a/src/Behat/Context.php
+++ b/src/Behat/Context.php
@@ -148,10 +148,12 @@ protected function disableAnimations(): void
]);
$this->getSession()->executeScript(
- 'if (Array.prototype.filter.call(document.getElementsByTagName(\'style\'), (e) => e.getAttribute(\'about\') === \'atk-test-behat\').length === 0) {'
- . ' $(\'\').appendTo(\'head\');'
+ 'if (Array.prototype.filter.call(document.getElementsByTagName(\'style\'), (e) => e.getAttribute(\'about\') === \'atk4-ui-behat\').length === 0) {'
+ . ' $(\'\').appendTo(\'head\');'
+ . ' jQuery.fx.off = true;'
+ // fix self::getFinishedScript() detection for Firefox - document.readyState is updated after at least part of a new page has been loaded
+ . ' window.addEventListener(\'beforeunload\', (event) => jQuery.active++);'
. ' }'
- . 'jQuery.fx.off = true;'
);
}
@@ -353,6 +355,26 @@ public function iClickUsingSelector(string $selector): void
$element->click();
}
+ /**
+ * \Behat\Mink\Driver\Selenium2Driver::clickOnElement() does not wait until AJAX is completed after scroll.
+ *
+ * One solution can be waiting for AJAX after each \WebDriver\AbstractWebDriver::curl() call.
+ *
+ * @Then PATCH DRIVER I click using selector :selector
+ */
+ public function iClickPatchedUsingSelector(string $selector): void
+ {
+ $element = $this->findElement(null, $selector);
+
+ $driver = $this->getSession()->getDriver();
+ \Closure::bind(static function () use ($driver, $element) {
+ $driver->mouseOverElement($driver->findElement($element->getXpath()));
+ }, null, MinkSeleniumDriver::class)();
+ $this->jqueryWait();
+
+ $element->click();
+ }
+
/**
* @Then I click paginator page :arg1
*/
diff --git a/tests-behat/scroll.feature b/tests-behat/scroll.feature
index 5fde00a973..482a87caee 100644
--- a/tests-behat/scroll.feature
+++ b/tests-behat/scroll.feature
@@ -45,6 +45,6 @@ Feature: Dynamic scroll
Given I am on "interactive/scroll-grid-container.php"
Then I should see "Brazil"
Then I should not see "Canada"
- When I click using selector "//table//tr/td[text()='Brazil']"
+ When PATCH DRIVER I click using selector "//table//tr/td[text()='Brazil']"
Then I should see "Brazil"
Then I should see "Canada"