Package: loadero-py-testui-commands
loadero-py-testui-commandsInstallationInstallation is as simple as adding this line to your requirements.txt
(or equivalent) file.loadero-py-testui-commandsAfter which you will be able to install all of the dependencies using pip.pipinstall-rrequirements.txtThe latest tag always will be the most up-to-date version when compared to the
commands used in the Loadero environment.UsageThese Py-TestUI custom commands were made to simplify local script development
for usage in the Loadero environment. By using these commands, you can write your
Loadero script locally and then upload it to Loadero. This also allows for more
rapid development because the script can be debugged and run locally.To use the commands in your tests, you need to download this dependency to your
project (as shown in above) and then only import the functions in your
script file. Keep in mind, that when migrating the script to Loadero, you do not
need to import the functions there as-well, that will be done automatically.This is how you can import the functions in your script file:fromcommands.receive_emailimportgen_email,receive_emailfromcommands.ignore_alertimportignore_alertfromcommands.set_fileimportset_filefromcommands.set_request_headerimportset_request_headerfromcommands.set_user_agentimportset_user_agentfromcommands.time_executionimporttime_executionfromcommands.update_networkimportupdate_networkfromcommands.wait_for_download_finishedimportwait_for_download_finishedAfter which they can be used in your script file as any other function.
Script example:deftest_on_loadero(driver:TestUIDriver):really_long_pause=300driver.navigate_to("https://duckduckgo.com/")deflocate_search_bar():e(driver,"css","#searchbox_input").wait_until_visible().send_keys("QA Processes")e(driver,"css","[aria-label='Search']").wait_until_visible().click()e(driver,"css","#r1-0 > div > h2").wait_until_visible()time.sleep(really_long_pause)# Example of timing execution without specifying a timeout.time_execution("locate_search_bar",locate_search_bar)Not all commands behave the same way as they do in the Loadero environment.
Some of them are modified to work in a local environment, such asupdate_networkandset_request_header.CommandsThe following table shows all available commands and whether there are any
changes to how they function in a local environment.Full descriptions for how each function behaves in Loadero and their usage can
be found inLoadero wikipage. To see the differences between local and Loadero environment, you can
compare the descriptions in the wiki to the differences mentioned in this README.CommandDifferencesgen_emailFull email or only first part can be provided, if only the first part is provided then@mailinator.comis appendedignore_alertNo differencesreceive_emailBy default an empty array will be returned, butemails.jsonfile can be saved in the working directory which will contain all of the emailsset_fileAny local file can be used, Loadero constant can be used if the same file name is usedset_request_headerNo request header will be setset_user_agentUser agent won't be changedtime_executionExecution time will be logged, but not savedupdate_networkNetwork settings will not be updatedwait_for_download_finishedFunction will finish instantly and not wait for download to be finishedTheemails.jsonfile should be located in the directory from which you will be
running the tests and should have the following structure:{"emails":[{"from":"email_from","to":"email_to","headers":{"header1":"header_value"},"subject":"email_subject","text/html":"html body","text/plain":"plain text body"}]}To simulate a more realistic environment, you can modify theemails.jsonfile
mid-run to add additional emails to the array. The file will be read every time
thereceive_emailcommand is called.