wswebcreation / webdriver-image-comparison

MIT License
43 stars 36 forks source link

clearRuntimeFolder clears for every driver #108

Open wswebcreation opened 2 years ago

wswebcreation commented 2 years ago

Environment (please complete the following information): doesn't matter

Config of the automation framework + plugin

config.services = [
    [
        WdioImageComparisonService.default,
        {
            baselineFolder: join(process.cwd(), './localBaseline/'),
            debug: true,
            formatImageName: '{tag}-{logName}-{width}x{height}',
            screenshotPath: join(process.cwd(), '.tmp/'),
            autoSaveBaseline: true,
            savePerInstance: true,
            blockOutStatusBar: true,
            blockOutToolBar: true,
            clearRuntimeFolder: true,
        },
    ],
]

Describe the bug When clearRuntimeFolder: true is clears for every instance meaning all folders will be removed during initialisation for each instance. This will lead to folders not holds images of all instances

To Reproduce See logs below

Expected behavior Only clear once. This might mean that the cleaning feature needs to be removed from this module and be added to wdio-image-comparison-service because this module doesn't have access to the hooks for WDIO

Log

yarn test.local.desktop               
yarn run v1.22.17
warning ../../../../package.json: No license field
$ wdio tests/configs/wdio.local.desktop.conf.js

Execution of 4 workers started at 2022-07-24T08:54:40.512Z

##############################
!!CLEARING!!
##############################

Failed to connect to selenium. Attempts left: 25 
 connect ECONNREFUSED 127.0.0.1:4444
[0-3] 
[0-3] 
[0-3] 
[0-3] ##############################
[0-3] !!CLEARING!!
[0-3] ##############################
[0-3] 
[0-3] 
[0-3] 
[0-2] 
[0-2] 
[0-2] 
[0-2] ##############################
[0-2] !!CLEARING!!
[0-2] ##############################
[0-2] 
[0-2] 
[0-2] 
[0-1] 
[0-1] 
[0-1] 
[0-1] ##############################
[0-1] !!CLEARING!!
[0-1] ##############################
[0-1] 
[0-1] 
[0-1] 
[0-0] 
[0-0] 
[0-0] 
[0-0] ##############################
[0-0] !!CLEARING!!
[0-0] ##############################
[0-0] 
[0-0] 
[0-0] 
[0-3] RUNNING in chrome - /tests/specs/saveMethodsFolders.spec.js
[0-1] RUNNING in chrome - /tests/specs/desktop.spec.js
[0-2] RUNNING in chrome - /tests/specs/checkMethodsFolders.spec.js
[0-0] RUNNING in chrome - /tests/specs/basics.spec.js
[0-2] PASSED in chrome - /tests/specs/checkMethodsFolders.spec.js
[0-0] PASSED in chrome - /tests/specs/basics.spec.js
[0-1] PASSED in chrome - /tests/specs/desktop.spec.js
[0-3] PASSED in chrome - /tests/specs/saveMethodsFolders.spec.js

 "spec" Reporter:
------------------------------------------------------------------
[chrome 103.0.5060.134 mac os x #0-2] Running: chrome (v103.0.5060.134) on mac os x
[chrome 103.0.5060.134 mac os x #0-2] Session ID: 3555c14211b11b6f3c19e04e160d75e6
[chrome 103.0.5060.134 mac os x #0-2]
[chrome 103.0.5060.134 mac os x #0-2] » /tests/specs/checkMethodsFolders.spec.js
[chrome 103.0.5060.134 mac os x #0-2] wdio-image-comparison-service check methods folder options
[chrome 103.0.5060.134 mac os x #0-2]     checkFullPageScreen method with folder options
[chrome 103.0.5060.134 mac os x #0-2]        ✓ should set all folders using method options
[chrome 103.0.5060.134 mac os x #0-2]
[chrome 103.0.5060.134 mac os x #0-2]     checkScreen method with folder options
[chrome 103.0.5060.134 mac os x #0-2]        ✓ should set all folders using checkScreen method options
[chrome 103.0.5060.134 mac os x #0-2]
[chrome 103.0.5060.134 mac os x #0-2]     checkElement method with folder options
[chrome 103.0.5060.134 mac os x #0-2]        ✓ should set all folders using checkElement method options
[chrome 103.0.5060.134 mac os x #0-2]
[chrome 103.0.5060.134 mac os x #0-2] 3 passing (14.3s)
------------------------------------------------------------------
[chrome 103.0.5060.134 mac os x #0-0] Running: chrome (v103.0.5060.134) on mac os x
[chrome 103.0.5060.134 mac os x #0-0] Session ID: f0cb4ae0c241cbf2707b04caa3956439
[chrome 103.0.5060.134 mac os x #0-0]
[chrome 103.0.5060.134 mac os x #0-0] » /tests/specs/basics.spec.js
[chrome 103.0.5060.134 mac os x #0-0] wdio-image-comparison-service basics
[chrome 103.0.5060.134 mac os x #0-0]     save methods
[chrome 103.0.5060.134 mac os x #0-0]        ✓ should do a save screen
[chrome 103.0.5060.134 mac os x #0-0]        ✓ should do a save element
[chrome 103.0.5060.134 mac os x #0-0]        ✓ should save a fullpage screenshot
[chrome 103.0.5060.134 mac os x #0-0]
[chrome 103.0.5060.134 mac os x #0-0]     check methods
[chrome 103.0.5060.134 mac os x #0-0]        ✓ should fail comparing with a baseline
[chrome 103.0.5060.134 mac os x #0-0]
[chrome 103.0.5060.134 mac os x #0-0] 4 passing (12.8s)
------------------------------------------------------------------
[chrome 103.0.5060.134 mac os x #0-1] Running: chrome (v103.0.5060.134) on mac os x
[chrome 103.0.5060.134 mac os x #0-1] Session ID: c1c95a4e424646897dcb2c06f1648c4b
[chrome 103.0.5060.134 mac os x #0-1]
[chrome 103.0.5060.134 mac os x #0-1] » /tests/specs/desktop.spec.js
[chrome 103.0.5060.134 mac os x #0-1] wdio-image-comparison-service desktop
[chrome 103.0.5060.134 mac os x #0-1]     compare element
[chrome 103.0.5060.134 mac os x #0-1]        ✓ should compare successful with a baseline
[chrome 103.0.5060.134 mac os x #0-1]
[chrome 103.0.5060.134 mac os x #0-1]     compare full page
[chrome 103.0.5060.134 mac os x #0-1]        ✓ should compare successful with a full page desktop baseline
[chrome 103.0.5060.134 mac os x #0-1]
[chrome 103.0.5060.134 mac os x #0-1]     compare tabbable
[chrome 103.0.5060.134 mac os x #0-1]        ✓ should compare successful with a tabbable desktop baseline
[chrome 103.0.5060.134 mac os x #0-1]
[chrome 103.0.5060.134 mac os x #0-1] 3 passing (19s)
------------------------------------------------------------------
[chrome 103.0.5060.134 mac os x #0-3] Running: chrome (v103.0.5060.134) on mac os x
[chrome 103.0.5060.134 mac os x #0-3] Session ID: 3ae4f4e26035640d7503f0616cb649cc
[chrome 103.0.5060.134 mac os x #0-3]
[chrome 103.0.5060.134 mac os x #0-3] » /tests/specs/saveMethodsFolders.spec.js
[chrome 103.0.5060.134 mac os x #0-3] wdio-image-comparison-service save methods folder options
[chrome 103.0.5060.134 mac os x #0-3]     saveFullPageScreen method with folder options
[chrome 103.0.5060.134 mac os x #0-3]        ✓ should set folders using method options
[chrome 103.0.5060.134 mac os x #0-3]        ✓ should set folders using default options
[chrome 103.0.5060.134 mac os x #0-3]
[chrome 103.0.5060.134 mac os x #0-3]     saveScreen method with folder options
[chrome 103.0.5060.134 mac os x #0-3]        ✓ should set folders using saveScreen method options
[chrome 103.0.5060.134 mac os x #0-3]        ✓ should set folders using saveScreen default options
[chrome 103.0.5060.134 mac os x #0-3]
[chrome 103.0.5060.134 mac os x #0-3]     saveElement method with folder options
[chrome 103.0.5060.134 mac os x #0-3]        ✓ should set folders using saveElement method options
[chrome 103.0.5060.134 mac os x #0-3]        ✓ should set folders using saveElement default options
[chrome 103.0.5060.134 mac os x #0-3]
[chrome 103.0.5060.134 mac os x #0-3] 6 passing (22s)

Spec Files:      4 passed, 4 total (100% completed) in 00:00:35 

✨  Done in 41.23s.