react-native-builder-bob icon indicating copy to clipboard operation
react-native-builder-bob copied to clipboard

automated-testing with jasmine / detox

Open wolverineks opened this issue 5 years ago • 2 comments

Feature Request

automated-testing with jasmine / detox

Why it is needed

expo project has 2 apps they use for automated e2e testing, for native changes they use bare-expo and for javascript changes they use test-suite

ive been working on getting this up and running for react-native-camera https://github.com/react-native-community/react-native-camera/issues/2760

is there any interest in adding something like this to the bob template?

Possible implementation

im working on an implementation here

Code sample

i imagine it could something like

import TestSuite from "react-native-test-suite"

...somewhere in the example app
<TestSuite tests={tests} />
...

with a test being written like

const Photos: TestMaker = ({render}) => (tester: Tester) => {
  const {describe, it, expect} = tester;
  const renderCamera = makeRenderCamera(render);

  describe('getAvailablePictureSizes', () => {
    it('should resolve to an array of strings', async () => {
      const camera = await renderCamera();
      const ratios = await camera.getAvailablePictureSizes();

      expect(ratios).toBeInstanceOf(Array);
      expect(ratios.length).toBeGreaterThan(0);
    });
  });
}

and a single detox test that waits for the test suite to complete, then assert that status === "PASSED" or something like that

wolverineks avatar Mar 26 '20 15:03 wolverineks

Would be great if you can send a PR to add it. I didn't have enough time to set it up.

satya164 avatar Mar 26 '20 16:03 satya164

I would like to take a look on it

troZee avatar Apr 12 '21 19:04 troZee