Mailinglist Archive: yast-commit (1914 mails)

< Previous Next >
[yast-commit] <web-client> master : starting webric while test:ui call; adapted login test
  • From: Josef Reidinger <jreidinger@xxxxxxx>
  • Date: Mon, 24 Aug 2009 15:37:54 +0200
  • Message-id: <E1Mlgpn-0006pb-UD@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit 07d47a1b2bc138dc2e625dc51289165c014d9c11
Author: Stefan Schubert <schubi@xxxxxxx>
Date: Wed Aug 19 18:16:50 2009 +0200

starting webric while test:ui call; adapted login test
---
webclient/lib/selenium/test_case.rb | 2 +-
webclient/lib/tasks/selenium.rake | 13 +++++++++++--
webclient/test/dummy-host/host.rb | 9 +++++++--
webclient/test/ui/login_test.rb | 16 +++++-----------
webclient/test/ui/src/login_test_credentials.xml | 2 +-
webclient/test/ui/src/login_test_guest_login.xml | 12 +-----------
.../test/ui/src/login_test_loggedin_hosts.xml | 14 ++------------
7 files changed, 28 insertions(+), 40 deletions(-)

diff --git a/webclient/lib/selenium/test_case.rb
b/webclient/lib/selenium/test_case.rb
index 9d5c92d..192a88e 100644
--- a/webclient/lib/selenium/test_case.rb
+++ b/webclient/lib/selenium/test_case.rb
@@ -32,7 +32,7 @@ module Selenium

"/usr/lib/firefox/firefox"

@selenium = Selenium::SeleniumDriver.new("localhost", 4444,
"*firefox #{firefox}",
- "http://localhost:3000";, 10000);
+ "http://localhost:4568";, 10000);
@selenium.start
end
end
diff --git a/webclient/lib/tasks/selenium.rake
b/webclient/lib/tasks/selenium.rake
index 0cb4c62..37cc58d 100644
--- a/webclient/lib/tasks/selenium.rake
+++ b/webclient/lib/tasks/selenium.rake
@@ -31,10 +31,19 @@ namespace :sinatra do
system cmd
end
task :stop do
- system "ps a|grep dummy-host/host.rb|cut -c -6 | xargs kill -9"
+ system "ps a|grep dummy-host/host.rb|cut -c -6 | xargs kill -SIGTERM"
end
end

+namespace :webric do
+ task :start do
+ cmd = "#{File.join(File.dirname(__FILE__),"../..", "script/server")} -p
4568 &"
+ system cmd
+ end
+ task :stop do
+ system "ps a|grep server|grep 4568|cut -c -6 | xargs kill -SIGTERM"
+ end
+end

namespace :test do
# define test:ui:check task
@@ -61,7 +70,7 @@ namespace :test do
exit 1
end
else
- task :ui => [:"sinatra:start", :"selenium:rc:start",
:"test:ui:check", :"selenium:rc:stop", :"sinatra:stop"]
+ task :ui => [:"webric:start",:"sinatra:start", :"selenium:rc:start",
:"test:ui:check", :"selenium:rc:stop", :"sinatra:stop", :"webric:stop"]
end
end

diff --git a/webclient/test/dummy-host/host.rb
b/webclient/test/dummy-host/host.rb
index 1729ad0..baf078e 100644
--- a/webclient/test/dummy-host/host.rb
+++ b/webclient/test/dummy-host/host.rb
@@ -4,9 +4,14 @@
require 'sinatra'

post '/login.xml' do
+ req = Hash.from_xml request.env["rack.input"].read
login = Hash.new
- login["login"] = "granted"
- login["auth_token"] = {"expires"=>"Tue Aug 18 07:08:22 UTC 2009",
"value"=>"3e3910533595dd5657c54c32f27fc6068df96873"}
+ if req["hash"]["login"] == "webyast_guest"
+ login["login"] = "revoked"
+ else
+ login["login"] = "granted"
+ login["auth_token"] = {"expires"=>"Tue Aug 18 07:08:22 UTC 2009",
"value"=>"3e3910533595dd5657c54c32f27fc6068df96873"}
+ end
login.to_xml
end

diff --git a/webclient/test/ui/login_test.rb b/webclient/test/ui/login_test.rb
index bebb11f..4e5442a 100644
--- a/webclient/test/ui/login_test.rb
+++ b/webclient/test/ui/login_test.rb
@@ -1,5 +1,5 @@
# Generated by ruby-webyast-0.1 Selenium formatter
-# Date: Thu Jul 23 2009 14:05:37 GMT+0200 (CEST)
+# Date: Wed Aug 19 2009 18:12:53 GMT+0200 (CEST)

require "selenium/test_case"

@@ -7,7 +7,7 @@ class Login_test < Selenium::TestCase

def test_login_test_credentials
@selenium.open "/hosts"
- @selenium.click "link=localhost"
+ @selenium.click "link=dummy-host"
@selenium.wait_for_page_to_load "30000"
assert @selenium.is_element_present("login")
assert @selenium.is_element_present("password")
@@ -22,22 +22,19 @@ class Login_test < Selenium::TestCase

def test_login_test_guest_login
@selenium.open "/hosts?error=nohostid"
- @selenium.click "link=localhost"
+ @selenium.click "link=dummy-host"
@selenium.wait_for_page_to_load "30000"
@selenium.type "login", "webyast_guest"
@selenium.type "password", "test"
@selenium.click "login_button"
@selenium.wait_for_page_to_load "30000"
assert !@xxxxxxxxxxxxxxxxxxxxxxxxxxx("Login incorrect")
- @selenium.click "link=Logout"
- @selenium.wait_for_page_to_load "30000"
- assert @selenium.is_text_present("You have been logged out")
end


def test_login_test_loggedin_hosts
@selenium.open "/hosts?error=nohostid"
- @selenium.click "link=localhost"
+ @selenium.click "link=dummy-host"
@selenium.wait_for_page_to_load "30000"
@selenium.type "login", "webyast_guest"
@selenium.type "password", "test"
@@ -46,12 +43,9 @@ class Login_test < Selenium::TestCase
assert !@xxxxxxxxxxxxxxxxxxxxxxxxxxx("Login incorrect")
@selenium.open "/hosts"
@selenium.wait_for_page_to_load "30000"
- @selenium.click "link=localhost"
+ @selenium.click "link=dummy-host"
@selenium.wait_for_page_to_load "30000"
assert !@xxxxxxxxxxxxxxxxxxxxxxxx("This is embarrasing....")
- @selenium.click "link=Logout"
- @selenium.wait_for_page_to_load "30000"
- assert @selenium.is_text_present("You have been logged out")
end


diff --git a/webclient/test/ui/src/login_test_credentials.xml
b/webclient/test/ui/src/login_test_credentials.xml
index 289a520..96103d1 100644
--- a/webclient/test/ui/src/login_test_credentials.xml
+++ b/webclient/test/ui/src/login_test_credentials.xml
@@ -18,7 +18,7 @@
</tr>
<tr>
<td>clickAndWait</td>
- <td>link=localhost</td>
+ <td>link=dummy-host</td>
<td></td>
</tr>
<tr>
diff --git a/webclient/test/ui/src/login_test_guest_login.xml
b/webclient/test/ui/src/login_test_guest_login.xml
index ba18277..78ed451 100644
--- a/webclient/test/ui/src/login_test_guest_login.xml
+++ b/webclient/test/ui/src/login_test_guest_login.xml
@@ -18,7 +18,7 @@
</tr>
<tr>
<td>clickAndWait</td>
- <td>link=localhost</td>
+ <td>link=dummy-host</td>
<td></td>
</tr>
<tr>
@@ -41,16 +41,6 @@
<td>Login incorrect</td>
<td></td>
</tr>
-<tr>
- <td>clickAndWait</td>
- <td>link=Logout</td>
- <td></td>
-</tr>
-<tr>
- <td>assertTextPresent</td>
- <td>You have been logged out</td>
- <td></td>
-</tr>

</tbody></table>
</body>
diff --git a/webclient/test/ui/src/login_test_loggedin_hosts.xml
b/webclient/test/ui/src/login_test_loggedin_hosts.xml
index b691d9f..4ae8538 100644
--- a/webclient/test/ui/src/login_test_loggedin_hosts.xml
+++ b/webclient/test/ui/src/login_test_loggedin_hosts.xml
@@ -18,7 +18,7 @@
</tr>
<tr>
<td>clickAndWait</td>
- <td>link=localhost</td>
+ <td>link=dummy-host</td>
<td></td>
</tr>
<tr>
@@ -48,7 +48,7 @@
</tr>
<tr>
<td>clickAndWait</td>
- <td>link=localhost</td>
+ <td>link=dummy-host</td>
<td></td>
</tr>
<tr>
@@ -56,16 +56,6 @@
<td>This is embarrasing....</td>
<td></td>
</tr>
-<tr>
- <td>clickAndWait</td>
- <td>link=Logout</td>
- <td></td>
-</tr>
-<tr>
- <td>assertTextPresent</td>
- <td>You have been logged out</td>
- <td></td>
-</tr>

</tbody></table>
</body>
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages