123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- const Utils = require('./Utils');
- const testIDs = require('../playground/src/testIDs');
-
- const { elementById, elementByLabel } = Utils;
-
- describe('screen style', () => {
- beforeEach(async () => {
- await device.relaunchApp();
- });
-
- it('declare a options on component component', async () => {
- await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
- await expect(elementByLabel('Static Title')).toBeVisible();
- });
-
- it('change title on component component', async () => {
- await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
- await expect(elementByLabel('Static Title')).toBeVisible();
- await elementById(testIDs.DYNAMIC_OPTIONS_BUTTON).tap();
- await expect(elementByLabel('Dynamic Title')).toBeVisible();
- });
-
- it('set dynamic options with valid options will do something and not crash', async () => {
- // we have no way of testing individual styles for the screen
- await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
- await elementById(testIDs.DYNAMIC_OPTIONS_BUTTON).tap();
- await expect(elementById(testIDs.OPTIONS_SCREEN_HEADER)).toBeVisible();
- });
-
- it('hides Tab Bar when pressing on Hide Top Bar and shows it when pressing on Show Top Bar', async () => {
- await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
- await elementById(testIDs.HIDE_TOP_BAR_BUTTON).tap();
- await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeNotVisible();
- await elementById(testIDs.SHOW_TOP_BAR_BUTTON).tap();
- await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeVisible();
- });
-
- it(':ios: hides topBar onScroll down and shows it on scroll up', async () => {
- await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
- await elementById(testIDs.SCROLLVIEW_SCREEN_BUTTON).tap();
- await elementById(testIDs.TOGGLE_TOP_BAR_HIDE_ON_SCROLL).tap();
- await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeVisible();
- await element(by.id(testIDs.SCROLLVIEW_ELEMENT)).swipe('up', 'slow');
- await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeNotVisible();
- await element(by.id(testIDs.SCROLLVIEW_ELEMENT)).swipe('down', 'slow');
- await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeVisible();
- });
-
- it('set Tab Bar badge on a current Tab', async () => {
- await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
- await elementById(testIDs.SET_TAB_BADGE_BUTTON).tap();
- await expect(element(by.text('TeSt'))).toBeVisible();
- });
-
- it(':ios: hide Tab Bar', async () => {
- await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
- await expect(elementById(testIDs.BOTTOM_TABS_ELEMENT)).toBeVisible();
- await elementById(testIDs.HIDE_BOTTOM_TABS_BUTTON).tap();
- await expect(elementById(testIDs.BOTTOM_TABS_ELEMENT)).toBeNotVisible();
- });
-
- it(':ios: show Tab Bar', async () => {
- await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
- await elementById(testIDs.HIDE_BOTTOM_TABS_BUTTON).tap();
- await expect(elementById(testIDs.BOTTOM_TABS_ELEMENT)).toBeNotVisible();
- await elementById(testIDs.SHOW_BOTTOM_TABS_BUTTON).tap();
- await expect(elementById(testIDs.BOTTOM_TABS_ELEMENT)).toBeVisible();
- });
-
- it(':ios: side menu visibility - left', async () => {
- await elementById(testIDs.TAB_BASED_APP_SIDE_BUTTON).tap();
- await elementById(testIDs.SHOW_LEFT_SIDE_MENU_BUTTON).tap();
- await expect(elementById(testIDs.HIDE_LEFT_SIDE_MENU_BUTTON)).toBeVisible();
- await elementById(testIDs.HIDE_LEFT_SIDE_MENU_BUTTON).tap();
- await expect(elementById(testIDs.CENTERED_TEXT_HEADER)).toBeVisible();
- });
-
- it(':ios: side menu visibility - right', async () => {
- await elementById(testIDs.TAB_BASED_APP_SIDE_BUTTON).tap();
- await elementById(testIDs.SHOW_RIGHT_SIDE_MENU_BUTTON).tap();
- await expect(elementById(testIDs.HIDE_RIGHT_SIDE_MENU_BUTTON)).toBeVisible();
- await elementById(testIDs.HIDE_RIGHT_SIDE_MENU_BUTTON).tap();
- await expect(elementById(testIDs.CENTERED_TEXT_HEADER)).toBeVisible();
- });
-
- it(':ios: set right buttons', async () => {
- await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
- await expect(elementById('buttonOne')).toBeVisible();
- await elementById('buttonOne').tap();
- await expect(elementById('buttonTwo')).toBeVisible();
- await elementById('buttonTwo').tap();
- await expect(elementById('buttonOne')).toBeVisible();
- });
-
- it('set left buttons', async () => {
- await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
- await expect(elementById('buttonLeft')).toBeVisible();
- });
-
- it('tab bar items visibility', async () => {
- await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
- await expect(elementById(testIDs.FIRST_TAB_BAR_BUTTON)).toBeVisible();
- await expect(elementById(testIDs.SECOND_TAB_BAR_BUTTON)).toBeVisible();
- });
-
- it('default options should apply to all screens in stack', async () => {
- await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
- await elementById(testIDs.PUSH_DEFAULT_OPTIONS_BUTTON).tap();
- await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeNotVisible();
- await elementById(testIDs.PUSH_BUTTON).tap();
- await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeNotVisible();
- });
-
- it('default options should not override static options', async () => {
- await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
- await elementById(testIDs.PUSH_DEFAULT_OPTIONS_BUTTON).tap();
- await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeNotVisible();
- await elementById(testIDs.POP_BUTTON).tap();
- await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeVisible();
- });
-
- it('supports user-provided id', async () => {
- await elementById(testIDs.PROVIDED_ID).tap();
- await expect(elementByLabel('User provided id')).toBeVisible();
- });
- });
|