From b95f77f9c577760d922776f6d37d2f8d576740a2 Mon Sep 17 00:00:00 2001 From: Eduardo Robles Elvira Date: Fri, 28 Jan 2022 16:07:13 +0100 Subject: [PATCH 1/3] Fine-grained selenium support also with user credentials --- docs/deployment/assets/config.auth.yml | 45 ++++++++++++++++++++---- docs/deployment/assets/config.master.yml | 45 ++++++++++++++++++++---- 2 files changed, 78 insertions(+), 12 deletions(-) diff --git a/docs/deployment/assets/config.auth.yml b/docs/deployment/assets/config.auth.yml index f8a5f7a4..f7632ced 100644 --- a/docs/deployment/assets/config.auth.yml +++ b/docs/deployment/assets/config.auth.yml @@ -497,12 +497,45 @@ 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: 120000) 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: 15000) 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: 10000) 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. + # More Info: https://github.com/angular/protractor/blob/master/lib/config.ts#L441 + allScriptsTimeout: 10000 + # Main version shown in the user interface. set to 'false' if you don't # want it to be shown. diff --git a/docs/deployment/assets/config.master.yml b/docs/deployment/assets/config.master.yml index 2a085ca9..1f2d3936 100644 --- a/docs/deployment/assets/config.master.yml +++ b/docs/deployment/assets/config.master.yml @@ -497,12 +497,45 @@ 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: 120000) 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: 15000) 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: 10000) 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. + # More Info: https://github.com/angular/protractor/blob/master/lib/config.ts#L441 + allScriptsTimeout: 10000 + # Main version shown in the user interface. set to 'false' if you don't # want it to be shown. From 087b02fe2213a03508c305160e40f727ab9712d9 Mon Sep 17 00:00:00 2001 From: Eduardo Robles Elvira Date: Sun, 30 Jan 2022 16:43:59 +0100 Subject: [PATCH 2/3] standarizing browser.wait timeout --- docs/deployment/assets/config.auth.yml | 8 ++++++-- docs/deployment/assets/config.master.yml | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/deployment/assets/config.auth.yml b/docs/deployment/assets/config.auth.yml index f7632ced..51f267f4 100644 --- a/docs/deployment/assets/config.auth.yml +++ b/docs/deployment/assets/config.auth.yml @@ -533,10 +533,14 @@ config: # Number (Miliseconds, default: 10000) 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. - # More Info: https://github.com/angular/protractor/blob/master/lib/config.ts#L441 + # + # 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 - # Main version shown in the user interface. set to 'false' if you don't # want it to be shown. mainVersion: 'master' diff --git a/docs/deployment/assets/config.master.yml b/docs/deployment/assets/config.master.yml index 1f2d3936..7ede2308 100644 --- a/docs/deployment/assets/config.master.yml +++ b/docs/deployment/assets/config.master.yml @@ -533,10 +533,14 @@ config: # Number (Miliseconds, default: 10000) 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. - # More Info: https://github.com/angular/protractor/blob/master/lib/config.ts#L441 + # + # 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 - # Main version shown in the user interface. set to 'false' if you don't # want it to be shown. mainVersion: 'master' From 5f5935d9fbfb10853634a13983e0b509e61682c6 Mon Sep 17 00:00:00 2001 From: Eduardo Robles Elvira Date: Mon, 31 Jan 2022 10:15:53 +0100 Subject: [PATCH 3/3] adding specific timeout for election creation --- docs/deployment/assets/config.auth.yml | 12 +++++++++--- docs/deployment/assets/config.master.yml | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/docs/deployment/assets/config.auth.yml b/docs/deployment/assets/config.auth.yml index 51f267f4..8fd7dae7 100644 --- a/docs/deployment/assets/config.auth.yml +++ b/docs/deployment/assets/config.auth.yml @@ -520,17 +520,17 @@ config: "election_permissions": [] } - # Number (Miliseconds, default: 120000) Default time to wait before a test + # 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: 15000) How long to wait for a page to + # 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: 10000) The timeout in milliseconds for + # 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. # @@ -541,6 +541,12 @@ config: # 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/docs/deployment/assets/config.master.yml b/docs/deployment/assets/config.master.yml index 7ede2308..5a6b133b 100644 --- a/docs/deployment/assets/config.master.yml +++ b/docs/deployment/assets/config.master.yml @@ -520,17 +520,17 @@ config: "election_permissions": [] } - # Number (Miliseconds, default: 120000) Default time to wait before a test + # 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: 15000) How long to wait for a page to + # 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: 10000) The timeout in milliseconds for + # 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. # @@ -541,6 +541,12 @@ config: # 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'