Skip to content

Commit 27d1a84

Browse files
Merge pull request #68 from julienloizelet/feature/67-wordpress-5-9-compatibility
Feature/67 wordpress 5 9 compatibility
2 parents ae42956 + 28832a7 commit 27d1a84

File tree

8 files changed

+47
-6
lines changed

8 files changed

+47
-6
lines changed

.github/workflows/end-to-end-test-suite.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
wp-version: [ 4.9, 5.7 ]
14+
wp-version: [ 4.9, 5.0.1, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9 ]
1515
php-version: [ 7.2, 7.4 ]
1616
exclude:
1717
- { php-version: 7.4, wp-version: 4.9 }
18+
- { php-version: 7.4, wp-version: 5.0.1 }
19+
- { php-version: 7.4, wp-version: 5.1 }
20+
- { php-version: 7.4, wp-version: 5.2 }
1821

1922
name: End-to-end test suite
2023
runs-on: ubuntu-latest

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

77

8+
## [1.2.5] - 2022-01-27
9+
10+
### Added
11+
- Add test for WordPress 5.9
12+
813
## [1.2.4] - 2021-12-16
914

1015
### Fixed
@@ -30,7 +35,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
3035
## [1.2.0] - 2021-12-09
3136

3237
### Added
33-
- Add end to end github actions test
38+
- Add end to end GitHub actions test
3439

3540
### Removed
3641
- Remove useless configuration to enable standalone mode. This mode should be entirely determined by the presence of

docs/ddev.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,23 @@ ddev exec wp core install --url='https://wp565.ddev.site' --title='WordPress' --
8686

8787
### Test the module
8888

89+
#### Install the module
90+
91+
```
92+
cd wp-sources
93+
mkdir my-own-modules && mkdir my-own-modules/crowdsec-bouncer && cd my-own-modules/crowdsec-bouncer
94+
git clone git@github.com:crowdsecurity/cs-wordpress-bouncer.git ./
95+
ddev composer install --working-dir ./my-own-modules/crowdsec-bouncer
96+
cd wp-sources
97+
cp .ddev/additional_docker_compose/docker-compose.crowdsec.yaml .ddev/docker-compose.crowdsec.yaml
98+
cp .ddev/additional_docker_compose/docker-compose.playwright.yaml .ddev/docker-compose.playwright.yaml
99+
ddev start
100+
```
101+
102+
Login to the admin by browsing the url `https://wp565.ddev.site/admin` (username: `admin` and password: `admin123`)
103+
104+
Activate the CrowdSec plugin
105+
89106
#### End-to-end tests
90107

91108
```

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: crowdsec
33
Donate link: https://crowdsec.net/
44
Tags: crowdsec-bouncer, wordpress, security, firewall, captcha, ip-scanner, ip-blocker, ip-blocking, ip-address, ip-database, ip-range-check, crowdsec, ban-hosts, ban-management, anti-hacking, hacker-protection, captcha-image, captcha-generator, captcha-generation, captcha-service
55
Requires at least: 4.9
6-
Tested up to: 5.8
6+
Tested up to: 5.9
77
Stable tag: 1.2.4
88
Requires PHP: 7.2
99
License: MIT

tests/e2e-ddev/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ node_modules
33
.test-results-*.json
44
*.lock
55
*.log
6+
*.jpg

tests/e2e-ddev/CustomEnvironment.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ class CustomEnvironment extends PlaywrightEnvironment {
99
event.name === "test_fn_failure"
1010
) {
1111
this.failedTest = true;
12-
const buffer = await this.global.page.screenshot();
12+
const buffer = await this.global.page.screenshot({
13+
path: "screenshot.jpg",
14+
type: "jpeg",
15+
quality: 20,
16+
});
1317
console.debug("Screenshot:", buffer.toString("base64"));
1418
} else if (this.failedTest && event.name === "test_start") {
1519
// eslint-disable-next-line no-param-reassign

tests/e2e-ddev/__tests__/1-activate-plugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable no-undef */
2-
const { ADMIN_URL, WP58, WP57, WP56, WP55 } = require("../utils/constants");
2+
const { ADMIN_URL, WP59, WP58, WP57, WP56, WP55 } = require("../utils/constants");
33

44
const {
55
waitForNavigation,
@@ -19,7 +19,7 @@ describe(`Setup CrowdSec plugin`, () => {
1919
// "Plugins" page
2020
await wait(2000);
2121
await page.goto(`${ADMIN_URL}/plugins.php`);
22-
if (WP55 || WP56 || WP57 || WP58) {
22+
if (WP55 || WP56 || WP57 || WP58 || WP59) {
2323
await page.click("#activate-crowdsec");
2424
} else {
2525
await page.click('[aria-label="Activate CrowdSec"]');

tests/e2e-ddev/utils/constants.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@ const { TIMEOUT } = process.env;
1414
const { CURRENT_IP } = process.env;
1515
const { PROXY_IP } = process.env;
1616
const OTHER_IP = "1.2.3.4";
17+
const WP59 = WORDPRESS_VERSION.startsWith("59");
1718
const WP58 = WORDPRESS_VERSION.startsWith("58");
1819
const WP57 = WORDPRESS_VERSION.startsWith("57");
1920
const WP56 = WORDPRESS_VERSION.startsWith("56");
2021
const WP55 = WORDPRESS_VERSION.startsWith("55");
2122
const WP54 = WORDPRESS_VERSION.startsWith("54");
2223
const WP53 = WORDPRESS_VERSION.startsWith("53");
24+
const WP52 = WORDPRESS_VERSION.startsWith("52");
25+
const WP51 = WORDPRESS_VERSION.startsWith("51");
26+
const WP50 = WORDPRESS_VERSION.startsWith("50");
27+
const WP49 = WORDPRESS_VERSION.startsWith("49");
28+
2329

2430
module.exports = {
2531
ADMIN_URL,
@@ -32,12 +38,17 @@ module.exports = {
3238
LAPI_URL_FROM_WP,
3339
LAPI_URL_FROM_PLAYWRIGHT,
3440
OTHER_IP,
41+
WP59,
3542
WP58,
3643
WP57,
3744
WP56,
3845
WP55,
3946
WP54,
4047
WP53,
48+
WP52,
49+
WP51,
50+
WP50,
51+
WP49,
4152
DEBUG,
4253
TIMEOUT,
4354
WATCHER_LOGIN,

0 commit comments

Comments
 (0)