New issue
Advanced search Search tips

Issue 699110 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: iOS
Pri: 3
Type: Feature



Sign in to add a comment

Find a way for the EG tests to access the webviews owned by NativeContentViews

Project Member Reported by jif@chromium.org, Mar 7 2017

Issue description

Context:
I want to check using Earl Grey that an offline page (which contains distilled content from the Reading List) has specific content.
Earl Grey usually finds the webview by asking the CRWWebController for its webview_.

In the case of offline pages, the CRWWebController doesn't have any webview_ (which would have been initialized in loadCurrentURLInWebView).
Instead, the CRWWebController has a nativeController, (aka nativeContent, in this case a OfflinePageNativeContent) which is initialized in loadCurrentURLInNativeView.
 
Cc: eugene...@chromium.org
Note that Native content will be deprecated.
Adding a temporary access to nativeContent may be acceptable in these conditions.

Cc: baxley@chromium.org
Components: -Tests Test>iOS
Labels: -Type-Bug Type-Feature
I don't think that EG asks CRWWebController for its webview_. But we can add API like StaticHtmlNativeContentContainingText.

Comment 4 by jif@chromium.org, Mar 7 2017

My wording was indeed incorrect. What I meant to say was that EG ends up calling CRWWebController's executeJavaScript, which itself uses |webview_|.

Could we modify CRWWebController's executeJavaScript so that if its |webview_| is nil, it tries to execute JS with the nativeController?
>>> Could we modify CRWWebController's executeJavaScript so that if its |webview_| is nil, it tries to execute JS with the nativeController?

This can break many things and given that we want to deprecate NativeContent for the new architecture, I would choose not to risk :)

Comment 6 by jif@chromium.org, Mar 7 2017

Where would you imagine adding StaticHtmlNativeContentContainingText?

And what do you think about adding a EG helper that simply searches for a WKWebview the view hierarchy?

>>> Where would you imagine adding StaticHtmlNativeContentContainingText?
I was thinking about chrome_macthers.h/m, which turns out already has StaticHtmlViewContainingText metcher. Does existing method work for you?

>>> And what do you think about adding a EG helper that simply searches for a WKWebview the view hierarchy?
I would be strongly against that :). We spend many months rewriting KIF tests during UIWebView -> WKWebView transitioning, because KIF tests used UIWebView directly. EG tests should not operate on low-level concepts like WKWebView.

Owner: ----
Status: Untriaged (was: Assigned)
jif@ is no longer on the team. Releasing his bugs for triage.

Comment 9 by sczs@chromium.org, Jun 27 2018

Cc: -baxley@chromium.org -eugene...@chromium.org
Labels: Needs-Feedback
Owner: eugene...@chromium.org
Status: Assigned (was: Untriaged)
eugenebut@ do you think we can close this?
Status: Fixed (was: Assigned)
I think that -[ChromeEarlGrey waitForStaticHTMLViewContainingText] addresses the issue.

Sign in to add a comment