0001-misc-remove-obsolete-robot-framework-tests-41136.patch
tests/robot/BaseSettings.txt | ||
---|---|---|
1 |
*** Settings *** |
|
2 |
Library Selenium2 Library |
|
3 |
Library Wcs Robot Framework Library |
|
4 |
Suite Setup Start WCS Server True |
|
5 |
Test Teardown Close All Browsers |
|
6 | ||
7 |
*** Keywords *** |
|
8 |
Given a logged in admin |
|
9 |
Click Link Login |
|
10 |
Input Text username admin |
|
11 |
Input Text password admin |
|
12 |
Click Button Log in |
|
13 | ||
14 | ||
15 |
*** Testcases *** |
|
16 |
Configure Language |
|
17 |
Open Browser http://localhost:10003/admin ff |
|
18 |
Click Link Settings |
|
19 |
Click Link Language |
|
20 |
Select From List qx=Language English |
|
21 |
Submit Form |
|
22 | ||
23 |
Configure Debug |
|
24 |
Open Browser http://localhost:10003/admin ff |
|
25 |
Click Link Settings |
|
26 |
Click Link Debug Options |
|
27 |
Select From List qx=Display Exceptions Display as Text |
|
28 |
Submit Form |
|
29 | ||
30 |
Configure Authentication |
|
31 |
Open Browser http://localhost:10003/admin ff |
|
32 |
Click Link Settings |
|
33 |
Click Link Identification |
|
34 |
Select Checkbox qx=Simple local username / password |
|
35 |
Submit Form |
|
36 |
Click Link Users |
|
37 |
Click Link New User |
|
38 |
Input Text qx=Name Admin |
|
39 |
Input Text qx=Email admin@localhost |
|
40 |
Select Checkbox qx=Administrator Account |
|
41 |
Input Text qx=Username admin |
|
42 |
Input Text qx=Password admin |
|
43 |
Submit Form |
|
44 | ||
45 |
Configure Roles |
|
46 |
Open Browser http://localhost:10003/admin ff |
|
47 |
Given a logged in admin |
|
48 |
Click Link Roles |
|
49 |
Click Link New Role |
|
50 |
Input Text qx=Role Name First Role |
|
51 |
Click Button Submit |
|
52 |
tests/robot/WcsRobotFrameworkLibrary.py | ||
---|---|---|
1 |
# w.c.s. - web application for online forms |
|
2 |
# Copyright (C) 2005-2013 Entr'ouvert |
|
3 |
# |
|
4 |
# This program is free software; you can redistribute it and/or modify |
|
5 |
# it under the terms of the GNU General Public License as published by |
|
6 |
# the Free Software Foundation; either version 2 of the License, or |
|
7 |
# (at your option) any later version. |
|
8 |
# |
|
9 |
# This program is distributed in the hope that it will be useful, |
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
# GNU General Public License for more details. |
|
13 |
# |
|
14 |
# You should have received a copy of the GNU General Public License |
|
15 |
# along with this program; if not, see <http://www.gnu.org/licenses/>. |
|
16 | ||
17 |
import os |
|
18 |
import time |
|
19 |
import urllib2 |
|
20 |
import subprocess |
|
21 |
import shutil |
|
22 |
import signal |
|
23 |
import sys |
|
24 | ||
25 |
WCS_SRCDIR = '../../' |
|
26 |
WCSCTL = '../../wcsctl.py' |
|
27 |
WCS_DATA_DIR = os.path.abspath('../../data') |
|
28 | ||
29 |
from robot.libraries.BuiltIn import BuiltIn |
|
30 | ||
31 |
from Selenium2Library.locators import ElementFinder as BaseElementFinder |
|
32 |
from Selenium2Library import utils |
|
33 | ||
34 | ||
35 |
class ElementFinder(BaseElementFinder): |
|
36 |
def __init__(self): |
|
37 |
BaseElementFinder.__init__(self) |
|
38 |
self._strategies['qx'] = self._find_by_qx_field |
|
39 | ||
40 |
def _find_by_qx_field(self, browser, criteria, tag, constraints): |
|
41 |
xpath_value = utils.escape_xpath_value(criteria) |
|
42 |
criterias = [ |
|
43 |
"//div[div[@class='title'][text()=%s]]/div[@class='content']/input" % xpath_value, |
|
44 |
"//div[div[@class='title'][text()=%s]]/div[@class='content']/select" % xpath_value, |
|
45 |
"//div[div[@class='title'][text()=%s]]/div[@class='content']/textarea" % xpath_value, |
|
46 |
"//div/div[@class='content']//label[text()=%s]/input[@type='checkbox']" % xpath_value] |
|
47 |
for criteria in criterias: |
|
48 |
if browser.find_elements_by_xpath(criteria): |
|
49 |
return self._find_by_xpath(browser, criteria, tag, constraints) |
|
50 |
return [] |
|
51 | ||
52 | ||
53 |
class WcsRobotFrameworkLibrary: |
|
54 |
def __init__(self, port=10003): |
|
55 |
self.port = port |
|
56 |
try: |
|
57 |
seleniumlib = BuiltIn().get_library_instance('Selenium2Library') |
|
58 |
except RuntimeError: |
|
59 |
# the selenium library has not yet been loaded, monkeypatch it from |
|
60 |
# the outside |
|
61 |
import Selenium2Library.locators.elementfinder |
|
62 |
import Selenium2Library.keywords._element |
|
63 |
Selenium2Library.locators.elementfinder.ElementFinder = ElementFinder |
|
64 |
Selenium2Library.keywords._element.ElementFinder = ElementFinder |
|
65 |
else: |
|
66 |
# the selenium library is already loaded, and the ElementFinder |
|
67 |
# will therefore already have been instantiated, replace it. |
|
68 |
seleniumlib._element_finder = ElementFinder() |
|
69 | ||
70 |
def _waitforport(self, start): |
|
71 |
while True: |
|
72 |
if time.time() - start > 90: |
|
73 |
raise Exception('Servers did not start in 90 seconds!!') |
|
74 |
time.sleep(1) |
|
75 |
try: |
|
76 |
urllib2.urlopen('http://localhost:%s' % self.port) |
|
77 |
except urllib2.URLError: |
|
78 |
continue |
|
79 |
else: |
|
80 |
break |
|
81 | ||
82 |
def start_wcs_server(self, reset=True): |
|
83 |
if reset == 'False': reset = False |
|
84 |
if reset and os.path.exists('/tmp/.tests'): |
|
85 |
self.stop_wcs_server() |
|
86 |
shutil.rmtree('/tmp/.tests') |
|
87 |
if not os.path.exists('/tmp/.tests'): |
|
88 |
os.mkdir('/tmp/.tests') |
|
89 | ||
90 |
if not reset: |
|
91 |
try: |
|
92 |
urllib2.urlopen('http://localhost:%s' % self.port) |
|
93 |
except urllib2.URLError: |
|
94 |
pass |
|
95 |
else: |
|
96 |
return |
|
97 | ||
98 |
wcs_command = [WCSCTL, 'start', |
|
99 |
'--app-dir', '/tmp/.tests/', |
|
100 |
'--data-dir', WCS_DATA_DIR, |
|
101 |
'--port', str(self.port), '--http', '--silent'] |
|
102 |
sp = subprocess.Popen(wcs_command) |
|
103 |
fd = open('/tmp/.tests/pid', 'w') |
|
104 |
fd.write(str(sp.pid)) |
|
105 |
fd.close() |
|
106 | ||
107 |
# Wait for the daemons to load themselves |
|
108 |
starttime = time.time() |
|
109 |
self._waitforport(starttime) |
|
110 | ||
111 |
def stop_wcs_server(self): |
|
112 |
if not os.path.exists('/tmp/.tests/pid'): |
|
113 |
return |
|
114 |
fd = open('/tmp/.tests/pid') |
|
115 |
pid = int(fd.read()) |
|
116 |
fd.close() |
|
117 |
try: |
|
118 |
# valgrind seems to prefer SIGINT to SIGTERM |
|
119 |
os.kill(pid, signal.SIGINT) |
|
120 |
except OSError, e: |
|
121 |
print >> sys.stderr, 'failed to kill pid %s (%s)' % (pid, e) |
|
122 | ||
123 |
def reset_formdefs(self): |
|
124 |
if os.path.exists('/tmp/.tests/localhost/formdefs'): |
|
125 |
shutil.rmtree('/tmp/.tests/localhost/formdefs') |
|
126 |
if os.path.exists('/tmp/.tests/localhost/formdefs-url_name'): |
|
127 |
shutil.rmtree('/tmp/.tests/localhost/formdefs-url_name') |
tests/robot/fields/Date.txt | ||
---|---|---|
1 |
*** Settings *** |
|
2 |
Library Selenium2 Library |
|
3 |
Library Wcs Robot Framework Library |
|
4 |
Test Setup Setup Test |
|
5 |
Suite Setup Start WCS Server False |
|
6 |
Test Teardown Close All Browsers |
|
7 | ||
8 |
*** Keywords *** |
|
9 |
Setup Test |
|
10 |
Open Browser http://localhost:10003/ ff |
|
11 |
#Maximize Browser Window |
|
12 | ||
13 |
Given a logged in admin |
|
14 |
Click Link Login |
|
15 |
Input Text qx=Username admin |
|
16 |
Input Text qx=Password admin |
|
17 |
Click Button Log in |
|
18 | ||
19 |
*** Testcases *** |
|
20 |
Create Form With a Date Field |
|
21 |
Reset Formdefs |
|
22 |
Given a logged in admin |
|
23 |
Click Link Back Office |
|
24 |
Click Link admin |
|
25 |
Click Link Forms |
|
26 |
Click Link New Form |
|
27 |
Input Text qx=Form Title Form with a date field |
|
28 |
Click Button Submit |
|
29 |
Input Text qx=Label Date |
|
30 |
Select From List qx=Type Date |
|
31 |
Click Button Add |
|
32 |
Click Link Enable |
|
33 | ||
34 |
Correct Date |
|
35 |
Click Link Form with a date field |
|
36 |
Input Text qx=Date 2009-10-13 |
|
37 |
Click Button Next |
|
38 |
Page Should Contain Check values then click submit. |
|
39 | ||
40 |
Incorrect Date |
|
41 |
Click Link Form with a date field |
|
42 |
Input Text qx=Date hello world |
|
43 |
Click Button Next |
|
44 |
Page Should Not Contain Check values then click submit. |
|
45 | ||
46 |
Set Minimum Date |
|
47 |
Given a logged in admin |
|
48 |
Click Link Back Office |
|
49 |
Click Link admin |
|
50 |
Click Link Forms |
|
51 |
Click Link Form with a date field |
|
52 |
Click Link edit |
|
53 |
Mouse Over css=#itemId_1 |
|
54 |
Click Link css=#itemId_1 .commands .edit a |
|
55 |
Input Text qx=Minimum Date 2009-10-13 |
|
56 |
Click Button Submit |
|
57 | ||
58 |
Correct Date with minimum check |
|
59 |
Click Link Form with a date field |
|
60 |
Input Text qx=Date 2009-10-15 |
|
61 |
Click Button Next |
|
62 |
Page Should Contain Check values then click submit. |
|
63 | ||
64 |
Incorrect Date with minimum check |
|
65 |
Click Link Form with a date field |
|
66 |
Input Text qx=Date 2009-08-03 |
|
67 |
Click Button Next |
|
68 |
Page Should Not Contain Check values then click submit. |
|
69 | ||
70 |
Set Maximum Date |
|
71 |
Given a logged in admin |
|
72 |
Click Link Back Office |
|
73 |
Click Link admin |
|
74 |
Click Link Forms |
|
75 |
Click Link Form with a date field |
|
76 |
Click Link edit |
|
77 |
Mouse Over css=#itemId_1 |
|
78 |
Click Link css=#itemId_1 .commands .edit a |
|
79 |
Input Text qx=Minimum Date ${EMPTY} |
|
80 |
Input Text qx=Maximum Date 2009-10-13 |
|
81 |
Click Button Submit |
|
82 | ||
83 |
Correct Date with maximum check |
|
84 |
Click Link Form with a date field |
|
85 |
Input Text qx=Date 2009-08-03 |
|
86 |
Click Button Next |
|
87 |
Page Should Contain Check values then click submit. |
|
88 | ||
89 |
Incorrect Date with maximum check |
|
90 |
Click Link Form with a date field |
|
91 |
Input Text qx=Date 2009-10-15 |
|
92 |
Click Button Next |
|
93 |
Page Should Not Contain Check values then click submit. |
|
94 | ||
95 |
- |