Commit 6789af2e authored by Swergas's avatar Swergas

implement first steps of test scenario 3 (trustees with threshold)

parent 7eaf4d5d
......@@ -64,6 +64,8 @@ build_and_run_automated_test_scenarios_with_preinstalled_image:
- source venv/bin/activate
# Install pip packages
- pip install -r requirements.txt
# Run the automated test scenario 3
- python3 ./tests/test_scenario_3.py
# Run the automated test scenario 2
- python3 ./tests/test_scenario_2.py
# Run the automated test scenario 1
......
This diff is collapsed.
......@@ -20,6 +20,7 @@ ELECTION_TITLE = "My test election for Scenario 1"
ELECTION_DESCRIPTION = "This is the description of my test election for Scenario 1"
ADMINISTRATOR_USERNAME = "user1" # This value comes from file `demo/password_db.csv`, first row, first column
ADMINISTRATOR_PASSWORD = "phiexoey" # This value comes from file `demo/password_db.csv`, first row, 4th column
INITIATOR_CONTACT = "Election initiator <election.initiator@mytestelection.com>"
GIT_REPOSITORY_ABSOLUTE_PATH = dirname(dirname(abspath(__file__)))
......@@ -28,4 +29,6 @@ GIT_REPOSITORY_ABSOLUTE_PATH = dirname(dirname(abspath(__file__)))
BROWSER_DOWNLOAD_FOLDER = "/tmp"
ADMINISTRATOR_EMAIL_ADDRESS = "alice_aka_election_administrator@mailinator.com"
CREDENTIAL_AUTHORITY_EMAIL_ADDRESS = "cecily_aka_election_credential_authority@mailinator.com"
TRUSTEES_EMAIL_ADDRESSES = ["tom_aka_trustee_1@mailinator.com", "taylor_aka_trustee_2@mailinator.com"]
\ No newline at end of file
NUMBER_OF_TRUSTEES = 5
TRUSTEES_EMAIL_ADDRESSES = ["tom_aka_trustee_1@mailinator.com", "taylor_aka_trustee_2@mailinator.com", "tania_aka_trustee_3@mailinator.com", "tiffany_aka_trustee_4@mailinator.com", "theresa_aka_trustee_5@mailinator.com"]
TRUSTEES_THRESHOLD_VALUE = 3
......@@ -20,7 +20,7 @@ def initialize_browser_for_scenario_2():
return initialize_browser(for_scenario_2=True)
class BeleniosTestElectionScenario2(BeleniosElectionTestBase):
class BeleniosTestElectionScenario2Base(BeleniosElectionTestBase):
"""
Properties:
- server
......@@ -102,8 +102,10 @@ class BeleniosTestElectionScenario2(BeleniosElectionTestBase):
# - She picks the Credential management method: manual
# (- She keeps default value for Authentication method: it is Password, not CAS)
# - She clicks on the "Proceed" button (this redirects to the "Preparation of election" page)
# - She changes values of fields name and description of the election
# - In the "Name and description of the election" section, she changes values of fields name and description of the election
# - She clicks on the "Save changes button" (the one that is next to the election description field)
# - In "Contact" section, she changes the value of "contact" field
# - She clicks on the "Save changes" button (the one that is in the "Contact" section)
administrator_starts_creation_of_election(browser, True)
# She remembers the URL of the draft election administration page
......@@ -609,7 +611,10 @@ The election administrator.\
self.administrator_verifies_vote_results()
class BeleniosTestElectionScenario2(BeleniosTestElectionScenario2Base):
def test_scenario_2_manual_vote(self):
console_log("### Running test method BeleniosTestElectionScenario2::test_scenario_2_manual_vote()")
console_log("### Starting step: administrator_starts_creation_of_manual_election")
self.administrator_starts_creation_of_manual_election()
console_log("### Step complete: administrator_starts_creation_of_manual_election")
......@@ -699,6 +704,7 @@ if __name__ == "__main__":
settings.ADMINISTRATOR_PASSWORD = os.getenv('ADMINISTRATOR_PASSWORD', settings.ADMINISTRATOR_PASSWORD)
settings.ELECTION_TITLE = os.getenv('ELECTION_TITLE', settings.ELECTION_TITLE)
settings.ELECTION_DESCRIPTION = os.getenv('ELECTION_DESCRIPTION', settings.ELECTION_DESCRIPTION)
settings.INITIATOR_CONTACT = os.getenv('INITIATOR_CONTACT', settings.INITIATOR_CONTACT)
settings.BROWSER_DOWNLOAD_FOLDER = os.getenv('BROWSER_DOWNLOAD_FOLDER', settings.BROWSER_DOWNLOAD_FOLDER)
settings.ADMINISTRATOR_EMAIL_ADDRESS = os.getenv('ADMINISTRATOR_EMAIL_ADDRESS', settings.ADMINISTRATOR_EMAIL_ADDRESS)
settings.CREDENTIAL_AUTHORITY_EMAIL_ADDRESS = os.getenv('CREDENTIAL_AUTHORITY_EMAIL_ADDRESS', settings.CREDENTIAL_AUTHORITY_EMAIL_ADDRESS)
......@@ -714,6 +720,7 @@ if __name__ == "__main__":
console_log("NUMBER_OF_REGENERATED_PASSWORD_VOTERS:", settings.NUMBER_OF_REGENERATED_PASSWORD_VOTERS)
console_log("ELECTION_TITLE:", settings.ELECTION_TITLE)
console_log("ELECTION_DESCRIPTION:", settings.ELECTION_DESCRIPTION)
console_log("INITIATOR_CONTACT:", settings.INITIATOR_CONTACT)
console_log("BROWSER_DOWNLOAD_FOLDER:", settings.BROWSER_DOWNLOAD_FOLDER)
console_log("ADMINISTRATOR_EMAIL_ADDRESS:", settings.ADMINISTRATOR_EMAIL_ADDRESS)
console_log("CREDENTIAL_AUTHORITY_EMAIL_ADDRESS:", settings.CREDENTIAL_AUTHORITY_EMAIL_ADDRESS)
......
This diff is collapsed.
......@@ -381,7 +381,7 @@ def log_out(browser):
wait_for_element_exists_and_contains_expected_text(browser, "#main button", "Start", settings.EXPLICIT_WAIT_TIMEOUT)
def administrator_starts_creation_of_election(browser, manual_credential_management=False, election_title=None, election_description=None):
def administrator_starts_creation_of_election(browser, manual_credential_management=False, election_title=None, election_description=None, initiator_contact=None):
"""
Initial browser (required) state: administrator has just logged in
Final browser state: on the "Preparation of election" page
......@@ -391,8 +391,10 @@ def administrator_starts_creation_of_election(browser, manual_credential_managem
- She picks the Credential management method she wants (function paramenter `manual_credential_management`)
(- She keeps default value for Authentication method: it is Password, not CAS)
- She clicks on the "Proceed" button (this redirects to the "Preparation of election" page)
- She changes values of fields name and description of the election
- In the "Name and description of the election" section, she changes values of fields name and description of the election
- She clicks on the "Save changes button" (the one that is next to the election description field)
- In "Contact" section, she changes the value of "contact" field
- She clicks on the "Save changes" button (the one that is in the "Contact" section)
"""
if election_title is None:
......@@ -401,6 +403,9 @@ def administrator_starts_creation_of_election(browser, manual_credential_managem
if election_description is None:
election_description = settings.ELECTION_DESCRIPTION
if initiator_contact is None:
initiator_contact = settings.INITIATOR_CONTACT
# She clicks on the "Prepare a new election" link
create_election_link_expected_content = "Prepare a new election"
links_css_selector = "#main a"
......@@ -424,7 +429,7 @@ def administrator_starts_creation_of_election(browser, manual_credential_managem
wait_a_bit()
# She changes values of fields name and description of the election
# In the "Name and description of the election" section, she changes values of fields name and description of the election
election_name_field_css_selector = "#main form input[name=__co_eliom_name]"
election_name_field_element = wait_for_element_exists(browser, election_name_field_css_selector, settings.EXPLICIT_WAIT_TIMEOUT)
election_name_field_value = election_title
......@@ -441,13 +446,29 @@ def administrator_starts_creation_of_election(browser, manual_credential_managem
wait_a_bit()
# She clicks on the "Save changes button" (the one that is next to the election description field)
save_changes_button_css_selector = "#main > div:nth-child(1) form input[type=submit]" # Warning: form:nth-child(1) selects another form
# She clicks on the "Save changes" button (the one that is next to the election description field)
save_changes_button_css_selector = "#main > div:nth-of-type(1) form input[type=submit]" # Warning: form:nth-child(1) selects another form
save_changes_button_element = browser.find_element_by_css_selector(save_changes_button_css_selector)
save_changes_button_element.click()
wait_a_bit()
# In "Contact" section, she changes the value of "contact" field
election_contact_field_css_selector = "#main form input[name=__co_eliom_contact]"
election_contact_field_element = browser.find_element_by_css_selector(election_contact_field_css_selector)
election_contact_field_value = initiator_contact
election_contact_field_element.clear()
election_contact_field_element.send_keys(election_contact_field_value)
wait_a_bit()
# She clicks on the "Save changes" button (the one that is in the "Contact" section)
contact_section_save_changes_button_css_selector = "#main > div:nth-of-type(3) form input[type=submit]" # Warning: form:nth-child(1) selects another form
contact_section_save_changes_button_element = browser.find_element_by_css_selector(contact_section_save_changes_button_css_selector)
contact_section_save_changes_button_element.click()
wait_a_bit()
def administrator_edits_election_questions(browser):
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment