|
| 1 | +import { |
| 2 | + AppiumDriver, |
| 3 | + createDriver, |
| 4 | + SearchOptions, |
| 5 | + UIElement |
| 6 | +} from "nativescript-dev-appium"; |
| 7 | +import { assert } from "chai"; |
| 8 | + |
| 9 | +describe("page-router-outlet-scenario", () => { |
| 10 | + let driver: AppiumDriver; |
| 11 | + |
| 12 | + describe("actionBarVisibility 'always' shows action bars", async () => { |
| 13 | + before(async () => { |
| 14 | + driver = await createDriver(); |
| 15 | + await driver.driver.resetApp(); |
| 16 | + }); |
| 17 | + |
| 18 | + it("should navigate to page", async () => { |
| 19 | + const navigationButton = |
| 20 | + await driver.findElementByText("ActionBarVisibility Always", SearchOptions.exact); |
| 21 | + await navigationButton.click(); |
| 22 | + |
| 23 | + await driver.findElementByText("ShowActionBar", SearchOptions.exact); |
| 24 | + }); |
| 25 | + |
| 26 | + it("should not hide action bar by default", async () => { |
| 27 | + const screenMatches = await driver.compareScreen("actionBarVisibility-always-default", 5); |
| 28 | + assert(screenMatches); |
| 29 | + }); |
| 30 | + |
| 31 | + it("should not hide action bar when hidden by page", async () => { |
| 32 | + const hideActionBarButton = await driver.findElementByText("HideActionBar"); |
| 33 | + hideActionBarButton.click(); |
| 34 | + |
| 35 | + const screenMatches = await driver.compareScreen("actionBarVisibility-always-hidden", 5); |
| 36 | + assert(screenMatches); |
| 37 | + }); |
| 38 | + |
| 39 | + it("should not do anything when shown action bar by page", async () => { |
| 40 | + const showActionBarButton = await driver.findElementByText("ShowActionBar"); |
| 41 | + showActionBarButton.click(); |
| 42 | + |
| 43 | + const screenMatches = await driver.compareScreen("actionBarVisibility-always-shown", 5); |
| 44 | + assert(screenMatches); |
| 45 | + }); |
| 46 | + }); |
| 47 | + |
| 48 | + describe("actionBarVisibility 'never' doesn't show action bars", async () => { |
| 49 | + before(async () => { |
| 50 | + driver = await createDriver(); |
| 51 | + await driver.driver.resetApp(); |
| 52 | + }); |
| 53 | + |
| 54 | + it("should navigate to page", async () => { |
| 55 | + const navigationButton = |
| 56 | + await driver.findElementByText("ActionBarVisibility Never", SearchOptions.exact); |
| 57 | + await navigationButton.click(); |
| 58 | + |
| 59 | + await driver.findElementByText("ShowActionBar", SearchOptions.exact); |
| 60 | + }); |
| 61 | + |
| 62 | + it("should hide action bar by default", async () => { |
| 63 | + const screenMatches = await driver.compareScreen("actionBarVisibility-never-default", 5); |
| 64 | + assert(screenMatches); |
| 65 | + }); |
| 66 | + |
| 67 | + it("should not show action bar when shown by page", async () => { |
| 68 | + const showActionBarButton = await driver.findElementByText("ShowActionBar"); |
| 69 | + showActionBarButton.click(); |
| 70 | + |
| 71 | + const screenMatches = await driver.compareScreen("actionBarVisibility-never-shown", 5); |
| 72 | + assert(screenMatches); |
| 73 | + }); |
| 74 | + |
| 75 | + it("should not do anything when hidden action bar by page", async () => { |
| 76 | + const hideActionBarButton = await driver.findElementByText("HideActionBar"); |
| 77 | + hideActionBarButton.click(); |
| 78 | + |
| 79 | + const screenMatches = await driver.compareScreen("actionBarVisibility-never-hidden", 5); |
| 80 | + assert(screenMatches); |
| 81 | + }); |
| 82 | + }); |
| 83 | + |
| 84 | + describe("actionBarVisibility 'auto' shows action bars based on page", async () => { |
| 85 | + before(async () => { |
| 86 | + driver = await createDriver(); |
| 87 | + await driver.driver.resetApp(); |
| 88 | + }); |
| 89 | + |
| 90 | + it("should navigate to page", async () => { |
| 91 | + const navigationButton = |
| 92 | + await driver.findElementByText("ActionBarVisibility Auto", SearchOptions.exact); |
| 93 | + await navigationButton.click(); |
| 94 | + |
| 95 | + await driver.findElementByText("ShowActionBar", SearchOptions.exact); |
| 96 | + }); |
| 97 | + |
| 98 | + it("should show action bar by default", async () => { |
| 99 | + const screenMatches = await driver.compareScreen("actionBarVisibility-auto-default", 5); |
| 100 | + assert(screenMatches); |
| 101 | + }); |
| 102 | + |
| 103 | + it("should hide action bar when hidden by page", async () => { |
| 104 | + const hideActionBarButton = await driver.findElementByText("HideActionBar"); |
| 105 | + hideActionBarButton.click(); |
| 106 | + |
| 107 | + const screenMatches = await driver.compareScreen("actionBarVisibility-auto-hidden", 5); |
| 108 | + assert(screenMatches); |
| 109 | + }); |
| 110 | + |
| 111 | + it("should show action bar when shown by page", async () => { |
| 112 | + const showActionBarButton = await driver.findElementByText("ShowActionBar"); |
| 113 | + showActionBarButton.click(); |
| 114 | + |
| 115 | + const screenMatches = await driver.compareScreen("actionBarVisibility-auto-shown", 5); |
| 116 | + assert(screenMatches); |
| 117 | + }); |
| 118 | + }); |
| 119 | +}); |
0 commit comments