summaryrefslogtreecommitdiff
path: root/service/test/functional/features
diff options
context:
space:
mode:
authorTulio Casagrande <tcasagra@thoughtworks.com>2016-11-30 19:11:57 -0200
committerTulio Casagrande <tcasagra@thoughtworks.com>2016-11-30 19:25:23 -0200
commit8372b0127343df96cbe1ca33477ea0f197a873be (patch)
treeb052911125e6cd3036a650c97a510152a3147797 /service/test/functional/features
parenta8a7362054f4b49ea1fbc00fe7b556e6e6ea4590 (diff)
Add username to behave context
See: https://github.com/pixelated/project-issues/issues/381
Diffstat (limited to 'service/test/functional/features')
-rw-r--r--service/test/functional/features/environment.py3
-rw-r--r--service/test/functional/features/smoke.feature3
-rw-r--r--service/test/functional/features/steps/login.py13
-rw-r--r--service/test/functional/features/steps/signup.py3
4 files changed, 11 insertions, 11 deletions
diff --git a/service/test/functional/features/environment.py b/service/test/functional/features/environment.py
index efbf3412..b51323fa 100644
--- a/service/test/functional/features/environment.py
+++ b/service/test/functional/features/environment.py
@@ -17,6 +17,7 @@ import os
import re
import time
from urlparse import urlparse
+import uuid
from crochet import setup, wait_for
from leap.common.events.server import ensure_server
@@ -52,10 +53,12 @@ def before_all(context):
hostname = urlparse(context.host).hostname
context.signup_url = 'https://{}/signup'.format(hostname)
context.login_url = 'https://mail.{}/login'.format(hostname)
+ context.username = 'testuser_{}'.format(uuid.uuid4())
if 'localhost' in context.host:
_mock_user_agent(context)
context.login_url = context.multi_user_url + '/login'
+ context.username = 'username'
def _mock_user_agent(context):
diff --git a/service/test/functional/features/smoke.feature b/service/test/functional/features/smoke.feature
index 3a9378e4..1839539e 100644
--- a/service/test/functional/features/smoke.feature
+++ b/service/test/functional/features/smoke.feature
@@ -28,8 +28,7 @@ Feature: sign up, login and logout
Scenario: Existing user logs into his account
Given a user is accessing the login page
- #And I have a mail for username in my inbox
- And I enter username and password as credentials
+ When I enter username and password as credentials
And I click on the login button
Then I should see the fancy interstitial
Then I have mails
diff --git a/service/test/functional/features/steps/login.py b/service/test/functional/features/steps/login.py
index a8db6f49..e773c0b1 100644
--- a/service/test/functional/features/steps/login.py
+++ b/service/test/functional/features/steps/login.py
@@ -15,15 +15,14 @@
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
import time
-from behave import when, then
-from selenium.webdriver.common.by import By
+from behave import given, when, then
from common import (
fill_by_css_selector,
- find_element_by_css_selector,
- wait_until_element_is_visible_by_locator)
+ find_element_by_css_selector)
+@given(u'a user is accessing the login page')
@when(u'I open the login page')
def login_page(context):
context.browser.get(context.login_url)
@@ -31,13 +30,13 @@ def login_page(context):
@when(u'I enter {username} and {password} as credentials')
def enter_credentials(context, username, password):
- fill_by_css_selector(context, 'input#email', username)
+ fill_by_css_selector(context, 'input#email', context.username)
fill_by_css_selector(context, 'input#password', password)
@when(u'I click on the login button')
def click_login(context):
- login_button = wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, 'input[name="login"]'))
+ login_button = find_element_by_css_selector(context, 'input[name="login"]')
login_button.click()
@@ -53,7 +52,7 @@ def _wait_for_interstitial_to_reload():
@when(u'I logout')
def click_logout(context):
- logout_button = wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, 'ul#logout'))
+ logout_button = find_element_by_css_selector(context, 'ul#logout')
logout_button.click()
diff --git a/service/test/functional/features/steps/signup.py b/service/test/functional/features/steps/signup.py
index 1558004b..43480666 100644
--- a/service/test/functional/features/steps/signup.py
+++ b/service/test/functional/features/steps/signup.py
@@ -14,7 +14,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
-import uuid
from behave import given, then, when
from common import (
@@ -30,7 +29,7 @@ def step_impl(context):
@when(u'I enter username, password and password confirmation') # noqa
def step_impl(context):
- fill_by_css_selector(context, '#srp_username', 'testuser_{}'.format(uuid.uuid4()))
+ fill_by_css_selector(context, '#srp_username', context.username)
fill_by_css_selector(context, '#srp_password', 'password')
fill_by_css_selector(context, '#srp_password_confirmation', 'password')