JSPM

cavy-extension

0.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q12445F
  • License MIT

An extension for cavy test framework for React Native.

Package Exports

  • cavy-extension

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cavy-extension) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

cavy-extension

npm version

Cavy is a cross-platform integration test framework for React Native.

Cavy-extension extends the functionality of cavy.

  • It simplied the steps in component testing and enable user only need to be focused only on authoring test spec and test pages.
  • User only need to provides a testpage, a key which associate swith the testpage. And toTestPage would help to navigate directly to the test page.
  • Allow user to extend the functionality of TestScope and provides IntelliSense when authoring spec.

Steps to authoring test case

  1. Write a simple UI test page.
export const ExampleTestPage1 = () => {
    const generateTestHook = useCavy();
    const [text, setText] = useState('');

    return <TextInput placeholder="ExampleTestpage 1"
        onChangeText={(text) => setText(text)} value={text}
        ref={generateTestHook('Example1.TextInput')} />;
};
  1. Aggregate the testpages with keys. For example: Example1
export const TestPages: Array<ITestPage> = [
    {
        key: 'Example1',
        title: 'TestExample by import {ExampleTestPage1}',
        page: ExampleTestPage1
    },
    {
        key: 'Example2',
        title: 'TestExample by import ExampleTestPage',
        page: ExaExampleTestPage2
    },
  1. Write the spec. toTestPage('Example1') helps to navigate to test page.
      await spec2.toTestPage('Example1');

Functionality of this extension

function ExampleSpec (spec: TestScope, spec2: SpecHelper) {
  spec.describe('Example 1', function () {

    spec.it('Test Example 1', async function () {
      await spec2.toTestPage('Example1');
...
    });

  });

Or

export default function (spec: TestScope) {
  let spec2: SpecHelper = new SpecHelper(spec);

  spec.describe('Sample Module', function () {

    spec.it('SampleModule', async function () {
      await spec2.toTestPage('SampleModule');
     ...
    });

  });
  • A typescript project IntelliSense for spec or spec2 in IDE.

intell

Test Example

mYtEST