From d6abd906cb64ae68eed3348eba521bc44ebed7b2 Mon Sep 17 00:00:00 2001 From: Varac Date: Fri, 9 Jun 2017 09:40:55 +0200 Subject: [test] Add basic functional login test * Move todo list to https://0xacab.org/leap/bitmask-dev/issues/8929 * use bundled pysqlcipher - debian package has not been fixed yet. * reset bitmaskd for each scenario so they are isolated * run functional tests on CI * moved e2e tests before the bundle * add test_functional_graphical Make target * Install chromedriver in docker image * add screenshots as artifacts on failure * run chrome without sandbox for docker Tests were failing on CI with chrome sandbox: https://0xacab.org/leap/bitmask-dev/-/jobs/15196 Used this workaround: https://stackoverflow.com/questions/28364012/webdriver-exception-chrome-not-reachable/28949227#28949227 - Resolves: #8929 --- tests/functional/features/steps/login.py | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/functional/features/steps/login.py (limited to 'tests/functional/features/steps/login.py') diff --git a/tests/functional/features/steps/login.py b/tests/functional/features/steps/login.py new file mode 100644 index 0000000..4a5981a --- /dev/null +++ b/tests/functional/features/steps/login.py @@ -0,0 +1,45 @@ +from behave import given, when, then + +from common import ( + click_button, + fill_by_css_selector, + find_element_by_css_selector +) + + +@when(u'I login') +def login_user(context): + login_page(context) + enter_credentials(context) + click_button(context, 'Log In') + + +def login_page(context): + context.browser.get(context.login_url) + context.browser.refresh() + + +def enter_credentials(context): + fill_by_css_selector(context, 'textarea[id="loginUsername"]', + context.username) + fill_by_css_selector(context, 'input[id="loginPassword"]', + context.password) + + +@then(u'I should see the user panel') +def see_home_screen(context): + find_element_by_css_selector(context, '.main-panel') + + +@then(u'I logout') +@when(u'I logout') +def click_logout(context): + # TODO: Have identifiers for the "second" login screen + click_button(context, 'Log Out') + + +@then(u'I should see the second login page') +def see_second_login_page(context): + # TODO: Have unique identifiers for the second login page + # (that differentiates from user panel) + find_element_by_css_selector(context, '#loginUsername') -- cgit v1.2.3