summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2014-02-26 14:13:43 +0100
committergebele <gebele@in-silico.ch>2014-02-26 14:13:43 +0100
commitfcd73c8aabf5c08d69ec91c66f8cf80dda56317b (patch)
treefe4243f36087ecfdd302e3c07e38931362476adb
parent982e74c0f1d73203bbd970d3822abe6cb3ce64c0 (diff)
initial aop website test
-rw-r--r--test/aopweb.rb50
1 files changed, 50 insertions, 0 deletions
diff --git a/test/aopweb.rb b/test/aopweb.rb
new file mode 100644
index 0000000..58ae0dc
--- /dev/null
+++ b/test/aopweb.rb
@@ -0,0 +1,50 @@
+require_relative "setup.rb"
+#require 'capybara/dsl'
+require 'capybara'
+require 'capybara-webkit'
+
+Capybara.register_driver :webkit do |app|
+ Capybara::Webkit::Driver.new(app).tap{|d| d.browser.ignore_ssl_errors}
+end
+Capybara.default_driver = :webkit
+Capybara.default_wait_time = 20
+Capybara.javascript_driver = :webkit
+Capybara.run_server = false
+Capybara.app_host = 'http://aop.in-silico.ch'
+
+class LazarWebTest < MiniTest::Test
+ i_suck_and_my_tests_are_order_dependent!
+
+ include Capybara::DSL
+
+ def test_00_xsetup
+ `Xvfb :1 -screen 0 1024x768x16 2>/dev/null &`
+ sleep 2
+ end
+
+ def test_01_visit
+ visit('/')
+ assert page.has_content?('PubChem read across')
+ assert page.has_content?('This is an experimental version.')
+ end
+
+ def test_02_inexisting
+ visit('/')
+ page.fill_in 'name', :with => "blahblah"
+ find(:xpath, '/html/body/form/fieldset/input[2]').click
+ assert page.has_content?('Could not find a compound with name "blahblah"')
+ end
+
+ def test_03_existing
+ visit('/')
+ page.fill_in 'name', :with => "doxorubicin"
+ find(:xpath, '/html/body/form/fieldset/input[2]').click
+ sleep 2
+ assert page.has_content?('Similar compounds')
+ end
+
+ def test_99_kill
+ `pidof Xvfb|xargs kill`
+ end
+
+end