Exemplo n.º 1
0
    def test_data_in_main_page_will_change(self, browser, city_from, city_to):
        """Test case for checks that geo position would be changed.

        Test case description:

        User moves to the page for choose a geo position. Switches off checkbox. Fills input field with correct
        city name. Popup menu becomes visible. User clicks by the first element of popup menu and redirects
        to the main page with new geo position.

        The programme gets geoid from the json object that will be received in the main 'div' block in the main page.
        Also, gets city name from the navigation block and the map link block.

        After that, user moves to the page for choose a geo position. Fills input field with another correct city name.
        Popup menu becomes visible. User clicks by the first element of popup menu and redirects to the main page
        with new geo position.

        The programme also gets geoid, city name from the navigation block and the map link block another geo position.
        Compares they variables with previous variables there are must be different.

        """
        page = BasePage(browser, MAIN_URL)
        page.open()
        page.go_to_geo_page()
        page.deactivate_geo_checkbox()

        city_input_field_from = page.get_city_input_field()
        city_input_field_from.clear()
        city_input_field_from.send_keys(city_from)
        page.click_first_geo_item()

        main_item_from = page.get_main_block()
        main_item_from = ParseMainPageObject(main_item_from.get_attribute('data-bem'))
        from_geo_id = main_item_from.get_geo_id()
        from_title_city_name = page.get_city_name().text
        from_map_city_name = page.get_maps_city_name().text

        page.go_to_geo_page()
        city_input_field = page.get_city_input_field()
        city_input_field.clear()
        city_input_field.send_keys(city_to)
        page.click_first_geo_item()

        main_item_to = page.get_main_block()
        main_item_to = ParseMainPageObject(main_item_to.get_attribute('data-bem'))
        to_geo_id = main_item_to.get_geo_id()
        to_title_city_name = page.get_city_name().text
        to_map_city_name = page.get_maps_city_name().text

        comparison.is_not_equal(from_geo_id, to_geo_id)
        comparison.is_not_equal(from_title_city_name, to_title_city_name)
        comparison.is_not_equal(from_map_city_name, to_map_city_name)
Exemplo n.º 2
0
    def test_choose_geo_position(self, browser, city):
        """Test case for checks that geo position would equal to sent data.

        Test case description:

        User moves to the page for choose a geo position. Switches off checkbox. Fills input field with correct
        city name. Popup menu becomes visible.

        The programme gets geoid and city name from the json object that first item of popup menu will return.

        User clicks by the first element of popup menu and redirects to the main page with new geo position.

        The programme gets geoid from the json object that will be received in the main 'div' block in the main page.
        Also, gets city name from the navigation block and the map link block. And compares all these variables with
        those which were got from the geo position page.

        """
        page = BasePage(browser, MAIN_URL)
        page.open()
        page.go_to_geo_page()
        page.deactivate_geo_checkbox()

        city_input_field = page.get_city_input_field()
        city_input_field.clear()
        city_input_field.send_keys(city)

        popup_item = page.get_first_geo_item()
        popup_item = ParseGeoPageObject(popup_item.get_attribute('data-bem'))
        popup_geo_id = popup_item.get_geo_id()
        popup_city_name = popup_item.get_city_name()
        page.click_first_geo_item()

        main_item = page.get_main_block()
        main_item = ParseMainPageObject(main_item.get_attribute('data-bem'))
        main_geo_id = main_item.get_geo_id()
        title_city_name = page.get_city_name().text
        map_city_name = page.get_maps_city_name().text

        comparison.is_equal(popup_geo_id, main_geo_id)
        comparison.is_equal(popup_city_name, title_city_name)
        comparison.element_within(map_city_name, popup_city_name[:-1])