summaryrefslogtreecommitdiff
path: root/service/test/functional/features/steps/mail_list.py
diff options
context:
space:
mode:
authorDuda Dornelles <ddornell@thoughtworks.com>2014-10-09 12:20:18 +0200
committerDuda Dornelles <ddornell@thoughtworks.com>2014-10-09 12:25:29 +0200
commitf28906c1c417800f5823dc937a7671a04d14193c (patch)
tree6704c2ae664e4b6b481427f1f5770a1f15ba0ba9 /service/test/functional/features/steps/mail_list.py
parent0bad14f4b0e6dd5128660d94a436463cbe7dc720 (diff)
moving fake-service features to service, getting rid of setup.py test requires and getting them into test_requirements.txt
Diffstat (limited to 'service/test/functional/features/steps/mail_list.py')
-rw-r--r--service/test/functional/features/steps/mail_list.py72
1 files changed, 72 insertions, 0 deletions
diff --git a/service/test/functional/features/steps/mail_list.py b/service/test/functional/features/steps/mail_list.py
new file mode 100644
index 00000000..2d57099b
--- /dev/null
+++ b/service/test/functional/features/steps/mail_list.py
@@ -0,0 +1,72 @@
+#
+# Copyright (c) 2014 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# 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 re
+from behave import *
+from common import *
+
+
+def find_current_mail(context):
+ return find_element_by_xpath(context, '//*[@id="mail-list"]/li[@id="mail-%s"]//a' % context.current_mail_id)
+
+
+def check_current_mail_is_visible(context):
+ find_current_mail(context)
+
+
+def open_current_mail(context):
+ e = find_current_mail(context)
+ e.click()
+
+
+@then('I see that mail under the \'{tag}\' tag')
+def impl(context, tag):
+ context.execute_steps("when I select the tag '%s'" % tag)
+ check_current_mail_is_visible(context)
+
+
+@when('I open that mail')
+def impl(context):
+ open_current_mail(context)
+
+
+@when('I open the first mail in the mail list')
+def impl(context):
+ elements = context.browser.find_elements_by_xpath('//*[@id="mail-list"]//a')
+ context.current_mail_id = elements[0].get_attribute('href').split('/')[-1]
+ elements[0].click()
+
+
+@when('I open the first mail in the \'{tag}\'')
+def impl(context, tag):
+ context.browser.execute_script('window.scrollBy(0, -200)')
+ context.execute_steps(u"When I select the tag '%s'" % tag)
+ context.execute_steps(u'When I open the first mail in the mail list')
+
+
+@then('I open the mail I previously tagged')
+def impl(context):
+ open_current_mail(context)
+
+
+@then('I see the mail I sent')
+def impl(context):
+ src = context.browser.page_source
+ assert_that(src, contains_string(context.reply_subject))
+
+
+@then('the deleted mail is there')
+def impl(context):
+ check_current_mail_is_visible(context)