web/test/windmill/test_creation.py
author Julien Jehannet <julien.jehannet@logilab.fr>
Fri, 05 Nov 2010 16:55:13 +0100
branchstable
changeset 6695 b714521ac66d
parent 6447 f5d1b1025702
child 7059 1d65b235549f
permissions -rw-r--r--
[windmill tests] use extra timeouts, else we get failure simplu because we didn't wait enough
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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')
6447
f5d1b1025702 [tests] update windmill use cases from link corrections
Julien Jehannet <julien.jehannet@logilab.fr>
parents: 5905
diff changeset
    29
    client.select(option=u'managers', id=u'in_group-subject:A')
5675
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    30
    client.waits.forPageLoad(timeout=u'20000')
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    31
    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
    32
    client.waits.forPageLoad(timeout=u'20000')
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    33
    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
    34
    client.waits.forPageLoad(timeout=u'20000')
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    35
    client.click(value=u'button_ok')
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    36
    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
    37
    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
    38
    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
    39
    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
    40
    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
    41
    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
    42
    client.waits.forPageLoad(timeout=u'8000')
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    43
    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
    44
    client.waits.forPageLoad(timeout=u'8000')
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    45
    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
    46
    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
    47
    client.waits.forPageLoad(timeout=u'8000')
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    48
    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
    49
    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
    50
    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
    51
    client.click(value=u'button_delete')
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    52
    client.waits.forPageLoad(timeout=u'8000')
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    53
    client.open(url=u'/cwuser/myuser')
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    54
    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
    55
    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
    56
    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
    57