How to use the cavy.TestHookStore function in cavy

To help you get started, we’ve selected a few cavy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pixielabs / cavy / test / CavyTester / src / App.js View on Github external
const scenarioRoutes = scenarios.reduce((acc, scenario) => {
  acc[scenario.key] = {
    screen: scenario.Screen,
    navigationOptions: { title: scenario.label },
  };
  return acc;
}, {});

const MainNavigator = createStackNavigator({
  Home: { screen: HomeScreen },
  ...scenarioRoutes,
});

const AppContainer = createAppContainer(MainNavigator);

const store = new TestHookStore();

const navigateAndRun = (scenario) => {
  console.log('in navigateAndRun')
  return (spec) => {
    // Override `it` so that it presses into the scene for this test first.
    const origIt = spec.it;
    spec.it = (label, f) => {
      origIt.call(spec, label, async () => {
        await spec.press(scenario.key);
        await f();
      });
    };

    scenario.spec(spec);
  }
}
github berty / berty / client / react-native / common / integration / AppWrapper.js View on Github external
import React, { Component } from 'react'
import { Platform } from 'react-native'
import App from '../components/App'
import { Tester, TestHookStore } from 'cavy'

import Onboarding from './tests/Onboarding.js'
import AppLoading from './tests/AppLoading.js'
import Contact from './tests/Contact.js'
import Chat from './tests/Chat.js'
import DevTools from './tests/DevTools.js'

const testHookStore = new TestHookStore()

const redirectConsoleLogsToTerminal = () => {
  if (Platform.OS !== 'web') {
    let DEBUG_LEVEL = 0
    let INFO_LEVEL = 1
    let WARN_LEVEL = 2
    let ERROR_LEVEL = 3

    console.log = log => global.nativeLoggingHook(log, DEBUG_LEVEL)
    console.info = log => global.nativeLoggingHook(log, INFO_LEVEL)
    console.warn = log => global.nativeLoggingHook(log, WARN_LEVEL)
    console.error = log => global.nativeLoggingHook(log, ERROR_LEVEL)
  }
}

const getReportServerInfos = () => {
github berty / berty / client / react-native / app / main / integration / AppWrapper.js View on Github external
import React, { Component } from 'react'
import { Platform } from 'react-native'
import { Tester, TestHookStore } from 'cavy'

import Onboarding from './tests/Onboarding.js'
import AppLoading from './tests/AppLoading.js'
import Contact from './tests/Contact.js'
import Chat from './tests/Chat.js'
import DevTools from './tests/DevTools.js'

const testHookStore = new TestHookStore()

const redirectConsoleLogsToTerminal = () => {
  if (Platform.OS !== 'web') {
    let DEBUG_LEVEL = 0
    let INFO_LEVEL = 1
    let WARN_LEVEL = 2
    let ERROR_LEVEL = 3

    console.log = log => global.nativeLoggingHook(log, DEBUG_LEVEL)
    console.info = log => global.nativeLoggingHook(log, INFO_LEVEL)
    console.warn = log => global.nativeLoggingHook(log, WARN_LEVEL)
    console.error = log => global.nativeLoggingHook(log, ERROR_LEVEL)
  }
}

const getReportServerInfos = () => {
github pixielabs / cavy / sample-app / CavyDirectory / index.js View on Github external
/**
 * @format
 */

import React, { Component } from 'react';
import {AppRegistry} from 'react-native';
import {name as appName} from './app.json';

import { Tester, TestHookStore } from 'cavy';

import EmployeeDirectoryApp from './app/EmployeeDirectoryApp';

import EmployeeListSpec from './specs/EmployeeListSpec';

const testHookStore = new TestHookStore();

class AppWrapper extends Component {
  render() {
    return (
      
        
      
    );
  }
}

AppRegistry.registerComponent(appName, () => AppWrapper);
github pixielabs / cavy / sample-app / CavyDirectory / index.android.js View on Github external
/** @format */

import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';

import { Tester, TestHookStore } from 'cavy';

import EmployeeDirectoryApp from './app/EmployeeDirectoryApp';

import EmployeeListSpec from './specs/EmployeeListSpec';

const testHookStore = new TestHookStore();

class AppWrapper extends Component {
  render() {
    return (
      
        
      
    );
  }
}

AppRegistry.registerComponent(appName, () => AppWrapper);

cavy

An integration test framework for React Native.

MIT
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis