File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
detox/src/artifacts/screenshot Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ const _ = require ( 'lodash' ) ;
1
2
const TwoSnapshotsPerTestPlugin = require ( '../templates/plugin/TwoSnapshotsPerTestPlugin' ) ;
2
3
3
4
/***
@@ -6,6 +7,10 @@ const TwoSnapshotsPerTestPlugin = require('../templates/plugin/TwoSnapshotsPerTe
6
7
class ScreenshotArtifactPlugin extends TwoSnapshotsPerTestPlugin {
7
8
constructor ( { api } ) {
8
9
super ( { api } ) ;
10
+
11
+ _ . defaults ( this . takeAutomaticSnapshots , {
12
+ appNotReady : true ,
13
+ } )
9
14
}
10
15
11
16
async preparePathForSnapshot ( testSummary , name ) {
Original file line number Diff line number Diff line change 1
1
const ScreenshotArtifactPlugin = require ( './ScreenshotArtifactPlugin' ) ;
2
2
3
3
describe ( 'ScreenshotArtifactPlugin' , ( ) => {
4
+ describe ( 'default options' , ( ) => {
5
+ it ( 'should have takeAutomaticSnapshots.appReady = true' , ( ) => {
6
+ const plugin = new ScreenshotArtifactPlugin ( {
7
+ api : {
8
+ userConfig : {
9
+ takeWhen : { } ,
10
+ } ,
11
+ }
12
+ } ) ;
13
+
14
+ expect ( plugin . takeAutomaticSnapshots . appNotReady ) . toBe ( true ) ;
15
+ } ) ;
16
+
17
+ it ( 'should allow to set takeAutomaticSnapshots.appReady to false' , ( ) => {
18
+ const plugin = new ScreenshotArtifactPlugin ( {
19
+ api : {
20
+ userConfig : {
21
+ takeWhen : {
22
+ appNotReady : false ,
23
+ } ,
24
+ } ,
25
+ }
26
+ } ) ;
27
+
28
+ expect ( plugin . takeAutomaticSnapshots . appNotReady ) . toBe ( false ) ;
29
+ } ) ;
30
+ } ) ;
31
+
4
32
describe ( 'static parseConfig(config)' , ( ) => {
5
33
const parseConfig = ScreenshotArtifactPlugin . parseConfig ;
6
34
You can’t perform that action at this time.
0 commit comments