コード例 #1
0
def screenshot(obj, filename, rstname, username='******'):
    """Insert a screenshot of the detail window for the given database
    object.

    Usage example in the source code of
    http://xl.lino-framework.org/specs/holidays.html.

    Problems: doesn't seem to wait long enough and
    therefore produces a white .png file.

    How to specify the filename? the current directory when doctest is
    running is normally the project root, but that's not sure. Best
    place would be the same directory as the rst file, but how to know
    that name from within a tested snippet?

    """
    from lino.api.selenium import Album, runserver

    assert filename.endswith('.png')
    assert rstname.endswith('.rst')

    self = dd.plugins.extjs.renderer
    ba = obj.get_detail_action()
    uri = self.get_detail_url(ba.actor, obj.pk)
    print(uri)

    def f(driver):
        app = Album(driver)
        driver.get("http://127.0.0.1:8000" + uri)
        # driver.get(uri)
        app.stabilize()
        if not driver.get_screenshot_as_file(filename):
            app.error("Failed to create {0}".format(filename))

    runserver(settings.SETTINGS_MODULE, f)
コード例 #2
0
ファイル: doctest.py プロジェクト: sandeez/lino
def screenshot(obj, filename, rstname, username='******'):
    """Insert a screenshot of the detail window for the given database
    object.

    Usage example in the source code of
    http://xl.lino-framework.org/specs/holidays.html.

    Problems: doesn't seem to wait long enough and
    therefore produces a white .png file.

    How to specify the filename? the current directory when doctest is
    running is normally the project root, but that's not sure. Best
    place would be the same directory as the rst file, but how to know
    that name from within a tested snippet?

    """
    from lino.api.selenium import Album, runserver

    assert filename.endswith('.png')
    assert rstname.endswith('.rst')

    self = dd.plugins.extjs.renderer
    uri = self.get_detail_url(obj)
    # ar = rt.login(username, renderer=self)
    # h = self.instance_handler(ar, obj)
    # uri = self.js2url(h)
    print(uri)

    def f(driver):
        app = Album(driver)
        driver.get("http://127.0.0.1:8000" + uri)
        # driver.get(uri)
        app.stabilize()
        if not driver.get_screenshot_as_file(filename):
            app.error("Failed to create {0}".format(filename))

    runserver(settings.SETTINGS_MODULE, f)
コード例 #3
0
    app.screenshot('pcsw.Clients.grid.params.png', "Filterparameter", """
    """)

    # find the first row and doubleclick it:
    elem = driver.find_elements(By.CLASS_NAME, 'x-grid3-row')[0]
    app.doubleclick(elem)

    app.stabilize()

    app.screenshot(
        'pcsw.Clients.detail.png', "Detail Klient", u"""
    Doppelklick auf eine Zeile, um das Detail dieses Klienten zu zeigen.
    """)


def main(driver):

    pth = dirname(__file__)
    Album(driver,
          pth,
          title="A tour of the team project",
          ref="team.tour",
          intro="""
        A series of screenshots to show :ref:`noi` using the
        :mod:`lino_book.projects.team` demo project.
        """).run(english_tour)


if __name__ == '__main__':
    runserver('lino_book.projects.team.settings.demo', main)
コード例 #4
0
ファイル: make_screenshots.py プロジェクト: khchine5/welfare
    """)

    elem.send_keys(Keys.ESCAPE)

    app.stabilize()

    tab1 = driver.find_element(By.LINK_TEXT, 'Personne')
    app.hover(tab1)
    # tab2 = driver.find_element(By.LINK_TEXT, 'Situation familiale')
    tabs = driver.find_elements(By.CLASS_NAME, 'x-tab-right')
    print(len(tabs), [e.text for e in tabs])
    tab2 = tabs[0]
    tab2.click()
    app.stabilize()

    app.screenshot(
        'pcsw.Clients.detail2.png',
        "Intervenants d'un bénéficiaire", """

    Le deuxième onglet du détail d'un bénéficiaire...

    """)

    app.write_index()


if __name__ == '__main__':
    runserver('lino_welfare.projects.chatelet.settings.demo', album1)


コード例 #5
0
ファイル: make_screenshots.py プロジェクト: khchine5/welfare
    elem = driver.find_element(
        By.CLASS_NAME, "x-tbar-database_gear")
    elem.click()
    app.stabilize()

    if False:
        elem.screenshot("tour/database_gear.png")
        # ValueError: No JSON object could be decoded
        # https://github.com/SeleniumHQ/selenium/issues/912

    app.screenshot('pcsw.Clients.grid.params.png', "Filterparameter", """
    """)

    # find the first row and doubleclick it:
    elem = driver.find_elements(By.CLASS_NAME, 'x-grid3-row')[0]
    app.doubleclick(elem)

    app.stabilize()

    app.screenshot('pcsw.Clients.detail.png', "Detail Klient", """
    Doppelklick auf eine Zeile, um das Detail dieses Klienten zu zeigen.
    """)

    app.write_index()


if __name__ == '__main__':
    runserver('lino_welfare.projects.eupen.settings.demo', album1)


コード例 #6
0
ファイル: maketour.py プロジェクト: khchine5/book
        # https://github.com/SeleniumHQ/selenium/issues/912

    app.screenshot('pcsw.Clients.grid.params.png', "Filterparameter", """
    """)

    # find the first row and doubleclick it:
    elem = driver.find_elements(By.CLASS_NAME, 'x-grid3-row')[0]
    app.doubleclick(elem)

    app.stabilize()

    app.screenshot('pcsw.Clients.detail.png', "Detail Klient", u"""
    Doppelklick auf eine Zeile, um das Detail dieses Klienten zu zeigen.
    """)


def main(driver):
    
    pth = dirname(__file__)
    Album(
        driver, pth, title="A tour of the team project",
        ref="team.tour", intro="""
        A series of screenshots to show :ref:`noi` using the
        :mod:`lino_book.projects.team` demo project.
        """).run(english_tour)
   
if __name__ == '__main__':
    runserver('lino_book.projects.team.settings.demo', main)