Skip to content

Svetoslavtsenov/include new tests #14

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

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
49 changes: 49 additions & 0 deletions src/test/java/uitests/Tests/Component/ActionBarTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,53 @@ public void flat_scrollview_action_bar() throws Exception {
this.compareScreens(5);
this.assertImagesResults();
}

@Test(groups = {"ios"})
public void flat_tab_opaque_bar() throws Exception {
this.actionBarPage.navigateTo("flat-tab-opaque-bar");
this.compareScreens(5);
this.assertImagesResults();
}

@Test(groups = {"android", "ios"})
public void flat_layout() throws Exception {
this.actionBarPage.navigateTo("flat-layout");
this.compareScreens(5);
this.assertImagesResults();
}

@Test(groups = {"android", "ios"})
public void actLocalIcons() throws Exception {
this.actionBarPage.navigateTo("actLocalIcons");
this.assertIconsHelper();
}

@Test(groups = {"android", "ios"})
public void actResIcons() throws Exception {
this.actionBarPage.navigateTo("actResIcons");
this.assertIconsHelper();
}

private void assertIconsHelper() throws Exception {
this.compareScreens(5);

UIRectangle uiRectangle = new UIRectangle(this.context.find.byText("undefined").getUIRectangle(), this.context);
uiRectangle.tap();
this.compareScreens(5);

uiRectangle.tap();
this.compareScreens(5);

uiRectangle.tap();
this.compareScreens(5);

UIRectangle goClearPage = new UIRectangle(this.context.wait.waitForVisible(this.locators.byText("goToClearedPage")).getUIRectangle(), this.context);
goClearPage.tap();
this.compareScreens(5);

this.context.find.byText("ITEM").tap();
this.compareScreens(5);

this.assertImagesResults();
}
}
70 changes: 70 additions & 0 deletions src/test/java/uitests/Tests/Issues/IssuesTestsCommon.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import functional.tests.core.enums.ClickType;
import functional.tests.core.enums.PlatformType;
import functional.tests.core.enums.Position;
import functional.tests.core.enums.SwipeElementDirection;
import functional.tests.core.mobile.element.UIElement;
import functional.tests.core.mobile.find.Wait;
Expand Down Expand Up @@ -388,6 +389,75 @@ public void issue_3714() throws Exception {
this.assertImagesResults();
}


@Test(groups = {"android"})
public void issue_6895_open_file() throws Exception {
this.issuesBasePage.navToPage("open-file-6895");
UIElement openFileBtn = this.context.find.byText("openFile");
openFileBtn.tap();
this.compareScreens(5);
this.context.client.getDriver().navigate().back();
this.issuesBasePage.navigateBack();

this.assertImagesResults();
}

@Test(groups = {"ios", "android"})
public void ng_repo_1599() throws Exception {
this.issuesBasePage.navToPage("ng-repo-1599");

for (int i = 0; i < 10; i++) {
this.context.gestures.scrollInWindow(SwipeElementDirection.DOWN, Position.FromQuarter, 100);
}

this.compareScreens(5);

for (int i = 0; i < 10; i++) {
this.context.gestures.scrollInWindow(SwipeElementDirection.UP, Position.FromQuarter, 100);
}

this.compareScreens(5);

assertImagesResults();
}

@Test(groups = {"ios", "android"})
public void ng_repo_1626() throws Exception {
this.issuesBasePage.navToPage("ng-repo-1626");

for (int i = 0; i < 10; i++) {
this.context.gestures.scrollInWindow(SwipeElementDirection.DOWN, Position.FromQuarter, 100);
}

this.compareScreens(5);

for (int i = 0; i < 10; i++) {
this.context.gestures.scrollInWindow(SwipeElementDirection.UP, Position.FromQuarter, 100);
}

this.compareScreens(5);

this.assertImagesResults();
}

@Test(groups = {"ios"})
public void issue_6439() throws Exception {
this.issuesBasePage.navToPage("6439");
for (int i = 0; i < 10; i++) {
this.context.gestures.scrollInWindow(SwipeElementDirection.DOWN, Position.FromQuarter, 100);
}

this.compareScreens(5);

for (int i = 0; i < 10; i++) {
this.context.gestures.scrollInWindow(SwipeElementDirection.UP, Position.FromQuarter, 100);
}

this.compareScreens(5);

this.assertImagesResults();
}

private void sendShareInternetKeys(Robot robot) {
this.log.info("send key cmd + y");
robot.keyPress(KeyEvent.VK_META);
Expand Down
77 changes: 76 additions & 1 deletion src/test/java/uitests/Tests/Layouts/LayoutsTests.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
package uitests.Tests.Layouts;

import functional.tests.core.enums.PlatformType;
import functional.tests.core.mobile.element.UIElement;
import functional.tests.core.mobile.element.UIRectangle;
import org.testng.Assert;
import org.testng.annotations.Test;

import java.awt.*;

public class LayoutsTests extends LayoutBaseTest {

@Test(groups = {"android", "ios"})
Expand Down Expand Up @@ -161,4 +167,73 @@ public void layouts_45_wrapItemWidthItemHeight() throws Exception {

this.assertImagesResults();
}
}

@Test(groups = {"android", "ios"})
public void passThroughParent() throws Exception {
this.layoutsPage.navigateTo("passThroughParent");
//this.assertScreen(5);

String onWrapLayoutResult = "onOuterWrapLayoutTapResult";
String buttonTapResult = "onButtonTapResult";
String none = "none";

// First layout
assertAction("onOuterWrapLayoutTap", onWrapLayoutResult);
assertAction("stackLayout1", onWrapLayoutResult);
assertAction("label1", onWrapLayoutResult);
assertAction("onUserInteractionDisabledThrowTap1", onWrapLayoutResult);

if (this.settings.platform == PlatformType.Android) {
assertAction("onDisabledThrowTap1", none);
} else {
assertAction("onDisabledThrowTap1", onWrapLayoutResult);
}

assertAction("btn1", buttonTapResult);

// Second layout
assertAction("stackLayout2", onWrapLayoutResult);
assertAction("label2", onWrapLayoutResult);
assertAction("stackLayout3", onWrapLayoutResult);
assertAction("label3", onWrapLayoutResult);
assertAction("onUserInteractionDisabledThrowTap2", onWrapLayoutResult);

if (this.settings.platform == PlatformType.Android) {
assertAction("onDisabledThrowTap2", none);
} else {
assertAction("onDisabledThrowTap2", onWrapLayoutResult);
}

assertAction("btn2", buttonTapResult);

if (this.settings.platform == PlatformType.iOS) {
this.context.navigationManager.slideBack();
}
}

private UIRectangle clearTextBtnRect;

private void assertAction(String buttonId, String expectedText) {
UIElement btn = this.context.find.byText(buttonId);

Rectangle rect = btn.getUIRectangle();
UIRectangle uiRectangle = new UIRectangle(rect, this.context);

if (this.settings.platform == PlatformType.iOS) {
int y = rect.y == 0 ? 100 : 5;
uiRectangle.extendRectangle(rect.width / 2, y, 0, 0);
}
uiRectangle.tap();

UIElement result = this.context.find.byText(expectedText);
String resultText = result.getText();
Assert.assertEquals(resultText, expectedText);

if (this.clearTextBtnRect == null) {
this.clearTextBtnRect = new UIRectangle(this.context.find.byText("clearResult").getUIRectangle(), this.context);
this.clearTextBtnRect.extendRectangle(5, 5, 0, 0);
}

this.clearTextBtnRect.tap();
}
}
39 changes: 35 additions & 4 deletions src/test/java/uitests/Tests/ScrollView/ScrollViewTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ public void safe_area_images() throws Exception {

this.device.rotate(ScreenOrientation.PORTRAIT);

this.assertImagesResults();
this.homePageExtended.getNavigationManager().slideBack();

this.assertImagesResults();
}

@Test(groups = {"ios"})
Expand All @@ -75,8 +76,9 @@ public void safe_area_images_overflow() throws Exception {

this.device.rotate(ScreenOrientation.PORTRAIT);

this.assertImagesResults();
this.homePageExtended.getNavigationManager().slideBack();

this.assertImagesResults();
}

@Test(groups = {"ios"})
Expand All @@ -89,8 +91,9 @@ public void safe_area_images_root_element() throws Exception {

this.device.rotate(ScreenOrientation.PORTRAIT);

this.assertImagesResults();
this.homePageExtended.getNavigationManager().slideBack();

this.assertImagesResults();
}

@Test(groups = {"ios"})
Expand All @@ -103,8 +106,36 @@ public void safe_area_images_sub_element() throws Exception {

this.device.rotate(ScreenOrientation.PORTRAIT);

this.assertImagesResults();
this.homePageExtended.getNavigationManager().slideBack();

this.assertImagesResults();
}

@Test(groups = {"ios"})
public void layout_outside_scroll() throws Exception {
this.homePageExtended.navigateTo("layout-outside-scroll");
this.compareScreens(5);

UIElement scrollToBottomBtn = this.context.find.byText("scrollToBottom");
scrollToBottomBtn.tap();

this.context.find.byText("changeVisibilityBottom");
this.compareScreens(5);

this.context.find.byText("scrollToTop");
this.compareScreens(5);

this.context.find.byText("changeVisibilityTop");
this.compareScreens(5);

scrollToBottomBtn.tap();
this.compareScreens(5);

this.context.find.byText("scrollToTop");
this.compareScreens(5);

this.assertImagesResults();

}

public void swipeToBottom(java.util.List<UIElement> elements, int index) {
Expand Down
Loading