web/test/windmill/test_edit_relation.py
author Nicolas Chauvat <nicolas.chauvat@logilab.fr>
Mon, 09 Aug 2010 16:35:49 +0200
branchstable
changeset 6079 bd7e3042791e
parent 5995 b9c612274af7
child 6447 f5d1b1025702
permissions -rw-r--r--
fix the fix
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5995
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
     1
from cubicweb.devtools import DEFAULT_SOURCES
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
     2
LOGIN, PASSWORD = DEFAULT_SOURCES['admin'].values()
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
     3
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
     4
# Generated by the windmill services transformer
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
     5
from windmill.authoring import WindmillTestClient
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
     6
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
     7
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
     8
def test_edit_relation():
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
     9
    client = WindmillTestClient(__name__)
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    10
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    11
    client.open(url=u'/logout')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    12
    client.open(url=u'/')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    13
    client.asserts.assertJS(js=u"$('#loginForm').is(':visible')")
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    14
    client.type(text=LOGIN, id=u'__login')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    15
    client.type(text=PASSWORD, id=u'__password')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    16
    client.execJS(js=u"$('#loginForm').submit()")
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    17
    client.waits.forPageLoad(timeout=u'20000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    18
    client.open(url=u'/add/Folder')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    19
    client.waits.forPageLoad(timeout=u'20000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    20
    client.waits.forElement(timeout=u'8000', id=u'name-subject:A')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    21
    client.click(id=u'name-subject:A')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    22
    client.type(text=u'folder1', id=u'name-subject:A')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    23
    client.click(value=u'button_ok')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    24
    client.waits.forPageLoad(timeout=u'20000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    25
    client.waits.forElement(link=u'add add Folder filed_under Folder object', timeout=u'8000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    26
    client.click(link=u'add add Folder filed_under Folder object')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    27
    client.waits.forPageLoad(timeout=u'20000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    28
    client.waits.forElement(timeout=u'8000', id=u'name-subject:A')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    29
    client.click(id=u'name-subject:A')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    30
    client.type(text=u'subfolder1', id=u'name-subject:A')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    31
    client.click(value=u'button_ok')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    32
    client.waits.forPageLoad(timeout=u'20000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    33
    client.waits.forElement(link=u'more actions', timeout=u'8000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    34
    client.click(link=u'more actions')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    35
    client.click(link=u'copy')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    36
    client.waits.forPageLoad(timeout=u'20000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    37
    client.type(text=u'folder2', id=u'name-subject:A')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    38
    client.click(value=u'button_ok')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    39
    client.waits.forPageLoad(timeout=u'20000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    40
    client.waits.forElement(link=u'modify', timeout=u'8000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    41
    client.click(link=u'modify')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    42
    client.waits.forPageLoad(timeout=u'20000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    43
    client.waits.forElement(timeout=u'8000', id=u'footer')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    44
    client.click(link=u'x')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    45
    client.click(value=u'button_ok')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    46
    client.waits.forPageLoad(timeout=u'20000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    47
    client.waits.forElement(link=u'add add Folder filed_under Folder object', timeout=u'8000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    48
    client.click(link=u'add add Folder filed_under Folder object')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    49
    client.waits.forPageLoad(timeout=u'20000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    50
    client.type(text=u'subfolder2', id=u'name-subject:A')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    51
    client.click(value=u'button_ok')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    52
    client.waits.forPageLoad(timeout=u'20000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    53
    client.waits.forElement(link=u'subfolder2', timeout=u'8000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    54
    client.click(link=u'subfolder2')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    55
    client.waits.forPageLoad(timeout=u'20000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    56
    client.waits.forElement(link=u'modify', timeout=u'8000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    57
    client.click(link=u'modify')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    58
    client.waits.forPageLoad(timeout=u'20000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    59
    client.waits.forElement(timeout=u'8000', id=u'footer')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    60
    client.click(link=u'x')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    61
    client.select(xpath=u'//select', index=u'1')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    62
    #client.execJQuery(jquery=u'("select").trigger(\'change\')') # BUGGY freeze UI..
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    63
    client.execJS(js=u'$("select").trigger(\'change\')')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    64
    client.waits.sleep(milliseconds=u'2000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    65
    client.select(jquery=u'(\'select:contains("Search")\')[0]', option=u'Search for folder')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    66
    client.waits.forPageLoad(timeout=u'20000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    67
    client.click(link=u'folder1')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    68
    client.waits.forPageLoad(timeout=u'20000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    69
    client.waits.forElement(timeout=u'8000', value=u'button_ok')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    70
    client.click(value=u'button_ok')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    71
    client.waits.forPageLoad(timeout=u'20000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    72
    client.asserts.assertText(xpath=u'//h1', validator=u'subfolder2')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    73
    client.waits.forElement(link=u'folder_plural', timeout=u'8000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    74
    client.click(link=u'folder_plural')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    75
    client.waits.forPageLoad(timeout=u'20000')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    76
    client.asserts.assertText(jquery=u"('#contentmain div a')[0]", validator=u'folder1')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    77
    client.asserts.assertText(jquery=u"('#contentmain div a')[1]", validator=u'folder2')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    78
    client.asserts.assertText(jquery=u"('#contentmain div a')[2]", validator=u'subfolder1')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    79
    client.asserts.assertText(jquery=u"('#contentmain div a')[3]", validator=u'subfolder2')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    80
    client.click(link=u'subfolder2')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    81
    client.click(link=u'modify')
b9c612274af7 [test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    82
    client.click(link=u'folder1')