Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finalization of the Widget feature #669

Merged
merged 13 commits into from
Jul 20, 2017
Merged

Finalization of the Widget feature #669

merged 13 commits into from
Jul 20, 2017

Conversation

TikhomirovSergey
Copy link
Contributor

Change list

  • missed parameters of the OverrideWidget were added

    • iOSXCUITAutomation
    • windowsAutomation
  • some improvements which are related to latest API changes were made.

  • tests were refactored. Now it is supposed to use unit test for this feature

Types of changes

  • No changes in production code.
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

@TikhomirovSergey
Copy link
Contributor Author

@SrinivasanTarget @mykola-mokhnach could you take a look at this PR?

@mykola-mokhnach
Copy link
Contributor

It's huge O_O. Probably, this will take some time

@SrinivasanTarget SrinivasanTarget added this to the 5.0.0 milestone Jul 13, 2017
@TikhomirovSergey
Copy link
Contributor Author

@mykola-mokhnach. Ok. Don't hurry and be watchful.

Copy link
Contributor

@mykola-mokhnach mykola-mokhnach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review is still in progress...

@@ -83,10 +86,19 @@
return getConvenientClass(declaredClass, annotatedElement, ANDROID_UI_AUTOMATOR);
}

if (IOS.equalsIgnoreCase(transformedPlatform) && AutomationName.IOS_XCUI_TEST
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather added this condition under single IOS.equalsIgnoreCase(transformedPlatform) condition. One might forget about the fact, that conditions order matters here, having the current implementation.

.orElse(getByFromDeclaredClass(WhatIsNeeded.DEFAULT_OR_HTML));
}

@Override protected By buildMobileNativeBy() {
return Optional.ofNullable(super.buildMobileNativeBy())
return ofNullable(super.buildMobileNativeBy())
Copy link
Contributor

@mykola-mokhnach mykola-mokhnach Jul 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the super.buildMobileNativeBy marked as Nullable?

}

@Override
public void get(String url) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably, such empty method tucbs should also have some comment in the body to make linter happy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

public <T extends Widget> List<T> getSubWidgets() {
return of();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot say this is very readable %)

}

public String toString() {
return getWrappedElement().toString();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can getWrappedElement return null?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No


@Override
public String toString() {
return by.toString();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can by be equal to null?

Copy link
Contributor Author

@TikhomirovSergey TikhomirovSergey Jul 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


@Override
public void checkACommonWidget() {
defaultTest(app.getWidget(), app.getWidgets(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have a better name for this method?

*/
@Parameterized.Parameters
public static Collection<Object[]> data() {
return asList(new Object[][] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Arrays.asList also supports simple objects (T... item) as parameters

.map(widget -> widget.getSelfReference().getClass()).collect(toList())));

assertThat(classes,
contains(widgetClass, widgetClass, widgetClass, widgetClass));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please explain what is being verified here?

@iOSXCUITFindBy(iOSNsPredicate = "SOME_XCUIT_DEFAULT_LOCATOR")
private List<DefaultIosWidget> multipleIosWidgets;

private AnnotatedIosWidget singleAnnotatedIosWidget;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should these properties be annotated as well?


public static String WINDOWS_SUB_WIDGET_LOCATOR = "SOME_SUB_LOCATOR";

@WindowsFindBy(windowsAutomation = "SOME_SUB_LOCATOR")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: format

@iOSXCUITFindBy(iOSNsPredicate = "SOME_XCUIT_DEFAULT_LOCATOR")
private List<DefaultWindowsWidget> multipleIosWidgets;

private AnnotatedWindowsWidget singleAnnotatedIosWidget;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing annotations?

return APPIUM;
}

public boolean isBrowser() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Override?

@TikhomirovSergey
Copy link
Contributor Author

@mykola-mokhnach Ok. I'm working on you remarks.

- comments for stub void methods
- method and classes were renamed.
@appium appium deleted a comment Jul 16, 2017
@appium appium deleted a comment Jul 16, 2017
@appium appium deleted a comment Jul 16, 2017
@appium appium deleted a comment Jul 16, 2017
@appium appium deleted a comment Jul 16, 2017
@appium appium deleted a comment Jul 16, 2017
@appium appium deleted a comment Jul 16, 2017
@appium appium deleted a comment Jul 16, 2017
@appium appium deleted a comment Jul 16, 2017
@appium appium deleted a comment Jul 16, 2017
@appium appium deleted a comment Jul 16, 2017
public void checkACommonWidget() {
defaultTest(app.getWidget(), app.getWidgets(),
public void commonTestCase() {
testLogigByDefault(app.getWidget(), app.getWidgets(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is "Logig"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is typo :)

protected WidgetTest(AbstractApp app, WebDriver driver) {
this.app = app;
initElements(new AppiumFieldDecorator(driver), app);
}

@Test
public abstract void checkACommonWidget();
public abstract void commonTestCase();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is recommended having a verb in method names

IosUIAutomation(IOS_DEFAULT_WIDGET_LOCATOR), IosUIAutomation(IOS_SUB_WIDGET_LOCATOR));
}

@Override
public void checkAnAnnotatedWidget() {
defaultTest(((ExtendedApp) app).getAnnotatedWidget(), ((ExtendedApp) app).getAnnotatedWidgets(),
public void checkCaseWhenWidgetClassHasDeclaredLocatorAnnotation() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@appium appium deleted a comment Jul 19, 2017
@TikhomirovSergey TikhomirovSergey merged commit 8340d5c into appium:master Jul 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants