Example #1
0
    def irv_test(self):
        # go to test page
        pla.get("/irv/test/")

        # wait DOM population via async JS
        pla.xpath_finduniq(
            "//div[@class='jasmine_html-reporter']/div" "[@class='results']/div[@class='summary']", 100, 1
        )

        # check the result of tests
        pla.xpath_finduniq("//span[@class='bar passed' and contains" "(normalize-space(text()), ', 0 failures')]")
Example #2
0
    def check_empty_cells_test(self):
        pla.get('/ipt')

        # initially, we are in the exposure tab, and the handson table is empty

        # <button id="saveBtnEX" type="button" style="display: block;"
        #     class="btn btn-primary">Convert to NRML</button>

        convert_btn = pla.xpath_finduniq(
            "//div[contains(concat(' ',normalize-space(@class),' '),"
            "' ex_gid ')]//button[@id='convertBtn' and @type='button'"
            " and normalize-space(text())='Convert to NRML']")

        # required to avoiding wrong click on overlapping "About" link
        convert_btn.location_once_scrolled_into_view

        convert_btn.click()

        pla.xpath_finduniq(
            "//div[contains(concat(' ',normalize-space(@class),' '),"
            "' ex_gid ')]//div[@id='outputDiv']//div[@id='validationErrorMsg'"
            " and normalize-space(text())='Validation error:"
            " empty cell at coords (1, 1).']")
Example #3
0
    def generated(self):
        pla.get('/ipt/?tab_id=%d&example_id=%d' % (tab_id, example['exa_id']))
        for xpath in example['xpath']:
            ret_tag = pla.xpath_finduniq(xpath, times=20)

        exp_filename = os.path.join(
            exp_path, "example_%d.%s" %
            (tab_id * 100 + example['exa_id'], example['sfx']))
        with codecs.open(exp_filename, 'r', 'utf-8') as exp_file:
            expected = exp_file.read()

        ret = ret_tag.get_attribute("value")
        if ret is None:
            ret = ret_tag.get_attribute('innerHTML')
        self.assertEqual(ret, expected)
Example #4
0
    def isc_test(self):
        pla.get('/explore')
        pla.wait_new_page("//b[contains(text(), 'Seismic Hazard Data Sets and Models')]",
                          "/explore", strategy="next", timeout=10)

        #<li>
        #<a href="/maps/23">
        enter_button = pla.xpath_finduniq(
            "//li/a[@href='/maps/23' and normalize-space(text()) = 'Global "
            "Instrumental Earthquake Catalogue (1900 - 2009)']")
        enter_button.click()
        pla.wait_new_page(enter_button, '/maps/23')

        enter_button = pla.xpath_finduniq(
            "//a[@href='/maps/23/view' and "
            "normalize-space(text()) = 'View Map']")
        enter_button.click()
        pla.wait_new_page(enter_button, '/maps/23/view', timeout=15)

        # <button id="ext-gen159" class=" x-btn-text gxp-icon-getfeatureinfo"
        # type="button">Identify
        enter_button = pla.xpath_finduniq(
            "//button[@type='button' and normalize-space(text())"
            "= 'Identify']", 50)
        enter_button.click()

        # wait info button will be clicked
        pla.xpath_finduniq(
            "//button[@type='button' and normalize-space(text())"
            "= 'Identify']/../../../../..[contains(concat(' ', @class, ' '),"
            " ' x-btn-pressed ')]", 100)

        tail_ptr = pla.xpath_finduniq(
            "//img[contains(@src, 'wms?LAYERS=oqplatform%3Aisc_viewer_measure"
            "&FORMAT=image%2Fpng&TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1"
            "&REQUEST=GetMap&STYLES=&TILED=true&SRS=EPSG%3A900913&BBOX="
            "-10018754.17,0,-5009377.085,5009377.085&WIDTH=256&HEIGHT=256')]",
            50)

        pla.add_click_event()
        pla.click_at(107 + tail_ptr.location['x'],
                     115 + tail_ptr.location['y'])
        # raise ValueError

        pla.xpath_finduniq("//div[text() = '1951-03-19T04:23:00']", 50)