From 4fd50e650bbfa474f77daf63a44e08b6cb039679 Mon Sep 17 00:00:00 2001 From: Denis Costa Date: Fri, 25 Nov 2016 13:55:02 -0200 Subject: Improves imports See: https://github.com/pixelated/project-issues/issues/380 --- service/test/functional/features/environment.py | 16 ++++++++-------- .../test/functional/features/steps/attachments.py | 21 +++++++++++++-------- service/test/functional/features/steps/common.py | 9 +++++++-- service/test/functional/features/steps/compose.py | 7 ++++++- service/test/functional/features/steps/mail_list.py | 16 ++++++++++++++-- service/test/functional/features/steps/mail_view.py | 12 +++++++++++- service/test/functional/features/steps/search.py | 6 ++++-- service/test/functional/features/steps/tag_list.py | 10 +++++++++- 8 files changed, 72 insertions(+), 25 deletions(-) diff --git a/service/test/functional/features/environment.py b/service/test/functional/features/environment.py index 77efc499..00480e68 100644 --- a/service/test/functional/features/environment.py +++ b/service/test/functional/features/environment.py @@ -13,23 +13,23 @@ # # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . -import uuid import os +import uuid -from selenium import webdriver from crochet import setup, wait_for - +from leap.common.events.server import ensure_server +from selenium import webdriver from twisted.internet import defer from twisted.logger import globalLogBeginner, textFileLogObserver, Logger -from test.support.integration import AppTestClient -from steps.common import * - -from leap.common.events.server import ensure_server - from pixelated.application import UserAgentMode from pixelated.config.site import PixelatedSite from pixelated.resources.features_resource import FeaturesResource +from test.support.integration import AppTestClient +from steps.common import ( + DEFAULT_IMPLICIT_WAIT_TIMEOUT_IN_S, + HOMEPAGE_URL, + MULTI_USER_PORT) setup() diff --git a/service/test/functional/features/steps/attachments.py b/service/test/functional/features/steps/attachments.py index 28d88343..90812d2c 100644 --- a/service/test/functional/features/steps/attachments.py +++ b/service/test/functional/features/steps/attachments.py @@ -13,16 +13,21 @@ # # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . -from email.mime.application import MIMEApplication -from time import sleep -from leap.bitmask.mail.mail import Message -from common import * -from test.support.integration import MailBuilder -from behave import given -from crochet import wait_for -from uuid import uuid4 from email.MIMEMultipart import MIMEMultipart +from email.mime.application import MIMEApplication from email.mime.text import MIMEText +from uuid import uuid4 + +from behave import given, then, when +from crochet import wait_for +from selenium.webdriver.common.by import By + +from common import ( + fill_by_css_selector, + find_element_by_css_selector, + find_elements_by_css_selector, + page_has_css, + wait_until_element_is_visible_by_locator) @given(u'I have a mail with an attachment in my inbox') diff --git a/service/test/functional/features/steps/common.py b/service/test/functional/features/steps/common.py index a7800ee8..4ffe40ce 100644 --- a/service/test/functional/features/steps/common.py +++ b/service/test/functional/features/steps/common.py @@ -13,11 +13,16 @@ # # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . + +import time + +from selenium.common.exceptions import ( + StaleElementReferenceException, + TimeoutException) from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.wait import WebDriverWait -from selenium.common.exceptions import TimeoutException, StaleElementReferenceException -import time + from test.support.integration import MailBuilder LOADING = 'loading' diff --git a/service/test/functional/features/steps/compose.py b/service/test/functional/features/steps/compose.py index 67b1bd51..c72b25e2 100644 --- a/service/test/functional/features/steps/compose.py +++ b/service/test/functional/features/steps/compose.py @@ -16,7 +16,12 @@ from time import sleep from behave import when -from common import * +from selenium.webdriver.common.by import By + +from common import ( + fill_by_css_selector, + wait_until_element_is_visible_by_locator, + find_element_by_css_selector) @when('I compose a message with') diff --git a/service/test/functional/features/steps/mail_list.py b/service/test/functional/features/steps/mail_list.py index 8ac9cb6b..7c880e8f 100644 --- a/service/test/functional/features/steps/mail_list.py +++ b/service/test/functional/features/steps/mail_list.py @@ -13,8 +13,20 @@ # # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . -from common import * -from selenium.common.exceptions import NoSuchElementException + +from behave import when, then, given +from selenium.common.exceptions import TimeoutException +from selenium.webdriver.common.by import By + +from common import ( + ImplicitWait, + execute_ignoring_staleness, + find_element_by_id, + mail_list_with_subject_exists, + wait_for_condition, + wait_for_loading_to_finish, + wait_until_element_is_visible_by_locator, + wait_until_elements_are_visible_by_locator) def find_current_mail(context): diff --git a/service/test/functional/features/steps/mail_view.py b/service/test/functional/features/steps/mail_view.py index 2db6dfc5..88ee5c5a 100644 --- a/service/test/functional/features/steps/mail_view.py +++ b/service/test/functional/features/steps/mail_view.py @@ -13,8 +13,18 @@ # # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . + +from behave import then, when from selenium.webdriver.common.keys import Keys -from common import * +from selenium.webdriver.common.by import By + +from common import ( + click_button, + find_element_by_css_selector, + find_elements_by_css_selector, + reply_subject, + wait_until_button_is_visible, + wait_until_element_is_visible_by_locator) @then('I see that the subject reads \'{subject}\'') diff --git a/service/test/functional/features/steps/search.py b/service/test/functional/features/steps/search.py index 879e834d..5a6d2d1c 100644 --- a/service/test/functional/features/steps/search.py +++ b/service/test/functional/features/steps/search.py @@ -13,10 +13,12 @@ # # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . -from selenium.webdriver import ActionChains +from behave import when, then +from selenium.webdriver import ActionChains from selenium.webdriver.common.keys import Keys -from common import * + +from common import find_element_by_css_selector, find_elements_by_css_selector @when('I search for a mail with the words "{search_term}"') diff --git a/service/test/functional/features/steps/tag_list.py b/service/test/functional/features/steps/tag_list.py index 8550a886..b9adea0a 100644 --- a/service/test/functional/features/steps/tag_list.py +++ b/service/test/functional/features/steps/tag_list.py @@ -13,7 +13,15 @@ # # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . -from common import * +from behave import when +from selenium.common.exceptions import TimeoutException +from selenium.webdriver.common.by import By + +from common import ( + find_element_by_class_name, + find_element_by_id, + wait_for_user_alert_to_disapear, + wait_until_element_is_visible_by_locator) def click_first_element_with_class(context, classname): -- cgit v1.2.3