From aab5c4e3f721431591f3709cecb2e2e58ab9774e Mon Sep 17 00:00:00 2001 From: Tiago Ferraz Date: Mon, 23 Mar 2015 10:27:39 -0300 Subject: New test that use checkboxes. Removal of hamcrest lib, code refactoring. A new test was created to use Pixelated checkboxes and the buttons at the top. Also the lib hamcrest was removed and code refactored to be more pythonic. A new method after_step will log information in case of step failures. --- service/test/functional/features/environment.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'service/test/functional/features/environment.py') diff --git a/service/test/functional/features/environment.py b/service/test/functional/features/environment.py index 5969120a..6ef48376 100644 --- a/service/test/functional/features/environment.py +++ b/service/test/functional/features/environment.py @@ -14,9 +14,10 @@ # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . import logging +import uuid from test.support.dispatcher.proxy import Proxy -from test.support.integration import AppTestClient +from test.support.integration import AppTestClient, MailBuilder from selenium import webdriver from pixelated.resources.features_resource import FeaturesResource @@ -41,15 +42,22 @@ def before_feature(context, feature): # context.browser = webdriver.Firefox() context.browser = webdriver.PhantomJS() context.browser.set_window_size(1280, 1024) - context.browser.implicitly_wait(5) + context.browser.implicitly_wait(10) context.browser.set_page_load_timeout(60) # wait for data context.browser.get('http://localhost:8889/') +def after_step(context, step): + if step.status == 'failed': + id = str(uuid.uuid4()) + context.browser.save_screenshot('failed '+str(step.name)+'_'+id+".png") + save_source(context, 'failed '+str(step.name)+'_'+id+".html") + + def after_feature(context, feature): context.browser.quit() -def save_source(context): - with open('/tmp/source.html', 'w') as out: +def save_source(context, filename='/tmp/source.html'): + with open(filename, 'w') as out: out.write(context.browser.page_source.encode('utf8')) -- cgit v1.2.3