Skip to content

Commit c6af492

Browse files
committed
CI: Remove Selenium server from behat tests requirements
1 parent 0c8988c commit c6af492

File tree

2 files changed

+39
-42
lines changed

2 files changed

+39
-42
lines changed

tests/behat/README.md

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
11
In order to run behat tests locally with the right support for browser
22
and JS environments under Linux, you will need to:
33

4-
- Have Java installed (see notes below)
5-
- Download Selenium Standalone Server v3.*
6-
7-
http://www.seleniumhq.org/download/
8-
9-
And run it with the following command:
10-
11-
```
12-
java -jar /my-dir/selenium-server-standalone-3.1.0.jar
13-
```
14-
154
- Download the Chrome driver, unzip and copy into /usr/bin
165

176
Check the latest `chromedriver` version at [https://googlechromelabs.github.io/chrome-for-testing/](https://googlechromelabs.github.io/chrome-for-testing/) that matches your configuration (linux64 for Ubuntu), then adapt the following command to the latest version. Use a version that matches your version of the Chrome browser.
187

198
```
20-
cd /tmp && wget https://storage.googleapis.com/chrome-for-testing-public/143.0.7499.40/linux64/chromedriver-linux64.zip && unzip chromedriver_linux64.zip && sudo mv chromedriver /usr/local/bin
9+
cd /tmp && wget https://storage.googleapis.com/chrome-for-testing-public/143.0.7499.40/linux64/chromedriver-linux64.zip && unzip chromedriver_linux64.zip && sudo mv chromedriver_linux64/chromedriver /usr/local/bin/
2110
```
2211

12+
- Have the Google Chrome browser installed (or any other browser that supports headless mode, but instructions and configurations below will change accordingly).
13+
2314
### Chamilo configuration
2415

2516
- An administrator user should be created with these parameters:
@@ -29,29 +20,32 @@ cd /tmp && wget https://storage.googleapis.com/chrome-for-testing-public/143.0.7
2920
- Last name "Doe"
3021
- user_id = 1 (this one is set when you install Chamilo, but just in case...)
3122

32-
- Edit the tests/behat/behat.yml file and update the base_url param with your own Chamilo local URL.
23+
- Edit the tests/behat/behat.yml file and update the base_url param with your own Chamilo local URL and make sure your machine understands it (e.g. add it to your /etc/hosts file).
3324
- The main platform language and the admin user's language must be English (`platform_language = 'en_US'` in the `settings` table and admin user profile)
3425
- Social network tool must be available (`allow_social_tool = 'true'` in the `settings` table)
3526
- Student can register to the system (`allow_registration = 'true'` in the `settings` table)
3627
- Teacher can register to the system (`allow_registration_as_teacher = 'true'` in the `settings` table)
3728

29+
### Launch the chromedriver
30+
```
31+
chromedriver --port=4444
32+
```
33+
If you want to run the tests with a different base_url (see behat.yml), you will need to ask chromedriver to allow calls from remote IPs. This has serious security implications if the testing machine is exposed to the internet, so please be careful.
34+
```
35+
chromedriver --port=4444 --allowed-origins='*' --allowed-ips={your-ip-on-the-local-network}
36+
```
37+
3838
### Run tests
3939

40-
To run all features:
40+
To run all features (including the installation of Chamilo - which you might want to disable in features/actionInstall.feature if you already have Chamilo installed):
4141

4242
```
4343
# /var/www/html/chamilo
4444
cd tests/behat
4545
../../vendor/behat/behat/bin/behat -v
4646
```
4747

48-
To run an specific feature:
49-
48+
To run a specific feature:
5049
```
5150
../../vendor/behat/behat/bin/behat features/course.feature
5251
```
53-
54-
## Java versions
55-
56-
Not all java versions will work. For Ubuntu, `sudo apt install openjdk-11-jdk openjdk-11-jre` should do, but OpenJDK 17 will not work, for example.
57-
If you have several versions installed, you can update the "active" version with `sudo update-java-alternatives -l` to see the possibilities, then `sudo update-java-alternatives -s java-1.11.0-openjdk-amd64` or something like that to set it. Beware this can have a big impact on other things you run with Java (like your IDE?) so maybe think about undoing this later on...

tests/behat/behat.yml

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
default:
2-
extensions:
3-
Behat\MinkExtension:
4-
base_url: http://localhost
5-
show_cmd: 'open %s'
6-
selenium2:
7-
wd_host: "http://127.0.0.1:4444/wd/hub"
8-
browser: chrome
9-
capabilities:
10-
extra_capabilities:
11-
chromeOptions:
12-
args:
13-
- "--ignore-certificate-errors"
14-
w3c: false
15-
default_session: selenium2
16-
javascript_session: selenium2
17-
files_path: "%paths.base%/../../"
18-
suites:
19-
default:
20-
paths: ["%paths.base%/features"]
21-
formatters:
22-
pretty: true
2+
extensions:
3+
Behat\MinkExtension:
4+
base_url: http://localhost
5+
default_session: selenium2
6+
javascript_session: selenium2
7+
selenium2:
8+
wd_host: "http://127.0.0.1:4444"
9+
browser: chrome
10+
capabilities:
11+
browserName: chrome
12+
extra_capabilities:
13+
"goog:chromeOptions":
14+
args:
15+
- "--headless=new"
16+
- "--no-sandbox"
17+
- "--disable-dev-shm-usage"
18+
- "--disable-gpu"
19+
- "--window-size=1920,1080"
20+
files_path: "%paths.base%/../../"
21+
suites:
22+
default:
23+
paths: ["%paths.base%/features"]
24+
formatters:
25+
pretty: true

0 commit comments

Comments
 (0)