diff --git a/.github/ci/main.sh b/.github/ci/main.sh
index 240d82b8..c0d96fbc 100644
--- a/.github/ci/main.sh
+++ b/.github/ci/main.sh
@@ -26,7 +26,7 @@ function start_services() {
# Create, setup and populate learn.rtcamp.com base site with data
function create_and_configure_site () {
- ee site create $SITE_NAME --wp --php74
+ ee site create $SITE_NAME --wp --php74
cd $SITE_ROOT/wp-content/plugins/
rm -rf nginx-helper
ls
@@ -36,7 +36,6 @@ function create_and_configure_site () {
ls
wp plugin activate nginx-helper --allow-root
wp user create automation automation@example.com --role=administrator --user_pass=automation --allow-root
- wp theme activate twentytwentyone --allow-root
}
@@ -55,7 +54,7 @@ function build_package(){
}
function install_playwright(){
- cd $GITHUB_WORKSPACE/tests/e2e-playwright
+ cd $GITHUB_WORKSPACE/tests/e2e-playwright
npx playwright install
}
@@ -96,4 +95,4 @@ function main() {
run_playwright_tests
}
-main
\ No newline at end of file
+main
diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml
index 6b8ef2b7..765f7a7a 100644
--- a/.github/workflows/e2e-test.yml
+++ b/.github/workflows/e2e-test.yml
@@ -6,12 +6,12 @@ name: End-to-End Tests
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
- branches:
+ branches:
- develop
- master
-
+
pull_request:
- branches:
+ branches:
- develop
- master
@@ -23,14 +23,14 @@ jobs:
# The type of runner that the job will run on
name: Playwright Tests
runs-on: ubuntu-latest
- env:
+ env:
TESRESULT_TOKEN: ${{ secrets.TESRESULT_TOKEN }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
SHA: ${{ github.event.pull_request.head.sha }}
COMMIT_SHA: ${{ github.sha }}
PR_NUMBER: ${{ github.event.pull_request.number }}
working-directory: ./tests/e2e-playwright
-
+
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
diff --git a/README.md b/README.md
index 1c710a93..567c605e 100644
--- a/README.md
+++ b/README.md
@@ -139,6 +139,11 @@ Please post your problem in [our free support forum](https://github.com/rtCamp/n
## Changelog ##
+### 2.2.4 ###
+
+* Introduces the capability to specify the `NGINX_HELPER_LOG` constant, allowing users to activate the logging feature. [#318](https://github.com/rtCamp/nginx-helper/pull/318) - by [Vishal Kakadiya](https://github.com/vishalkakadiya)
+* Existing users employing the nginx-helper plugin with logging enabled will experience no disruptions. However, if logging is disabled, users must define the `NGINX_HELPER_LOG` constant to re-enable the logging feature.
+
### 2.2.3 ###
* Add the URL being purged as parameter in `rt_nginx_helper_purge_cached_file` hook. [#271](https://github.com/rtCamp/nginx-helper/pull/271) - by [Arafat Islam](https://github.com/arafatkn)
diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php
index a024e318..588b67e1 100644
--- a/admin/class-nginx-helper-admin.php
+++ b/admin/class-nginx-helper-admin.php
@@ -53,7 +53,7 @@ class Nginx_Helper_Admin {
*
* @since 2.0.0
* @access public
- * @var string $options Purge options.
+ * @var string[] $options Purge options.
*/
public $options;
@@ -345,6 +345,27 @@ public function nginx_helper_settings_link( $links ) {
}
+ /**
+ * Check if the nginx log is enabled.
+ *
+ * @since 2.2.4
+ * @return boolean
+ */
+ public function is_nginx_log_enabled() {
+
+ $options = get_site_option( 'rt_wp_nginx_helper_options', array() );
+
+ if ( ! empty( $options['enable_log'] ) && 1 === (int) $options['enable_log'] ) {
+ return true;
+ }
+
+ if ( defined( 'NGINX_HELPER_LOG' ) && true === NGINX_HELPER_LOG ) {
+ return true;
+ }
+
+ return false;
+ }
+
/**
* Retrieve the asset path.
*
@@ -732,10 +753,10 @@ public function purge_all() {
}
if ( 'purge' === $action ) {
-
+
/**
* Fire an action after the entire cache has been purged whatever caching type is used.
- *
+ *
* @since 2.2.2
*/
do_action( 'rt_nginx_helper_after_purge_all' );
diff --git a/admin/class-purger.php b/admin/class-purger.php
index ac54b8d0..ee07019e 100644
--- a/admin/class-purger.php
+++ b/admin/class-purger.php
@@ -529,7 +529,7 @@ public function log( $msg, $level = 'INFO' ) {
global $nginx_helper_admin;
- if ( ! $nginx_helper_admin->options['enable_log'] ) {
+ if ( ! $nginx_helper_admin->is_nginx_log_enabled() ) {
return;
}
@@ -562,7 +562,7 @@ public function check_and_truncate_log_file() {
global $nginx_helper_admin;
- if ( ! $nginx_helper_admin->options['enable_log'] ) {
+ if ( ! $nginx_helper_admin->is_nginx_log_enabled() ) {
return;
}
diff --git a/admin/css/nginx-helper-admin.css b/admin/css/nginx-helper-admin.css
index 8d1b4b30..0a8856ba 100644
--- a/admin/css/nginx-helper-admin.css
+++ b/admin/css/nginx-helper-admin.css
@@ -98,3 +98,8 @@ form#purgeall .button-primary:focus {
}
.rt-purge_url { width: 100%; }
+
+.enable-logging-message {
+ font-size: 13px;
+ margin-left: 23px;
+}
diff --git a/admin/partials/nginx-helper-general-options.php b/admin/partials/nginx-helper-general-options.php
index 87f2e32d..20ce88a3 100644
--- a/admin/partials/nginx-helper-general-options.php
+++ b/admin/partials/nginx-helper-general-options.php
@@ -539,9 +539,46 @@
>
+
is_nginx_log_enabled() ) ? ' style="display: none;"' : ''; ?>>
diff --git a/includes/class-nginx-helper.php b/includes/class-nginx-helper.php
index 399dc5d0..02e7e3cd 100644
--- a/includes/class-nginx-helper.php
+++ b/includes/class-nginx-helper.php
@@ -77,7 +77,7 @@ class Nginx_Helper {
public function __construct() {
$this->plugin_name = 'nginx-helper';
- $this->version = '2.2.3';
+ $this->version = '2.2.4';
$this->minimum_wp = '3.0';
if ( ! $this->required_wp_version() ) {
diff --git a/languages/nginx-helper.mo b/languages/nginx-helper.mo
index 4ed03a46..8b700037 100644
Binary files a/languages/nginx-helper.mo and b/languages/nginx-helper.mo differ
diff --git a/languages/nginx-helper.po b/languages/nginx-helper.po
index fc4b01ef..71ec8881 100644
--- a/languages/nginx-helper.po
+++ b/languages/nginx-helper.po
@@ -1,17 +1,17 @@
-# Copyright (C) 2023 rtCamp
+# Copyright (C) 2024 rtCamp
# This file is distributed under the same license as the Nginx Helper plugin.
msgid ""
msgstr ""
-"Project-Id-Version: Nginx Helper 2.2.3\n"
+"Project-Id-Version: Nginx Helper 2.2.4\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/nginx-helper\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"POT-Creation-Date: 2023-05-10T09:58:20+00:00\n"
+"POT-Creation-Date: 2024-01-17T06:18:22+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"X-Generator: WP-CLI 2.7.1\n"
+"X-Generator: WP-CLI 2.8.1\n"
"X-Domain: nginx-helper\n"
#. Plugin Name of the plugin
@@ -62,15 +62,15 @@ msgstr ""
msgid "Settings"
msgstr ""
-#: admin/class-nginx-helper-admin.php:404
+#: admin/class-nginx-helper-admin.php:425
msgid "No items"
msgstr ""
-#: admin/class-nginx-helper-admin.php:415
+#: admin/class-nginx-helper-admin.php:436
msgid "Posted "
msgstr ""
-#: admin/class-nginx-helper-admin.php:746
+#: admin/class-nginx-helper-admin.php:775
msgid "Purge initiated"
msgstr ""
@@ -236,282 +236,310 @@ msgstr ""
msgid "Nginx Settings"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:56
+#: admin/partials/nginx-helper-general-options.php:62
msgid "Log file size must be a number."
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:66
+#: admin/partials/nginx-helper-general-options.php:72
msgid "Settings saved."
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:93
+#: admin/partials/nginx-helper-general-options.php:99
msgid "Purging Options"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:100
+#: admin/partials/nginx-helper-general-options.php:106
msgid "Enable Purge"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:110
+#: admin/partials/nginx-helper-general-options.php:116
msgid "Caching Method"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:122
+#: admin/partials/nginx-helper-general-options.php:128
msgid "nginx Fastcgi cache"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:124
+#: admin/partials/nginx-helper-general-options.php:130
msgid "External settings for nginx"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:125
+#: admin/partials/nginx-helper-general-options.php:131
msgid "requires external settings for nginx"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:135
+#: admin/partials/nginx-helper-general-options.php:141
msgid "Redis cache"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:145
+#: admin/partials/nginx-helper-general-options.php:151
msgid "Purge Method"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:155
-#: admin/partials/nginx-helper-general-options.php:335
+#: admin/partials/nginx-helper-general-options.php:161
+#: admin/partials/nginx-helper-general-options.php:341
msgid "when a post/page/custom post is published."
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:165
+#: admin/partials/nginx-helper-general-options.php:171
msgid "Using a GET request to"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:166
+#: admin/partials/nginx-helper-general-options.php:172
msgid "(Default option)"
msgstr ""
#. translators: %s Nginx cache purge module link.
-#: admin/partials/nginx-helper-general-options.php:177
+#: admin/partials/nginx-helper-general-options.php:183
msgid "Uses the %s module."
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:195
+#: admin/partials/nginx-helper-general-options.php:201
msgid "Delete local server cache files"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:201
+#: admin/partials/nginx-helper-general-options.php:207
msgid "Checks for matching cache file in RT_WP_NGINX_HELPER_CACHE_PATH. Does not require any other modules. Requires that the cache be stored on the same server as WordPress. You must also be using the default nginx cache options (levels=1:2) and (fastcgi_cache_key \"$scheme$request_method$host$request_uri\")."
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:216
+#: admin/partials/nginx-helper-general-options.php:222
msgid "Redis Settings"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:221
+#: admin/partials/nginx-helper-general-options.php:227
msgid "Hostname"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:228
-#: admin/partials/nginx-helper-general-options.php:243
-#: admin/partials/nginx-helper-general-options.php:258
+#: admin/partials/nginx-helper-general-options.php:234
+#: admin/partials/nginx-helper-general-options.php:249
+#: admin/partials/nginx-helper-general-options.php:264
msgid "Overridden by constant variables."
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:236
+#: admin/partials/nginx-helper-general-options.php:242
msgid "Port"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:251
+#: admin/partials/nginx-helper-general-options.php:257
msgid "Prefix"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:271
+#: admin/partials/nginx-helper-general-options.php:277
msgid "Purging Conditions"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:276
+#: admin/partials/nginx-helper-general-options.php:282
msgid "Purge Homepage:"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:283
+#: admin/partials/nginx-helper-general-options.php:289
msgid "when a post/page/custom post is modified or added."
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:292
-#: admin/partials/nginx-helper-general-options.php:419
+#: admin/partials/nginx-helper-general-options.php:298
+#: admin/partials/nginx-helper-general-options.php:425
msgid "when a post (or page/custom post) is modified or added."
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:304
+#: admin/partials/nginx-helper-general-options.php:310
msgid "when an existing post/page/custom post is modified."
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:313
+#: admin/partials/nginx-helper-general-options.php:319
msgid "when a published post (or page/custom post) is trashed"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:327
+#: admin/partials/nginx-helper-general-options.php:333
msgid "Purge Post/Page/Custom Post Type:"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:344
+#: admin/partials/nginx-helper-general-options.php:350
msgid "when a post is published."
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:356
-#: admin/partials/nginx-helper-general-options.php:453
+#: admin/partials/nginx-helper-general-options.php:362
+#: admin/partials/nginx-helper-general-options.php:459
msgid "when a comment is approved/published."
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:365
-#: admin/partials/nginx-helper-general-options.php:462
+#: admin/partials/nginx-helper-general-options.php:371
+#: admin/partials/nginx-helper-general-options.php:468
msgid "when a comment is approved/published."
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:377
-#: admin/partials/nginx-helper-general-options.php:474
+#: admin/partials/nginx-helper-general-options.php:383
+#: admin/partials/nginx-helper-general-options.php:480
msgid "when a comment is unapproved/deleted."
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:386
-#: admin/partials/nginx-helper-general-options.php:483
+#: admin/partials/nginx-helper-general-options.php:392
+#: admin/partials/nginx-helper-general-options.php:489
msgid "when a comment is unapproved/deleted."
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:400
+#: admin/partials/nginx-helper-general-options.php:406
msgid "Purge Archives:"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:402
+#: admin/partials/nginx-helper-general-options.php:408
msgid "(date, category, tag, author, custom taxonomies)"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:410
+#: admin/partials/nginx-helper-general-options.php:416
msgid "when an post/page/custom post is modified or added"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:431
+#: admin/partials/nginx-helper-general-options.php:437
msgid "when an existing post/page/custom post is trashed."
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:440
+#: admin/partials/nginx-helper-general-options.php:446
msgid "when a published post (or page/custom post) is trashed."
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:496
+#: admin/partials/nginx-helper-general-options.php:502
msgid "Custom Purge URL:"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:502
+#: admin/partials/nginx-helper-general-options.php:508
msgid "Add one URL per line. URL should not contain domain name."
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:505
+#: admin/partials/nginx-helper-general-options.php:511
msgid "Eg: To purge http://example.com/sample-page/ add /sample-page/ in above textarea."
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:509
+#: admin/partials/nginx-helper-general-options.php:515
msgid "'*' will only work with redis cache server."
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:519
+#: admin/partials/nginx-helper-general-options.php:525
msgid "Debug Options"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:529
+#: admin/partials/nginx-helper-general-options.php:535
msgid "Enable Nginx Map."
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:538
+#: admin/partials/nginx-helper-general-options.php:554
msgid "Enable Logging"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:546
+#: admin/partials/nginx-helper-general-options.php:559
+msgid "disable"
+msgstr ""
+
+#: admin/partials/nginx-helper-general-options.php:565
+msgid "enable"
+msgstr ""
+
+#: admin/partials/nginx-helper-general-options.php:572
+msgid "NOTE"
+msgstr ""
+
+#: admin/partials/nginx-helper-general-options.php:573
+msgid "To"
+msgstr ""
+
+#: admin/partials/nginx-helper-general-options.php:575
+msgid "the logging feature, you must define"
+msgstr ""
+
+#: admin/partials/nginx-helper-general-options.php:576
+msgid "as"
+msgstr ""
+
+#: admin/partials/nginx-helper-general-options.php:578
+msgid "in your"
+msgstr ""
+
+#: admin/partials/nginx-helper-general-options.php:589
msgid "Enable Nginx Timestamp in HTML"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:560
+#: admin/partials/nginx-helper-general-options.php:603
msgid "Nginx Map"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:569
+#: admin/partials/nginx-helper-general-options.php:612
msgid "Can't write on map file."
msgstr ""
#. translators: %s file url.
-#: admin/partials/nginx-helper-general-options.php:574
-#: admin/partials/nginx-helper-general-options.php:646
+#: admin/partials/nginx-helper-general-options.php:617
+#: admin/partials/nginx-helper-general-options.php:689
msgid "Check you have write permission on %s"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:591
+#: admin/partials/nginx-helper-general-options.php:634
msgid "Nginx Map path to include in nginx settings"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:592
+#: admin/partials/nginx-helper-general-options.php:635
msgid "(recommended)"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:605
+#: admin/partials/nginx-helper-general-options.php:648
msgid "Or,"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:606
+#: admin/partials/nginx-helper-general-options.php:649
msgid "Text to manually copy and paste in nginx settings"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:607
+#: admin/partials/nginx-helper-general-options.php:650
msgid "(if your network is small and new sites are not added frequently)"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:625
+#: admin/partials/nginx-helper-general-options.php:668
msgid "Logging Options"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:641
+#: admin/partials/nginx-helper-general-options.php:684
msgid "Can't write on log file."
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:663
+#: admin/partials/nginx-helper-general-options.php:706
msgid "Logs path"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:675
+#: admin/partials/nginx-helper-general-options.php:718
msgid "View Log"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:680
+#: admin/partials/nginx-helper-general-options.php:723
msgid "Log"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:687
+#: admin/partials/nginx-helper-general-options.php:730
msgid "Log level"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:692
+#: admin/partials/nginx-helper-general-options.php:735
msgid "None"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:693
+#: admin/partials/nginx-helper-general-options.php:736
msgid "Info"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:694
+#: admin/partials/nginx-helper-general-options.php:737
msgid "Warning"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:695
+#: admin/partials/nginx-helper-general-options.php:738
msgid "Error"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:702
+#: admin/partials/nginx-helper-general-options.php:745
msgid "Max log file size"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:708
+#: admin/partials/nginx-helper-general-options.php:751
msgid "Mb"
msgstr ""
-#: admin/partials/nginx-helper-general-options.php:725
+#: admin/partials/nginx-helper-general-options.php:768
msgid "Save All Changes"
msgstr ""
diff --git a/nginx-helper.php b/nginx-helper.php
index 92b8fc5e..915f9ab1 100644
--- a/nginx-helper.php
+++ b/nginx-helper.php
@@ -3,13 +3,13 @@
* Plugin Name: Nginx Helper
* Plugin URI: https://rtcamp.com/nginx-helper/
* Description: Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does few more things.
- * Version: 2.2.3
+ * Version: 2.2.4
* Author: rtCamp
* Author URI: https://rtcamp.com
* Text Domain: nginx-helper
* Domain Path: /languages
* Requires at least: 3.0
- * Tested up to: 5.4
+ * Tested up to: 6.4
*
* @link https://rtcamp.com/nginx-helper/
* @since 2.0.0
diff --git a/readme.txt b/readme.txt
index 0000ecbf..4ac24516 100644
--- a/readme.txt
+++ b/readme.txt
@@ -127,6 +127,10 @@ Please post your problem in [our free support forum](https://github.com/rtCamp/n
== Changelog ==
+= 2.2.4 =
+* Introduces the capability to specify the `NGINX_HELPER_LOG` constant, allowing users to activate the logging feature. [#318](https://github.com/rtCamp/nginx-helper/pull/318) - by [Vishal Kakadiya](https://github.com/vishalkakadiya)
+* Existing users employing the nginx-helper plugin with logging enabled will experience no disruptions. However, if logging is disabled, users must define the `NGINX_HELPER_LOG` constant to re-enable the logging feature.
+
= 2.2.3 =
* Add the URL being purged as parameter in `rt_nginx_helper_purge_cached_file` hook. [#271](https://github.com/rtCamp/nginx-helper/pull/271) - by [Arafat Islam](https://github.com/arafatkn)
* Fix performance issue when saving nav menus. [#112](https://github.com/rtCamp/nginx-helper/issues/112), [#272](https://github.com/rtCamp/nginx-helper/pull/272/) - by [Arafat Islam](https://github.com/arafatkn)
diff --git a/tests/e2e-playwright/playwright.config.ts b/tests/e2e-playwright/playwright.config.ts
index d19412a8..80a9c37b 100644
--- a/tests/e2e-playwright/playwright.config.ts
+++ b/tests/e2e-playwright/playwright.config.ts
@@ -1,66 +1,66 @@
/**
* External dependencies
*/
- import path from 'path';
- import { fileURLToPath } from 'url';
- import { devices } from '@playwright/test';
- import type { PlaywrightTestConfig } from '@playwright/test';
-
- const STORAGE_STATE_PATH =
- process.env.STORAGE_STATE_PATH ||
- path.join( process.cwd(), 'artifacts/storage-states/admin.json' );
-
- const config: PlaywrightTestConfig = {
+import path from 'path';
+import { fileURLToPath } from 'url';
+import { devices } from '@playwright/test';
+import type { PlaywrightTestConfig } from '@playwright/test';
+
+const STORAGE_STATE_PATH =
+ process.env.STORAGE_STATE_PATH ||
+ path.join( process.cwd(), 'artifacts/storage-states/admin.json' );
+
+const config: PlaywrightTestConfig = {
reporter: [
["html", { open: "never" }],
["junit", { outputFile: "playwright-report/results.xml" }],
[
- "playwright-tesults-reporter",
- { "tesults-target": process.env.TESRESULT_TOKEN },
+ "playwright-tesults-reporter",
+ { "tesults-target": process.env.TESRESULT_TOKEN },
],
- ],
- forbidOnly: !! process.env.CI,
- workers: 1,
- retries: process.env.CI ? 2 : 0,
- timeout: parseInt( process.env.TIMEOUT || '', 10 ) || 100_000, // Defaults to 100 seconds.
- // Don't report slow test "files", as we will be running our tests in serial.
- reportSlowTests: null,
- testDir: fileURLToPath( new URL( './specs', 'file:' + __filename ).href ),
- outputDir: path.join( process.cwd(), 'artifacts/test-results' ),
- globalSetup: fileURLToPath(
- new URL( './config/global-setup.ts', 'file:' + __filename ).href
- ),
- use: {
- baseURL: 'http://nginx-helper.com/',
- headless: true,
- viewport: {
- width: 960,
- height: 700,
- },
- ignoreHTTPSErrors: true,
- locale: 'en-US',
- contextOptions: {
- reducedMotion: 'reduce',
- strictSelectors: true,
- },
- storageState: STORAGE_STATE_PATH,
- actionTimeout: 10_000, // 10 seconds.
- trace: 'retain-on-failure',
- screenshot: 'only-on-failure',
- video: 'on-first-retry',
- },
+ ],
+ forbidOnly: !! process.env.CI,
+ workers: 1,
+ retries: process.env.CI ? 2 : 0,
+ timeout: parseInt( process.env.TIMEOUT || '', 10 ) || 100_000, // Defaults to 100 seconds.
+ // Don't report slow test "files", as we will be running our tests in serial.
+ reportSlowTests: null,
+ testDir: fileURLToPath( new URL( './specs', 'file:' + __filename ).href ),
+ outputDir: path.join( process.cwd(), 'artifacts/test-results' ),
+ globalSetup: fileURLToPath(
+ new URL( './config/global-setup.ts', 'file:' + __filename ).href
+ ),
+ use: {
+ baseURL: 'http://nginx-helper.com/',
+ headless: true,
+ viewport: {
+ width: 960,
+ height: 700,
+ },
+ ignoreHTTPSErrors: true,
+ locale: 'en-US',
+ contextOptions: {
+ reducedMotion: 'reduce',
+ strictSelectors: true,
+ },
+ storageState: STORAGE_STATE_PATH,
+ actionTimeout: 10_000, // 10 seconds.
+ trace: 'retain-on-failure',
+ screenshot: 'only-on-failure',
+ video: 'on-first-retry',
+ },
// webServer: {
// command: 'npm run wp-env start',
// port: 8889,
// timeout: 120_000, // 120 seconds.
// reuseExistingServer: true,
// },
- projects: [
- {
- name: 'chromium',
- use: { ...devices[ 'Desktop Chrome' ] },
- },
- ],
- };
-
- export default config;
\ No newline at end of file
+ projects: [
+ {
+ name: 'chromium',
+ use: { ...devices[ 'Desktop Chrome' ] },
+ },
+ ],
+};
+
+export default config;
\ No newline at end of file
diff --git a/tests/e2e-playwright/specs/04_enable-debug-option-test.spec.js b/tests/e2e-playwright/specs/04_enable-debug-option-test.spec.js
index 4732c6db..811fd534 100644
--- a/tests/e2e-playwright/specs/04_enable-debug-option-test.spec.js
+++ b/tests/e2e-playwright/specs/04_enable-debug-option-test.spec.js
@@ -16,18 +16,13 @@ test.describe("Enable the debug option", () => {
expect(page.locator(".rt_option_title")).toHaveText("Nginx Settings");
- if (await page.locator("#enable_log").uncheck) {
- await page.click("#enable_log");
- }
- if (await page.locator("#enable_stamp").uncheck) {
- await page.click("#enable_stamp");
- }
+ // Assert that the checkbox is disabled
+ await expect(page.locator("input#enable_log")).toBeDisabled();
- await page.click("#smart_http_expire_save");
-
- await page.waitForTimeout(1000);
- expect(page.locator("div[class='updated'] p")).toHaveText(
- "Settings saved."
+ expect(
+ page.locator(".enable-logging-message")
+ ).toHaveText(
+ "(NOTE: To enable the logging feature, you must define NGINX_HELPER_LOG constant as true in your wp-config.php)"
);
});