diff options
Diffstat (limited to 'service/test/functional/features/environment.py')
-rw-r--r-- | service/test/functional/features/environment.py | 16 |
1 files changed, 12 insertions, 4 deletions
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 <http://www.gnu.org/licenses/>. 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')) |