From 3e858888ac6dececf40c88745cebe6737874e6e1 Mon Sep 17 00:00:00 2001 From: tecnovert Date: Tue, 16 Feb 2021 02:11:44 +0200 Subject: [PATCH] tests: Start selenium test. --- tests/basicswap/extended/test_http_ui.py | 52 ++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 tests/basicswap/extended/test_http_ui.py diff --git a/tests/basicswap/extended/test_http_ui.py b/tests/basicswap/extended/test_http_ui.py new file mode 100644 index 0000000..f37c2c2 --- /dev/null +++ b/tests/basicswap/extended/test_http_ui.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# https://chromedriver.chromium.org/downloads +# 7z x chromedriver_linux64.zip +# sudo mv chromedriver /opt/chromedriver88 + +# Run test_xmr_persistent.py + +import time +from urllib.parse import urljoin + +from selenium import webdriver +from selenium.webdriver.support.ui import Select + + +def run_test(): + base_url = 'http://localhost:12701' + driver = webdriver.Chrome('/opt/chromedriver88') + + driver.get(urljoin(base_url, 'newoffer')) + html = driver.page_source + print('html', html) + + select_coin_from = Select(driver.find_element_by_name('coin_from')) + select_coin_from.select_by_visible_text('Particl') + + select_coin_to = Select(driver.find_element_by_name('coin_to')) + select_coin_to.select_by_visible_text('Monero') + + from_value = driver.find_element_by_name('amt_from') + from_value.send_keys('1') + to_value = driver.find_element_by_name('amt_to') + to_value.send_keys('2') + + submit_button = driver.find_element_by_name('continue') + submit_button.click() + + submit_button = driver.find_element_by_name('check_offer') + submit_button.click() + + submit_button = driver.find_element_by_name('submit_offer') + submit_button.click() + + driver.get(urljoin(base_url)) + time.sleep(3) + + driver.quit() + + +if __name__ == '__main__': + run_test()