diff --git a/.gitignore b/.gitignore index 18472dc..893f689 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ geckodriver.log *.lock .vscode *.pyc -*__pycache__ \ No newline at end of file +*__pycache__ +C:\selenum\ChromeProfileh \ No newline at end of file diff --git a/Pipfile b/Pipfile index 950b6f3..19c0094 100644 --- a/Pipfile +++ b/Pipfile @@ -8,6 +8,7 @@ selenium = "*" requests = "*" rich = "*" "pdfminer.six" = "*" +webdrivermanager = "*" [dev-packages] pylint = "*" diff --git a/README.md b/README.md new file mode 100644 index 0000000..fbe9102 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# civicrm-update-tester + +## install + +Requires pipenv, venv, pip, and python 3. + +``` +python3 -m venv .venv +source .venv/bin/activate +pipenv install +webdrivermanager chrome # installs chrome driver +``` + +## running + +### args + +``` +- -u --user : username to login with +- -p --pass : password of account +- -D --dev: doesn't work anymore, both URLS point to staging server +- -s --show-browser: runs in non-headless mode to show whats happening +``` + +```sh +$ python3 main.py -u roxie -p "hunter2" -s +``` +## what is the layout of this + +the civicrm_tester folder has files which contain classes. One for each test. The tests inherit the BaseTester class which has basic commands (login, logout, creating the browser, logging helpers, etc.) and access to the selenium browser. This will hopefully allow for the choosing of what tests to run. Atm, main.py just runs all three current tests synchronously. diff --git a/civicrm_tester/activities_tab.py b/civicrm_tester/activities_tab.py index 5d06776..4ef4357 100644 --- a/civicrm_tester/activities_tab.py +++ b/civicrm_tester/activities_tab.py @@ -59,6 +59,7 @@ class ActivitiesTab(BaseTester): Using MP's as MP's are public knowledge and often have activities within the crm system names provided in comments here for debugging purposes """ + # There where originally MP's but this seems to have changes to just random people. Still works fine but it is weird cid_da = "42219" # Debbie Abrahams cid_kh = "82163" # Kate Hollern cid_na = "42269" # Nigel Addams diff --git a/civicrm_tester/base.py b/civicrm_tester/base.py index ddd9df0..f27c3ac 100644 --- a/civicrm_tester/base.py +++ b/civicrm_tester/base.py @@ -35,13 +35,13 @@ class BaseTester: self.user = user self.passwd = passwd if dev: - self.base_url = "https://crm-dev.caat.org.uk" + self.base_url = "https://crm.staging.caat.org.uk" else: - self.base_url = "https://crm.caat.org.uk" + self.base_url = "https://crm.staging.caat.org.uk" - firefox_options = webdriver.FirefoxOptions() + firefox_options = webdriver.ChromeOptions() firefox_options.headless = not show_browser - self.browser = webdriver.Firefox(options=firefox_options) + self.browser = webdriver.Chrome(options=firefox_options) self.wait = WebDriverWait(self.browser, 20) def debug(self, msg: str): diff --git a/civicrm_tester/contact_export.py b/civicrm_tester/contact_export.py index c8f3773..94c814c 100644 --- a/civicrm_tester/contact_export.py +++ b/civicrm_tester/contact_export.py @@ -14,7 +14,9 @@ class ContactExport(SearchExportTester): self.desc( "Testing if exporting contacts from a search returns a CSV file with all expected contacts." ) - self.contact_exportoption_id = "select2-result-label-15" + # FIXME: THIS FUCKING CHANGES!!!!!! + # If you are having issues with the tests, go back and try and find the id for the item in the drop down. its all stupid js so we have to hack it like this and press it instead of post request + self.contact_exportoption_id = "select2-result-label-13" def download_csv(self): # Data of the request that is specific for this export and not generic like qr_key @@ -78,5 +80,5 @@ class ContactExport(SearchExportTester): def test_hardcoded_search_terms(self): """Loops over the test with three hardcoded search terms""" - search_terms = ("John", "e", "Smith") + search_terms = ("John", "Jane", "Smith") self._test_all(search_terms) diff --git a/civicrm_tester/steeringcommittee_print_labels.py b/civicrm_tester/steeringcommittee_print_labels.py index 469eb0c..73421ba 100644 --- a/civicrm_tester/steeringcommittee_print_labels.py +++ b/civicrm_tester/steeringcommittee_print_labels.py @@ -16,7 +16,10 @@ class SteeringCommitteePrintLabels(SearchExportTester): ) self.group_dropdown = "s2id_autogen2" self.search_button = "_qf_Basic_refresh" - self.mail_label_option = "select2-result-label-19" + # FIXME: THIS FUCKING CHANGES!!!!!! + # If you are having issues with the tests, go back and try and find the id for the item in the drop down. its all stupid js so we have to hack it like this and press it instead of post request + # Even in the post requests, actions are given IDs instead. Which change apparently!!!!! WTFFF!!! + self.mail_label_option = "select2-result-label-17" # Using this to count amount of people in the exported pdf # This will fail if someone is added that doesn't have a UK adddress self.pdf_search_string = "UNITED KINGDOM" diff --git a/main.py b/main.py index 7befc09..c010097 100644 --- a/main.py +++ b/main.py @@ -21,7 +21,7 @@ if __name__ == "__main__": help="Test dev site instead of production" ) parser.add_argument( - "--show_browser", + "--show-browser", "-s", dest="show_browser", action="store_true",