123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- const Utils = require('./Utils');
- const Android = require('./AndroidUtils');
- const TestIDs = require('../playground/src/testIDs');
-
- const { elementById, elementByLabel } = Utils;
-
- describe('Options', () => {
- beforeEach(async () => {
- await device.relaunchApp();
- await elementById(TestIDs.OPTIONS_TAB).tap();
- });
-
- it('declare options on a component', async () => {
- await expect(elementByLabel('Styling Options')).toBeVisible();
- });
-
- it('change title on component component', async () => {
- await expect(elementByLabel('Styling Options')).toBeVisible();
- await elementById(TestIDs.CHANGE_TITLE_BTN).tap();
- await expect(elementByLabel('Title Changed')).toBeVisible();
- });
-
- it('hides TopBar when pressing on Hide TopBar and shows it when pressing on Show TopBar', async () => {
- await elementById(TestIDs.HIDE_TOP_BAR_BTN).tap();
- await expect(elementById(TestIDs.TOP_BAR)).toBeNotVisible();
- await elementById(TestIDs.SHOW_TOP_BAR_BTN).tap();
- await expect(elementById(TestIDs.TOP_BAR)).toBeVisible();
- });
-
- it('sets right buttons', async () => {
- await expect(elementById(TestIDs.BUTTON_ONE)).toBeVisible();
- await expect(elementById(TestIDs.ROUND_BUTTON)).toBeVisible();
- });
-
- it('set left buttons', async () => {
- await expect(elementById(TestIDs.LEFT_BUTTON)).toBeVisible();
- });
-
- it('pass props to custom button component', async () => {
- await expect(elementByLabel('Two')).toExist();
- });
-
- it('pass props to custom button component should exist after push pop', async () => {
- await expect(elementByLabel('Two')).toExist();
- await elementById(TestIDs.PUSH_BTN).tap();
- await elementById(TestIDs.POP_BTN).tap();
- await expect(elementByLabel('Two')).toExist();
- });
-
- it('custom button is clickable', async () => {
- await elementByLabel('Two').tap();
- await expect(elementByLabel('Thanks for that :)')).toExist();
- });
-
- it('default options should apply to all screens in stack', async () => {
- await elementById(TestIDs.HIDE_TOPBAR_DEFAULT_OPTIONS).tap();
- await expect(elementById(TestIDs.TOP_BAR)).toBeVisible();
- await elementById(TestIDs.PUSH_BTN).tap();
- await expect(elementById(TestIDs.PUSHED_SCREEN_HEADER)).toBeNotVisible();
- await elementById(TestIDs.PUSH_BTN).tap();
- await expect(elementById(TestIDs.PUSHED_SCREEN_HEADER)).toBeNotVisible();
- });
-
- it('default options should not override static options', async () => {
- await elementById(TestIDs.HIDE_TOPBAR_DEFAULT_OPTIONS).tap();
- await elementById(TestIDs.PUSH_BTN).tap();
- await elementById(TestIDs.POP_BTN).tap();
- await expect(elementById(TestIDs.TOP_BAR)).toBeVisible();
- await expect(elementByLabel('Styling Options')).toBeVisible();
- });
-
- it('set title component', async () => {
- await elementById(TestIDs.SET_REACT_TITLE_VIEW).tap();
- await expect(elementByLabel('Press Me')).toBeVisible();
- });
-
- it('set title after setting react component', async () => {
- await elementById(TestIDs.SET_REACT_TITLE_VIEW).tap();
- await expect(elementByLabel('Press Me')).toBeVisible();
- await elementById(TestIDs.CHANGE_TITLE_BTN).tap();
- await expect(elementByLabel('Title Changed')).toBeVisible();
- });
-
- it('Popping screen with yellow box should not crash', async () => {
- await elementById(TestIDs.SHOW_YELLOW_BOX_BTN).tap();
- await elementById(TestIDs.PUSH_BTN).tap();
- await elementById(TestIDs.POP_BTN).tap();
- await expect(elementByLabel('Styling Options')).toBeVisible();
- });
-
- it(':ios: Reseting buttons should unmount button react view', async () => {
- await elementById(TestIDs.SHOW_LIFECYCLE_BTN).tap();
- await elementById(TestIDs.RESET_BUTTONS).tap();
- await expect(elementByLabel('Button component unmounted')).toBeVisible();
- });
-
- xit('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)).toBeVisible();
- await element(by.id(TestIDs.SCROLLVIEW_ELEMENT)).swipe('up', 'slow');
- await expect(elementById(TestIDs.TOP_BAR)).toBeNotVisible();
- await element(by.id(TestIDs.SCROLLVIEW_ELEMENT)).swipe('down', 'fast');
- await expect(elementById(TestIDs.TOP_BAR)).toBeVisible();
- });
- });
|