summaryrefslogtreecommitdiff
path: root/service/test/functional/features/environment.py
diff options
context:
space:
mode:
authorTiago Ferraz <tiago.ferraz@gmail.com>2015-03-23 10:27:39 -0300
committerTiago Ferraz <tiago.ferraz@gmail.com>2015-03-26 12:12:40 -0300
commitaab5c4e3f721431591f3709cecb2e2e58ab9774e (patch)
treec9d46bb5378bf77c8b20dcb1adc798e0ce7b5b2c /service/test/functional/features/environment.py
parent68a0f94cd15b661caa2b4ea87eef55972c8bff25 (diff)
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.
Diffstat (limited to 'service/test/functional/features/environment.py')
-rw-r--r--service/test/functional/features/environment.py16
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'))