Skip to content

Commit eb1e37f

Browse files
committed
fix tests
1 parent 6c48a66 commit eb1e37f

File tree

6 files changed

+32
-11
lines changed

6 files changed

+32
-11
lines changed

docs/contribute.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,28 @@ docker-compose logs crowdsec
5858

5959
## Run functionnal tests
6060

61+
Headless mode (speed up):
62+
6163
```bash
62-
./tests-local.sh # headless mode for speed up
64+
./tests-local.sh
65+
```
6366

64-
DEBUG ./tests-local.sh
67+
Debug mode (add tests):
6568

66-
# All the version
67-
./tests-local.sh; ./tests-local-wp5.5.sh; ./tests-local-wp5.4.sh; \
68-
./tests-local-wp5.3.sh; ./tests-local-wp5.2.sh; ./tests-local-wp5.1.sh; \
69-
./tests-local-wp5.0.sh; ./tests-local-wp4.9.sh
69+
```bash
70+
DEBUG ./tests-local.sh
7071
```
7172

7273
> Note: you can add `await jestPlaywright.debug();` at the moment you want to pause the process.
7374
75+
All the versions:
76+
77+
```bash
78+
./tests-local-wpall.sh
79+
```
80+
81+
> Note: If you have some problems while running tests, `docker system prune --volumes` can help.
82+
7483
# WP Scan pass
7584

7685
```bash
@@ -97,7 +106,7 @@ CS_WORDPRESS_BOUNCER_PHP_VERSION=7.2 docker-compose up -d --build --force-recrea
97106

98107
### Use another Worpress version
99108

100-
In end 2020, [more than 90% of the wordpress websites](https://wordpress.org/about/stats/) was using Wordpress versions:
109+
In end 2020, [more than 90% of the wordpress websites](https://wordpress.org/about/stats/) was using WordPress versions:
101110

102111
The plugin is tested under each of these versions: `5.6`, `5.5`, `5.4`, `5.3`, `5.2`, `5.1`, `5.0`, `4.9`.
103112

inc/constants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
define('CROWDSEC_CAPTCHA_TECHNOLOGY_LOCAL', 'local');
1616
define('CROWDSEC_CAPTCHA_TECHNOLOGY_RECAPTCHA', 'recaptcha');
1717

18-
define('CROWDSEC_BOUNCER_USER_AGENT', 'Wordpress CrowdSec Bouncer/v0.3.0');
18+
define('CROWDSEC_BOUNCER_USER_AGENT', 'WordPress CrowdSec Bouncer/v0.3.0');

tests-local-wpall.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
./tests-local.sh
4+
./tests-local-wp5.5.sh
5+
./tests-local-wp5.4.sh
6+
./tests-local-wp5.3.sh
7+
./tests-local-wp5.2.sh
8+
./tests-local-wp5.1.sh
9+
./tests-local-wp5.0.sh
10+
./tests-local-wp4.9.sh
11+
12+
cat tests/functional/.test-results-* | jq .success

tests-local.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ WATCHER_LOGIN='watcherLogin'
55
WATCHER_PASSWORD='watcherPassword'
66

77
# Run stack
8-
docker-compose down --remove-orphans --timeout 0
8+
docker-compose down --remove-orphans
99
docker-compose up -d wordpress$WORDPRESS_VERSION crowdsec mysql redis memcached
1010

1111
# Setup CrowdSec

tests/functional/__tests__/functional.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const WP51 = WORDPRESS_VERSION === "5.1";
3636
const WP50 = WORDPRESS_VERSION === "5.0";
3737
const WP49 = WORDPRESS_VERSION === "4.9";
3838

39-
describe(`Install Stack: WordPress ${WORDPRESS_VERSION} + the CrowdSec plugin`, () => {
39+
describe(`Run CrowdSec plugin on WordPress ${WORDPRESS_VERSION}`, () => {
4040
beforeAll(async () => {});
4141

4242
afterAll(async () => {

tests/functional/jest-playwright.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
headless: !debug,
55
devtools: debug,
66
},
7-
connectOptions: debug ? {slowMo: 150} : {},
7+
connectOptions: debug ? {slowMo: 150} : {slowMo: 50},
88
exitOnPageError: !debug,
99
contextOptions: {
1010
ignoreHTTPSErrors: true,

0 commit comments

Comments
 (0)