diff --git a/agora-gui/self_testing.yml b/agora-gui/self_testing.yml
index 30ce9d82..072f332d 100644
--- a/agora-gui/self_testing.yml
+++ b/agora-gui/self_testing.yml
@@ -15,14 +15,14 @@
---
- name: AgoraGui, Add Apt signing key for google-chrome
- when: config.agora_gui.enable_self_testing
+ when: config.agora_gui.self_testing.enable
become: true
ansible.builtin.apt_key:
url: "https://dl.google.com/linux/linux_signing_key.pub"
state: present
- name: AgoraGui, Add google-chrome repository into sources list
- when: config.agora_gui.enable_self_testing
+ when: config.agora_gui.self_testing.enable
become: true
ansible.builtin.apt_repository:
repo: deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
@@ -30,6 +30,7 @@
filename: google-chrome
- name: AgoraGui, Install google-chrome
+ when: config.agora_gui.self_testing.enable
become: true
ansible.builtin.apt:
name: google-chrome-stable
@@ -45,13 +46,20 @@
group: agoragui
mode: '0744'
-- name: AgoraGui, set e2e tests baseUrl setting
+- name: AgoraGui, set e2e tests settings
become: true
become_user: agoragui
replace:
dest: /home/agoragui/agora-gui-admin/test/e2e.conf.js
- regexp: 'baseUrl:.*'
- replace: 'baseUrl: "https://{{config.agora_gui.domain}}"'
+ regexp: '{{ item.regexp }}'
+ replace: '{{ item.replace }}'
+ with_items:
+ - regexp: 'defaultTimeoutInterval:.*'
+ replace: 'defaultTimeoutInterval: {{config.agora_gui.self_testing.defaultTimeoutInterval}},'
+ - regexp: 'getPageTimeout:.*'
+ replace: 'getPageTimeout: {{config.agora_gui.self_testing.getPageTimeout}},'
+ - regexp: 'allScriptsTimeout:.*'
+ replace: 'allScriptsTimeout: {{config.agora_gui.self_testing.allScriptsTimeout}},'
- name: AgoraGui, Creating selenium service
become: true
@@ -78,6 +86,7 @@
mode: '0700'
- name: AgoraGui, updating web-driver
+ when: config.agora_gui.self_testing.enable
become: true
become_user: agoragui
ansible.builtin.shell:
diff --git a/agora-gui/templates/launch_selftest.sh b/agora-gui/templates/launch_selftest.sh
index 43084c07..adbf9b89 100644
--- a/agora-gui/templates/launch_selftest.sh
+++ b/agora-gui/templates/launch_selftest.sh
@@ -16,4 +16,17 @@
# along with agora-dev-box. If not, see .
cd /home/agoragui/agora-gui-admin
+export PROTRACTOR_ARGS=$(cat <<-JSON_END
+ {
+ "baseUrl": "https://{{config.agora_gui.domain}}",
+ "params": {
+ "login": {{config.agora_gui.self_testing.admin_user_credentials}},
+ "timeout": {
+ "ECstandards": {{config.agora_gui.self_testing.allScriptsTimeout}},
+ "CreateElections": {{config.agora_gui.self_testing.createElectionsTimeout}}
+ }
+ }
+ }
+JSON_END
+)
grunt protractor
diff --git a/agora-gui/templates/selenium.conf b/agora-gui/templates/selenium.conf
index 3e2ceab8..0a43859b 100644
--- a/agora-gui/templates/selenium.conf
+++ b/agora-gui/templates/selenium.conf
@@ -1,7 +1,7 @@
[program:selenium]
command=/home/agoragui/selenium.sh
directory=/home/agoragui/
-autostart={% if config.agora_gui.enable_self_testing %}true
+autostart={% if config.agora_gui.self_testing.enable %}true
{% else %}false
{% endif %}
autorestart=true
diff --git a/agora-gui/templates/selenium.sh b/agora-gui/templates/selenium.sh
index cc19a4ed..cbc7c629 100644
--- a/agora-gui/templates/selenium.sh
+++ b/agora-gui/templates/selenium.sh
@@ -16,7 +16,7 @@
export DRIVER_PATH=/home/agoragui/agora-gui-admin/node_modules/webdriver-manager
-${DRIVER_PATH}/bin/webdriver-manager update
+${DRIVER_PATH}/bin/webdriver-manager update --ignore_ssl
${DRIVER_PATH}/bin/webdriver-manager \
start \
diff --git a/authapi/install.yml b/authapi/install.yml
index b6acd3ad..242343d1 100644
--- a/authapi/install.yml
+++ b/authapi/install.yml
@@ -129,6 +129,25 @@
virtualenv: /home/authapi/env
settings: authapi.deploy
+- name: Authapi, create e2e_test_user file
+ become: true
+ template:
+ src: authapi/templates/e2e_test_user.json
+ dest: /home/authapi/e2e_test_user.json
+ owner: authapi
+ group: authapi
+ mode: '0600'
+
+- name: AuthApi, upsert e2e_test_user
+ become: true
+ become_user: authapi
+ django_manage:
+ command: upsert_users /home/authapi/e2e_test_user.json
+ args:
+ app_path: /home/authapi/authapi/authapi
+ virtualenv: /home/authapi/env
+ settings: authapi.deploy
+
- name: Authapi, allow authapi user to create databases (for example the test db)
become: true
become_user: postgres
diff --git a/authapi/templates/e2e_test_user.json b/authapi/templates/e2e_test_user.json
new file mode 100644
index 00000000..137f4d70
--- /dev/null
+++ b/authapi/templates/e2e_test_user.json
@@ -0,0 +1,3 @@
+[
+ {{config.agora_gui.self_testing.admin_user_credentials}}
+]
\ No newline at end of file
diff --git a/authapi/templates/sudo-run-selftests b/authapi/templates/sudo-run-selftests
index 42863f03..679b0b9e 100644
--- a/authapi/templates/sudo-run-selftests
+++ b/authapi/templates/sudo-run-selftests
@@ -1,2 +1,4 @@
+{% if config.agora_gui.self_testing.enable %}
authapi ALL = (agoragui) NOPASSWD: /home/agoragui/launch_selftest.sh
authapi ALL = (root) NOPASSWD: /home/agoragui/kill_selftest.sh
+{% endif %}
\ No newline at end of file
diff --git a/authapi/user.yml b/authapi/user.yml
index 0c4ffa4d..0d79170d 100644
--- a/authapi/user.yml
+++ b/authapi/user.yml
@@ -32,7 +32,6 @@
- name: AuthApi, add sudoers file to be able to launch self-tests
become: true
- when: config.agora_gui.enable_self_testing
template:
src: authapi/templates/sudo-run-selftests
dest: /etc/sudoers.d/sudo-run-selftests
diff --git a/config.yml b/config.yml
index f983bdf6..dd70edd0 100644
--- a/config.yml
+++ b/config.yml
@@ -497,12 +497,55 @@ config:
booth_port: 10091
elections_port: 10092
- # Boolean (default: true) that, if set to true, allows admins to launch
- # a suite of automated end-to-end tests that follow the whole process of
- # an election, including registering, creating the election keys, starting
- # the election, voting, stopping, tallying, calculating and publishing the
- # election results.
- enable_self_testing: true
+ self_testing:
+ # Boolean (default: true) that, if set to true, allows admins to launch
+ # a suite of automated end-to-end tests that follow the whole process of
+ # an election, including registering, creating the election keys, starting
+ # the election, voting, stopping, tallying, calculating and publishing the
+ # election results.
+ enable: true
+
+ # credentials used for the admin user in the self tests. This user will be
+ # automatically created and managed by the ansible script. The format of
+ # this data is the same as the elements accepted by authapi's admin
+ # command `upsert_users`.
+ # More Info: https://github.com/agoravoting/authapi/blob/master/authapi/api/management/commands/upsert_users.py#L21
+ admin_user_credentials: |
+ {
+ "username": "e2e_test_admin",
+ "email": "e2e_test_admin@example.com",
+ "password": "",
+ "is_active": true,
+ "is_admin": true,
+ "election_permissions": []
+ }
+
+ # Number (Miliseconds, default: 120,000) Default time to wait before a test
+ # fails.
+ # More Info: https://github.com/angular/protractor/blob/master/lib/config.ts#L629
+ defaultTimeoutInterval: 120000
+
+ # Number (Miliseconds, default: 15,000) How long to wait for a page to
+ # load.
+ # More Info: https://github.com/angular/protractor/blob/master/lib/config.ts#L446
+ getPageTimeout: 15000
+
+ # Number (Miliseconds, default: 10,000) The timeout in milliseconds for
+ # each script run on the browser. This should be longer than the maximum
+ # time your application needs to stabilize between tasks.
+ #
+ # Also used as the default timeout in protractor browser.wait calls.
+ #
+ # More Info:
+ # 1. https://github.com/angular/protractor/blob/master/lib/config.ts#L441
+ # 2. http://www.protractortest.org/#/api?view=webdriver.WebDriver.prototype.wait
+ allScriptsTimeout: 10000
+
+ # Timeout (Miliseconds, default: 120,000) for creating elections during
+ # the tests. Each election takes ~30 seconds/question to create with 2
+ # authorities. Sometimes test might include the creation of multiple
+ # elections with multiple questions, so change this accordingly.
+ createElectionsTimeout: 120000
# Main version shown in the user interface. set to 'false' if you don't
# want it to be shown.
diff --git a/doc/devel/agora.config.yml b/doc/devel/agora.config.yml
index 2e8494b2..4215be16 100644
--- a/doc/devel/agora.config.yml
+++ b/doc/devel/agora.config.yml
@@ -496,6 +496,56 @@ config:
booth_port: 10091
elections_port: 10092
+ self_testing:
+ # Boolean (default: true) that, if set to true, allows admins to launch
+ # a suite of automated end-to-end tests that follow the whole process of
+ # an election, including registering, creating the election keys, starting
+ # the election, voting, stopping, tallying, calculating and publishing the
+ # election results.
+ enable: true
+
+ # credentials used for the admin user in the self tests. This user will be
+ # automatically created and managed by the ansible script. The format of
+ # this data is the same as the elements accepted by authapi's admin
+ # command `upsert_users`.
+ # More Info: https://github.com/agoravoting/authapi/blob/master/authapi/api/management/commands/upsert_users.py#L21
+ admin_user_credentials: |
+ {
+ "username": "e2e_test_admin",
+ "email": "e2e_test_admin@example.com",
+ "password": "",
+ "is_active": true,
+ "is_admin": true,
+ "election_permissions": []
+ }
+
+ # Number (Miliseconds, default: 120,000) Default time to wait before a test
+ # fails.
+ # More Info: https://github.com/angular/protractor/blob/master/lib/config.ts#L629
+ defaultTimeoutInterval: 120000
+
+ # Number (Miliseconds, default: 15,000) How long to wait for a page to
+ # load.
+ # More Info: https://github.com/angular/protractor/blob/master/lib/config.ts#L446
+ getPageTimeout: 15000
+
+ # Number (Miliseconds, default: 10,000) The timeout in milliseconds for
+ # each script run on the browser. This should be longer than the maximum
+ # time your application needs to stabilize between tasks.
+ #
+ # Also used as the default timeout in protractor browser.wait calls.
+ #
+ # More Info:
+ # 1. https://github.com/angular/protractor/blob/master/lib/config.ts#L441
+ # 2. http://www.protractortest.org/#/api?view=webdriver.WebDriver.prototype.wait
+ allScriptsTimeout: 10000
+
+ # Timeout (Miliseconds, default: 120,000) for creating elections during
+ # the tests. Each election takes ~30 seconds/question to create with 2
+ # authorities. Sometimes test might include the creation of multiple
+ # elections with multiple questions, so change this accordingly.
+ createElectionsTimeout: 120000
+
# Main version shown in the user interface. set to 'false' if you don't
# want it to be shown.
mainVersion: 'master'
diff --git a/doc/devel/auth1.config.yml b/doc/devel/auth1.config.yml
index c205225f..d2f4b418 100644
--- a/doc/devel/auth1.config.yml
+++ b/doc/devel/auth1.config.yml
@@ -496,6 +496,56 @@ config:
booth_port: 10091
elections_port: 10092
+ self_testing:
+ # Boolean (default: true) that, if set to true, allows admins to launch
+ # a suite of automated end-to-end tests that follow the whole process of
+ # an election, including registering, creating the election keys, starting
+ # the election, voting, stopping, tallying, calculating and publishing the
+ # election results.
+ enable: true
+
+ # credentials used for the admin user in the self tests. This user will be
+ # automatically created and managed by the ansible script. The format of
+ # this data is the same as the elements accepted by authapi's admin
+ # command `upsert_users`.
+ # More Info: https://github.com/agoravoting/authapi/blob/master/authapi/api/management/commands/upsert_users.py#L21
+ admin_user_credentials: |
+ {
+ "username": "e2e_test_admin",
+ "email": "e2e_test_admin@example.com",
+ "password": "",
+ "is_active": true,
+ "is_admin": true,
+ "election_permissions": []
+ }
+
+ # Number (Miliseconds, default: 120,000) Default time to wait before a test
+ # fails.
+ # More Info: https://github.com/angular/protractor/blob/master/lib/config.ts#L629
+ defaultTimeoutInterval: 120000
+
+ # Number (Miliseconds, default: 15,000) How long to wait for a page to
+ # load.
+ # More Info: https://github.com/angular/protractor/blob/master/lib/config.ts#L446
+ getPageTimeout: 15000
+
+ # Number (Miliseconds, default: 10,000) The timeout in milliseconds for
+ # each script run on the browser. This should be longer than the maximum
+ # time your application needs to stabilize between tasks.
+ #
+ # Also used as the default timeout in protractor browser.wait calls.
+ #
+ # More Info:
+ # 1. https://github.com/angular/protractor/blob/master/lib/config.ts#L441
+ # 2. http://www.protractortest.org/#/api?view=webdriver.WebDriver.prototype.wait
+ allScriptsTimeout: 10000
+
+ # Timeout (Miliseconds, default: 120,000) for creating elections during
+ # the tests. Each election takes ~30 seconds/question to create with 2
+ # authorities. Sometimes test might include the creation of multiple
+ # elections with multiple questions, so change this accordingly.
+ createElectionsTimeout: 120000
+
# Main version shown in the user interface. set to 'false' if you don't
# want it to be shown.
mainVersion: 'master'
diff --git a/doc/devel/auth2.config.yml b/doc/devel/auth2.config.yml
index b2b4389b..ff0c7c18 100644
--- a/doc/devel/auth2.config.yml
+++ b/doc/devel/auth2.config.yml
@@ -496,12 +496,55 @@ config:
booth_port: 10091
elections_port: 10092
- # Boolean (default: true) that, if set to true, allows admins to launch
- # a suite of automated end-to-end tests that follow the whole process of
- # an election, including registering, creating the election keys, starting
- # the election, voting, stopping, tallying, calculating and publishing the
- # election results.
- enable_self_testing: true
+ self_testing:
+ # Boolean (default: true) that, if set to true, allows admins to launch
+ # a suite of automated end-to-end tests that follow the whole process of
+ # an election, including registering, creating the election keys, starting
+ # the election, voting, stopping, tallying, calculating and publishing the
+ # election results.
+ enable: true
+
+ # credentials used for the admin user in the self tests. This user will be
+ # automatically created and managed by the ansible script. The format of
+ # this data is the same as the elements accepted by authapi's admin
+ # command `upsert_users`.
+ # More Info: https://github.com/agoravoting/authapi/blob/master/authapi/api/management/commands/upsert_users.py#L21
+ admin_user_credentials: |
+ {
+ "username": "e2e_test_admin",
+ "email": "e2e_test_admin@example.com",
+ "password": "",
+ "is_active": true,
+ "is_admin": true,
+ "election_permissions": []
+ }
+
+ # Number (Miliseconds, default: 120,000) Default time to wait before a test
+ # fails.
+ # More Info: https://github.com/angular/protractor/blob/master/lib/config.ts#L629
+ defaultTimeoutInterval: 120000
+
+ # Number (Miliseconds, default: 15,000) How long to wait for a page to
+ # load.
+ # More Info: https://github.com/angular/protractor/blob/master/lib/config.ts#L446
+ getPageTimeout: 15000
+
+ # Number (Miliseconds, default: 10,000) The timeout in milliseconds for
+ # each script run on the browser. This should be longer than the maximum
+ # time your application needs to stabilize between tasks.
+ #
+ # Also used as the default timeout in protractor browser.wait calls.
+ #
+ # More Info:
+ # 1. https://github.com/angular/protractor/blob/master/lib/config.ts#L441
+ # 2. http://www.protractortest.org/#/api?view=webdriver.WebDriver.prototype.wait
+ allScriptsTimeout: 10000
+
+ # Timeout (Miliseconds, default: 120,000) for creating elections during
+ # the tests. Each election takes ~30 seconds/question to create with 2
+ # authorities. Sometimes test might include the creation of multiple
+ # elections with multiple questions, so change this accordingly.
+ createElectionsTimeout: 120000
# Main version shown in the user interface. set to 'false' if you don't
# want it to be shown.
diff --git a/doc/production/config.auth.yml b/doc/production/config.auth.yml
index b646dce9..766872e6 100644
--- a/doc/production/config.auth.yml
+++ b/doc/production/config.auth.yml
@@ -496,12 +496,55 @@ config:
booth_port: 10091
elections_port: 10092
- # Boolean (default: true) that, if set to true, allows admins to launch
- # a suite of automated end-to-end tests that follow the whole process of
- # an election, including registering, creating the election keys, starting
- # the election, voting, stopping, tallying, calculating and publishing the
- # election results.
- enable_self_testing: true
+ self_testing:
+ # Boolean (default: true) that, if set to true, allows admins to launch
+ # a suite of automated end-to-end tests that follow the whole process of
+ # an election, including registering, creating the election keys, starting
+ # the election, voting, stopping, tallying, calculating and publishing the
+ # election results.
+ enable: true
+
+ # credentials used for the admin user in the self tests. This user will be
+ # automatically created and managed by the ansible script. The format of
+ # this data is the same as the elements accepted by authapi's admin
+ # command `upsert_users`.
+ # More Info: https://github.com/agoravoting/authapi/blob/master/authapi/api/management/commands/upsert_users.py#L21
+ admin_user_credentials: |
+ {
+ "username": "e2e_test_admin",
+ "email": "e2e_test_admin@example.com",
+ "password": "",
+ "is_active": true,
+ "is_admin": true,
+ "election_permissions": []
+ }
+
+ # Number (Miliseconds, default: 120,000) Default time to wait before a test
+ # fails.
+ # More Info: https://github.com/angular/protractor/blob/master/lib/config.ts#L629
+ defaultTimeoutInterval: 120000
+
+ # Number (Miliseconds, default: 15,000) How long to wait for a page to
+ # load.
+ # More Info: https://github.com/angular/protractor/blob/master/lib/config.ts#L446
+ getPageTimeout: 15000
+
+ # Number (Miliseconds, default: 10,000) The timeout in milliseconds for
+ # each script run on the browser. This should be longer than the maximum
+ # time your application needs to stabilize between tasks.
+ #
+ # Also used as the default timeout in protractor browser.wait calls.
+ #
+ # More Info:
+ # 1. https://github.com/angular/protractor/blob/master/lib/config.ts#L441
+ # 2. http://www.protractortest.org/#/api?view=webdriver.WebDriver.prototype.wait
+ allScriptsTimeout: 10000
+
+ # Timeout (Miliseconds, default: 120,000) for creating elections during
+ # the tests. Each election takes ~30 seconds/question to create with 2
+ # authorities. Sometimes test might include the creation of multiple
+ # elections with multiple questions, so change this accordingly.
+ createElectionsTimeout: 120000
# Main version shown in the user interface. set to 'false' if you don't
# want it to be shown.
diff --git a/doc/production/config.master.yml b/doc/production/config.master.yml
index 2f731649..78cba5d0 100644
--- a/doc/production/config.master.yml
+++ b/doc/production/config.master.yml
@@ -496,12 +496,55 @@ config:
booth_port: 10091
elections_port: 10092
- # Boolean (default: true) that, if set to true, allows admins to launch
- # a suite of automated end-to-end tests that follow the whole process of
- # an election, including registering, creating the election keys, starting
- # the election, voting, stopping, tallying, calculating and publishing the
- # election results.
- enable_self_testing: true
+ self_testing:
+ # Boolean (default: true) that, if set to true, allows admins to launch
+ # a suite of automated end-to-end tests that follow the whole process of
+ # an election, including registering, creating the election keys, starting
+ # the election, voting, stopping, tallying, calculating and publishing the
+ # election results.
+ enable: true
+
+ # credentials used for the admin user in the self tests. This user will be
+ # automatically created and managed by the ansible script. The format of
+ # this data is the same as the elements accepted by authapi's admin
+ # command `upsert_users`.
+ # More Info: https://github.com/agoravoting/authapi/blob/master/authapi/api/management/commands/upsert_users.py#L21
+ admin_user_credentials: |
+ {
+ "username": "e2e_test_admin",
+ "email": "e2e_test_admin@example.com",
+ "password": "",
+ "is_active": true,
+ "is_admin": true,
+ "election_permissions": []
+ }
+
+ # Number (Miliseconds, default: 120,000) Default time to wait before a test
+ # fails.
+ # More Info: https://github.com/angular/protractor/blob/master/lib/config.ts#L629
+ defaultTimeoutInterval: 120000
+
+ # Number (Miliseconds, default: 15,000) How long to wait for a page to
+ # load.
+ # More Info: https://github.com/angular/protractor/blob/master/lib/config.ts#L446
+ getPageTimeout: 15000
+
+ # Number (Miliseconds, default: 10,000) The timeout in milliseconds for
+ # each script run on the browser. This should be longer than the maximum
+ # time your application needs to stabilize between tasks.
+ #
+ # Also used as the default timeout in protractor browser.wait calls.
+ #
+ # More Info:
+ # 1. https://github.com/angular/protractor/blob/master/lib/config.ts#L441
+ # 2. http://www.protractortest.org/#/api?view=webdriver.WebDriver.prototype.wait
+ allScriptsTimeout: 10000
+
+ # Timeout (Miliseconds, default: 120,000) for creating elections during
+ # the tests. Each election takes ~30 seconds/question to create with 2
+ # authorities. Sometimes test might include the creation of multiple
+ # elections with multiple questions, so change this accordingly.
+ createElectionsTimeout: 120000
# Main version shown in the user interface. set to 'false' if you don't
# want it to be shown.