------------------------ How to Contribute Tests ------------------------ Tests can be recorded using Selenium IDE within Firefox or by generating the HTML either programmatically or by hand. Theses tests are then to be added to the TestSuite.html under tests/src. The current workflow then requires that you export your test case as a "Python 2 webdriver" script and save it in the tests/ folder. In the future this conversion will be done by the automation framework itself so only the HTML source file will need to be committed. ------------------------ Things to Note ------------------------ Don't set your base url to have a forward slash at the end. Selenium adds the forward slash for you by default. The Selenium IDE doesn't currently export the selection of dropdown items, instead it throws the following error: # ERROR: Caught exception [ReferenceError: selectLocator is not defined] Here is an example of one wayto add a dropdown selection to a script: select = Select(driver.find_element_by_id("license")) select.select_by_visible_text("CC0 1.0") ------------------------ Writing Upload Tests ------------------------ If a test makes use of local files, such as those found under the resources directory, you need to edit the Selenium HTML file and replace the your specific base directory path with the parameter WORKING_DIRECTORY. Example: /home/lotusecho/gmg/mediagoblin-selenium/resources/gavroche.png Becomes WORKING_DIRECTORY/resources/gavroche.png When runtests.sh is run it will process that paramter and replace it with your current working directory. ------------------------ When Recording / Code Reuse ------------------------ At /tests/util we have provided a small set of often-used functions that can be added to your test cases to reduce the amount of repeated work. When you record your tests you don't need to record the login/logout steps as a part of test. Instead, add them to the exported python file. ------------------------ util.login EXAMPLE ------------------------ Add this -> from util import login, logout Right before -> from selenium import webdriver ... Next, find your test function, like the following: def test_upload_j_p_e_g(self): driver = self.driver #Insert your objects here for login data = {"username" : "testuser", "password" : "TestPassworD!"} tLogin = login.LogIn() tLogin.log_in(self, data) #End of new code Each reusable object takes data from your current test to proceed.