diff --git a/src/test/java/uitests/Tests/Component/ActionBarTests.java b/src/test/java/uitests/Tests/Component/ActionBarTests.java index 563799e0..46a6f106 100644 --- a/src/test/java/uitests/Tests/Component/ActionBarTests.java +++ b/src/test/java/uitests/Tests/Component/ActionBarTests.java @@ -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(); + } } diff --git a/src/test/java/uitests/Tests/Issues/IssuesTestsCommon.java b/src/test/java/uitests/Tests/Issues/IssuesTestsCommon.java index 629b56ee..5c024642 100644 --- a/src/test/java/uitests/Tests/Issues/IssuesTestsCommon.java +++ b/src/test/java/uitests/Tests/Issues/IssuesTestsCommon.java @@ -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; @@ -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); diff --git a/src/test/java/uitests/Tests/Layouts/LayoutsTests.java b/src/test/java/uitests/Tests/Layouts/LayoutsTests.java index f8c2acf9..0779ea4f 100644 --- a/src/test/java/uitests/Tests/Layouts/LayoutsTests.java +++ b/src/test/java/uitests/Tests/Layouts/LayoutsTests.java @@ -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"}) @@ -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(); + } +} \ No newline at end of file diff --git a/src/test/java/uitests/Tests/ScrollView/ScrollViewTest.java b/src/test/java/uitests/Tests/ScrollView/ScrollViewTest.java index 64e92c0a..5bcd3288 100644 --- a/src/test/java/uitests/Tests/ScrollView/ScrollViewTest.java +++ b/src/test/java/uitests/Tests/ScrollView/ScrollViewTest.java @@ -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"}) @@ -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"}) @@ -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"}) @@ -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 elements, int index) { diff --git a/src/test/java/uitests/Tests/TabView/TabViewTests.java b/src/test/java/uitests/Tests/TabView/TabViewTests.java index ee3bc793..27abdff4 100644 --- a/src/test/java/uitests/Tests/TabView/TabViewTests.java +++ b/src/test/java/uitests/Tests/TabView/TabViewTests.java @@ -1,10 +1,14 @@ package uitests.Tests.TabView; import functional.tests.core.enums.PlatformType; +import functional.tests.core.enums.SwipeElementDirection; +import functional.tests.core.mobile.element.UIElement; import functional.tests.core.mobile.element.UIRectangle; import org.openqa.selenium.By; import org.testng.annotations.Test; +import java.util.List; + public class TabViewTests extends TabViewBaseTest { @Test(groups = {"android", "ios"}) @@ -62,7 +66,7 @@ public void tabView_icon_change() throws Exception { locator = this.context.locators.buttonLocator(); if (this.settings.platformVersion >= 11) { index = 2; - }else{ + } else { index = 3; } } @@ -76,4 +80,95 @@ public void tabView_icon_change() throws Exception { this.assertImagesResults(); } + + @Test(groups = {"android"}) + public void tabView_disable_swipe_android() throws Exception { + this.homePageExtended.navigateTo("tab-view-android-swipe"); + this.context.gestures.swipeInWindow(SwipeElementDirection.RIGHT, 200); + this.context.gestures.swipeInWindow(SwipeElementDirection.RIGHT, 200); + this.context.gestures.swipeInWindow(SwipeElementDirection.RIGHT, 200); + + this.compareScreens(5); + this.assertImagesResults(); + } + + @Test(groups = {"android", "ios"}) + public void tab_view_tab_text_font_size() throws Exception { + this.homePageExtended.navigateTo("tab-view-tab-text-font-size"); + this.compareScreens(5); + + UIElement tab2 = this.context.find.byText("Second"); + tab2.tap(); + this.compareScreens(5); + + UIElement tab3 = this.context.find.byText("First"); + tab3.tap(); + this.compareScreens(5); + + this.assertImagesResults(); + } + + @Test(groups = {"android", "ios"}) + public void tab_view_icon_title_placement() throws Exception { + this.homePageExtended.navigateTo("tab-view-icon-title-placement"); + this.compareScreens(5); + + if (this.settings.platform == PlatformType.Android) { + List tabsWithText = this.context.find.elementsByLocator(this.locators.byText("Title", false, false)); + tabsWithText.get(1).tap(); + this.compareScreens(5); + + tabsWithText.get(0).tap(); + this.compareScreens(5); + + List middleTabView = this.context.find.elementsByLocator(this.locators.imageLocator()); + middleTabView.get(middleTabView.size() - 1).tap(); + this.compareScreens(5); + } else { + List tabItems = this.context.find.elementsByLocator(By.xpath("*//XCUIElementTypeTabBar/XCUIElementTypeButton")); + tabItems.get(1).tap(); + this.compareScreens(5); + + tabItems.get(0).tap(); + this.compareScreens(5); + + tabItems.get(tabItems.size() - 1).tap(); + this.compareScreens(5); + } + + this.assertImagesResults(); + } + + + @Test(groups = {"android", "ios"}) + public void issue_5470() throws Exception { + this.homePageExtended.navigateTo("issue-5470"); + this.compareScreens(5); + + UIElement second = this.context.find.byText("Tab2"); + second.tap(); + this.compareScreens(5); + + UIElement first = this.context.find.byText("Tab1"); + first.tap(); + this.compareScreens(5); + + this.assertImagesResults(); + } + + @Test(groups = {"android", "ios"}) + public void tab_view_bottom_position() throws Exception { + this.homePageExtended.navigateTo("tab-view-bottom-position"); + this.compareScreens(5); + + UIElement second = this.context.find.byText("Second"); + second.tap(); + this.compareScreens(5); + + UIElement first = this.context.find.byText("First"); + first.tap(); + this.compareScreens(5); + + this.assertImagesResults(); + } }