Back to home

detox/

mocha

Version: 0.0.10

Last Updated: Unknown


Lift - Mocha

Node scaffold for CircleCi. Acts as if you will be using surge for staging and AWS S3 for production.

Prereqs

Make sure you get the binary required. Follow https://github.com/wix/Detox/blob/master/docs/Guide.Expo.md.

package.json

Add the following to the scripts file:

"e2e": "detox test --configuration ios.sim --reuse", "e2e:verbose": "detox test --loglevel verbose --reuse --configuration ios.sim --debug-synchronization 1000"

Add the following under the detox key:

"detox": { "configurations": { "ios.sim": { "binaryPath": "bin/Exponent.app", "type": "ios.simulator", "name": "iPhone 7" } } }

Layout

# key name detox: # building with mocha - mocha: tests: - homeTab: - name: 'ListItemTwo testing' components: - ListItemTwo actions: - exist: Home - waitFor: ListItemTwo - tap: ListItemTwo - tapVar: 'ListItemTwoCopy.items[1].id' - waitFor: ItemDetail - exist: ItemDetail - name: 'ListItemThree testing' components: - ListItemThree actions: - exist: Home - waitFor: ListItemThree - tap: ListItemThree - tapVar: 'ListItemThree.items[2].id' - waitFor: ItemDetail - exist: ItemDetail - name: 'ListItemSix testing' components: - ListItemSix actions: - exist: Home - waitFor: ListItemSix - tap: ListItemSix - tapVar: 'ListItemSix.items[2].id' - waitFor: ItemDetail - exist: ItemDetail - tabs: - name: 'Testing the tabs' actions: - exist: Home - tap: 'Login' - tap: 'Onboarding' - tap: 'Graphs' - tap: 'Other' - tap: 'Actions' - tap: 'Lists' - exist: Home

Module files

1const {reloadApp} = require('detox-expo-helpers');
2
3<%_ if (typeof components !== 'undefined') components.forEach(function(d){ _%>
4const <%= d %>Copy = require('../app/components/<%= d %>/copy.json');
5<%_ }); _%>
6
7describe('<%= filename %>', () => {
8 beforeEach(async() => {
9 await reloadApp();
10 });
11 <%_ if (typeof specs !== 'undefined') specs.forEach(function(spec){ _%>
12 it('<%= spec.name %>', async() => {
13 <%_ if (typeof spec.actions !== 'undefined') spec.actions.forEach(function(d){ _%>
14 <%_ if (Object.keys(d)[0] === 'exist') { _%>await expect(element(by.id('<%= d[Object.keys(d)[0]] %>'))).toExist();<%_ } _%>
15 <%_ if (Object.keys(d)[0] === 'waitFor') { _%>await waitFor(element(by.id('<%= d[Object.keys(d)[0]] %>'))).toExist();<%_ } _%>
16 <%_ if (Object.keys(d)[0] === 'tap') { _%>await element(by.id('<%= d[Object.keys(d)[0]] %>')).tap();<%_ } _%>
17 <%_ if (Object.keys(d)[0] === 'tapText') { _%>await element(by.text('<%= d[Object.keys(d)[0]] %>')).tap();<%_ } _%>
18 <%_ if (Object.keys(d)[0] === 'tapVar') { _%>await element(by.id(<%= d[Object.keys(d)[0]] %>)).tap();<%_ } _%>
19 <%_ }); _%>
20 });
21 <%_ }); _%>
22});

Install


Lift generate


Repository

https://github.com/okeeffed/pkg-lift-detox

Sections