~chromium-team/chromium-browser/trusty-beta

« back to all changes in this revision

Viewing changes to debian/tests/testdata/9-search-credit.sikuli/9-search-credit.py

  • Committer: Olivier Tilloy
  • Date: 2017-10-23 16:46:53 UTC
  • mfrom: (1172.1.38 trusty-stable)
  • Revision ID: olivier.tilloy@canonical.com-20171023164653-zmpfzblxxnkj0jhj
Merge back changes from stable branch:
  * debian/control: bump Standards-Version to 4.1.1
  * debian/patches/set-rpath-on-chromium-executables.patch: updated
  * debian/tests/*:
    - removed stale autopkgtests
    - added new autopkgtests based on chromium's new headless mode
  * debian/source/include-binaries: updated to reflect new binary data in tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import os
2
 
import re
3
 
import random
4
 
import subprocess
5
 
 
6
 
test_value = "x".join(str(random.randint(0, 50)) for x in range(5))
7
 
app = subprocess.Popen(["chromium-browser", "--window-size=1000,2200", "--window-position=50,100", "--user-data-dir=profile_storage", "--new-window"])
8
 
 
9
 
try:
10
 
 
11
 
    refresh_button = wait("cr-refresh-button.png", 30)
12
 
    click(refresh_button.right(50))
13
 
    just_below_refresh_button = refresh_button.below(30)
14
 
    just_below_refresh_button.type("l", KeyModifier.CTRL)
15
 
    refresh_button.right(50).type(test_value + Key.ENTER)
16
 
 
17
 
    # first assertion: default search is Google
18
 
    wait("google-text.png", 10)
19
 
    #wait("query-start.png", 10)
20
 
 
21
 
    # second assertion: search url contains our token
22
 
    just_below_refresh_button.type("l", KeyModifier.CTRL)
23
 
    just_below_refresh_button.type("c", KeyModifier.CTRL)
24
 
    location_bar_contents = Env.getClipboard()
25
 
 
26
 
    assert test_value in location_bar_contents, "Hrm, logic is wrong. " + location_bar_contents
27
 
    assert re.search(r"google", location_bar_contents), location_bar_contents
28
 
    assert re.search(r"\bclient=ubuntu\b", location_bar_contents), location_bar_contents
29
 
 
30
 
except:
31
 
    if app.pid:
32
 
        #os.kill(app.pid, signal.SIGTERM)
33
 
        #app.wait()
34
 
        pass
35
 
    else:
36
 
        # Jython python2.5 hackey. So so sorry.
37
 
        #app._process.destroy()
38
 
        pass
39
 
    raise
40
 
 
41
 
print "Success!"