Closed Bug 1205523 Opened 9 years ago Closed 9 years ago

Will raise validation exception on got_to_url when given a keyword as input url

Categories

(Firefox OS Graveyard :: Gaia::Browser, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
FxOS-S8 (02Oct)

People

(Reporter: sho, Assigned: sho)

Details

Attachments

(1 file)

We give keyword as input_url when we call the go_to_url of Search. It will raise the validation exception. We should implement different validation after doing the search based on different input_url.

for example:
    def type_into_url_field(self, input_string):
        # If any string exists already, clear the field
        self.marionette.find_element(*self._rocketbar_input_locator).clear()
        self.keyboard.send(input_string)

        #TODO Remove hack once Bug 1062309 is fixed
        self.marionette.switch_to_frame()
        Wait(self.marionette).until(lambda m: not self.keyboard.is_keyboard_displayed)

        self.marionette.find_element(*self._rocketbar_input_locator).tap()

        Wait(self.marionette).until(lambda m: self.keyboard.is_keyboard_displayed)
        self.keyboard.tap_enter()
        
    def go_to_url(self, url):
        self.type_into_url_field(url)
        Wait(self.marionette).until(lambda m: self.apps.displayed_app.name in urllib.quote(url, safe=':/?=&~'))
        from gaiatest.apps.search.regions.browser import Browser
        return Browser(self.marionette)

    def search_keyword(self, keyword):
        self.type_into_url_field(keyword)
        from gaiatest.apps.search.regions.browser import Browser
        return Browser(self.marionette)
I'm not sure if I understand where the validation exception would occur.
Would it happen in this line?
        Wait(self.marionette).until(lambda m: self.apps.displayed_app.name in urllib.quote(url, safe=':/?=&~'))
Because with a search term, we would get redirected to Google?
yes, if we give the search term, the validation will failed. Because we will redirect to a search engine.
Comment on attachment 8664152 [details] [review]
[gaia] ShakoHo:1205523 > mozilla-b2g:master

Hi,
please help to review this patch for this bug.
Add one line to check the input url, if it is not contain the http, we assume that would be a search keyword and skip the url validation.
Attachment #8664152 - Flags: review?(npark)
Attachment #8664152 - Flags: review?(martijn.martijn)
Assignee: nobody → sho
Comment on attachment 8664152 [details] [review]
[gaia] ShakoHo:1205523 > mozilla-b2g:master

If it fixes the failure you are seeing (in which test?), then it's fine by me.
Attachment #8664152 - Flags: review?(martijn.martijn) → review+
Comment on attachment 8664152 [details] [review]
[gaia] ShakoHo:1205523 > mozilla-b2g:master

makes sense, looks good to me
Attachment #8664152 - Flags: review?(npark) → review+
it happens when I run the test_mtbf_browser_search.py, and I notice that we don't have such test case in gaiatest right now.
Keywords: checkin-needed
https://github.com/mozilla-b2g/gaia/commit/d219a7e8e3c56061a5f2ad57909a50de1827691b
Status: NEW → RESOLVED
Closed: 9 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → FxOS-S8 (02Oct)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: