~osomon/webbrowser-app/staging-trunk-landing-20161023

« back to all changes in this revision

Viewing changes to tests/autopilot/webapp_container/tests/__init__.py

Add autopilot tests javascript dialogs to webbrowser and webapp-container - alertDialog, beforeUnloadDialog, confirmDialog and promptDialog.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
            return LOCAL_BROWSER_CONTAINER_PATH_NAME
53
53
        return INSTALLED_BROWSER_CONTAINER_PATH_NAME
54
54
 
55
 
    def launch_webcontainer_app(self, args, envvars={}, is_local_app=False):
 
55
    def launch_webcontainer_app(self, args, envvars={}, is_local_app=False,
 
56
                                ignore_focus=False):
56
57
        if model() != 'Desktop':
57
58
            args.append(
58
59
                '--desktop_file_hint=/usr/share/applications/'
74
75
        except:
75
76
            self.app = None
76
77
 
77
 
        if not is_local_app:
 
78
        if not is_local_app and not ignore_focus:
78
79
            webview = self.get_oxide_webview()
79
80
            self.assertThat(
80
81
                lambda: webview.activeFocus,
128
129
            'schemeUriHandleFilterResult(QString)')[-1][0]
129
130
        return result
130
131
 
131
 
    def browse_to(self, url):
 
132
    def browse_to(self, url, wait_for_load=True):
132
133
        webview = self.get_oxide_webview()
133
134
        webview.slots.navigateToUrl(url)
134
 
        self.assert_page_eventually_loaded(url)
 
135
 
 
136
        if wait_for_load:
 
137
            self.assert_page_eventually_loaded(url)
135
138
 
136
139
    def kill_app(self, signal=signal.SIGKILL):
137
140
        os.kill(self.app.pid, signal)
161
164
        return self.base_url[len(self.BASE_URL_SCHEME):]
162
165
 
163
166
    def launch_webcontainer_app_with_local_http_server(
164
 
            self, args, path='/', envvars={}, homepage=''):
 
167
            self, args, path='/', envvars={}, homepage='', ignore_focus=False):
165
168
        self.url = self.base_url + path
166
169
        if len(homepage) != 0:
167
170
            self.url = homepage
168
171
        args.append(self.url)
169
 
        self.launch_webcontainer_app(args, envvars)
 
172
        self.launch_webcontainer_app(args, envvars, ignore_focus=ignore_focus)