author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Thu, 21 Jul 2011 14:20:45 +0200 | |
branch | stable |
changeset 7682 | 07b592a62be3 |
parent 7363 | 2293c49b290a |
child 8696 | 0bb18407c053 |
permissions | -rw-r--r-- |
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
1 |
from cubicweb.devtools import DEFAULT_SOURCES |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
2 |
LOGIN, PASSWORD = DEFAULT_SOURCES['admin'].values() |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
3 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
4 |
# Generated by the windmill services transformer |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
5 |
from windmill.authoring import WindmillTestClient |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
6 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
7 |
def test_creation(): |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
8 |
client = WindmillTestClient(__name__) |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
9 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
10 |
client.open(url=u'/') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
11 |
client.waits.forPageLoad(timeout=u'8000') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
12 |
client.type(text=LOGIN, id=u'__login') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
13 |
client.type(text=PASSWORD, id=u'__password') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
14 |
client.click(value=u'log in') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
15 |
client.waits.forPageLoad(timeout=u'20000') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
16 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
17 |
# pre-condition |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
18 |
client.open(url=u'/cwuser/myuser') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
19 |
client.asserts.assertJS(js=u'$(\'#contentmain h1\').text() == "this resource does not exist"') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
20 |
client.open(url=u'/?rql=Any U WHERE U is CWUser, U login "myuser"') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
21 |
client.asserts.assertJS(js=u'$(\'.searchMessage strong\').text() == "No result matching query"') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
22 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
23 |
client.open(url=u'/manage') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
24 |
client.open(url=u'/add/CWUser') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
25 |
client.type(text=u'myuser', id=u'login-subject:A') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
26 |
client.type(text=u'myuser', id=u'upassword-subject:A') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
27 |
client.type(text=u'myuser', name=u'upassword-subject-confirm:A') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
28 |
client.type(text=u'myuser', id=u'firstname-subject:A') |
7059
1d65b235549f
[tests] Fix web test for windmill and forms
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6695
diff
changeset
|
29 |
client.select(option=u'managers', id=u'from_in_group-subject:A') |
1d65b235549f
[tests] Fix web test for windmill and forms
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6695
diff
changeset
|
30 |
client.click(id=u'cwinoutadd') |
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
31 |
client.waits.forPageLoad(timeout=u'20000') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
32 |
client.click(id=u'adduse_email:Alink') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
33 |
client.waits.forPageLoad(timeout=u'20000') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
34 |
client.type(text=u'myuser@logilab.fr', id=u'address-subject:B') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
35 |
client.waits.forPageLoad(timeout=u'20000') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
36 |
client.click(value=u'button_ok') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
37 |
client.waits.forPageLoad(timeout=u'20000') |
6695
b714521ac66d
[windmill tests] use extra timeouts, else we get failure simplu because we didn't wait enough
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6447
diff
changeset
|
38 |
client.waits.sleep(milliseconds=u'5000') |
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
39 |
client.asserts.assertJS(js=u'$(\'.message\').text() == "entity created"') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
40 |
client.open(url=u'/?rql=Any U WHERE U is CWUser, U login "myuser"') |
5905
ed66f5a8d48a
[test] windmill: add a timeout between JS assertion in test_creation use case
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5675
diff
changeset
|
41 |
client.waits.forPageLoad(timeout=u'20000') |
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
42 |
client.asserts.assertJS(js=u'$(\'#contentmain h1\').text() == "myuser"') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
43 |
client.waits.forPageLoad(timeout=u'8000') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
44 |
client.open(url=u'/cwuser/myuser?vid=sameetypelist') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
45 |
client.waits.forPageLoad(timeout=u'8000') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
46 |
client.asserts.assertJS(js=u'$(\'#contentmain a\').text() == "myuser"') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
47 |
client.open(url=u'/cwuser/myuser?vid=text') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
48 |
client.waits.forPageLoad(timeout=u'8000') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
49 |
client.asserts.assertJS(js=u'$(\'#contentmain\').text() == "\\nmyuser"') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
50 |
client.open(url=u'/cwuser/myuser?vid=deleteconf') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
51 |
client.waits.forElement(timeout=u'8000', value=u'button_delete') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
52 |
client.click(value=u'button_delete') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
53 |
client.waits.forPageLoad(timeout=u'8000') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
54 |
client.open(url=u'/cwuser/myuser') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
55 |
client.asserts.assertJS(js=u'$(\'#contentmain h1\').text() == "this resource does not exist"') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
56 |
client.open(url=u'/?rql=Any U WHERE U is CWUser, U login "myuser"') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
57 |
client.asserts.assertJS(js=u'$(\'.searchMessage strong\').text() == "No result matching query"') |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
58 |