@applitools/eyes-cypress 3.29.0 → 3.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +62 -22
- package/dist/plugin/hooks.js +2 -2
- package/dist/plugin/pluginExport.js +1 -1
- package/dist/plugin/server.js +4 -7
- package/package.json +15 -22
- package/src/browser/commands.js +43 -30
- package/src/browser/eyesCheckMapping.js +75 -37
- package/src/browser/eyesOpenMapping.js +21 -27
- package/src/expose.ts +5 -3
- package/src/plugin/hooks.ts +2 -2
- package/src/plugin/pluginExport.ts +1 -1
- package/src/plugin/server.ts +4 -9
- package/src/setup/handlePlugin.js +1 -1
- package/types/expose.d.ts +542 -0
- package/types/index.d.ts +51 -0
|
@@ -14,8 +14,6 @@ const batchPropertiesRetriever = (args, appliConfFile) => {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
function eyesOpenMapValues({args, appliConfFile, testName, shouldUseBrowserHooks}) {
|
|
17
|
-
let browsersInfo = args.browser || appliConfFile.browser
|
|
18
|
-
let accessibilitySettings = args.accessibilityValidation || appliConfFile.accessibilityValidation
|
|
19
17
|
const batchProperties = batchPropertiesRetriever(args, appliConfFile)
|
|
20
18
|
const batch = {
|
|
21
19
|
id: batchProperties('batchId', 'id'),
|
|
@@ -45,18 +43,7 @@ function eyesOpenMapValues({args, appliConfFile, testName, shouldUseBrowserHooks
|
|
|
45
43
|
'batchSequenceName',
|
|
46
44
|
]
|
|
47
45
|
|
|
48
|
-
if (browsersInfo) {
|
|
49
|
-
if (Array.isArray(browsersInfo)) {
|
|
50
|
-
for (const [index, value] of browsersInfo.entries()) {
|
|
51
|
-
browsersInfo[index] = fillDefaultBrowserName(value)
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
browsersInfo = [fillDefaultBrowserName(browsersInfo)]
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
46
|
const defaultMatchSettings = {
|
|
59
|
-
accessibilitySettings,
|
|
60
47
|
matchLevel: args.matchLevel || appliConfFile.matchLevel,
|
|
61
48
|
ignoreCaret: args.ignoreCaret || appliConfFile.ignoreCaret,
|
|
62
49
|
useDom: args.useDom || appliConfFile.useDom,
|
|
@@ -75,27 +62,34 @@ function eyesOpenMapValues({args, appliConfFile, testName, shouldUseBrowserHooks
|
|
|
75
62
|
}
|
|
76
63
|
|
|
77
64
|
const mappedArgs = {
|
|
65
|
+
...defaultMatchSettings,
|
|
78
66
|
...args,
|
|
79
|
-
browsersInfo,
|
|
80
|
-
defaultMatchSettings,
|
|
81
67
|
batch,
|
|
82
68
|
}
|
|
69
|
+
if (typeof args.viewportSize !== 'undefined' || typeof args.environment !== 'undefined') {
|
|
70
|
+
mappedArgs.environment = {viewportSize: args.viewportSize, ...args.environment}
|
|
71
|
+
}
|
|
83
72
|
|
|
84
|
-
return Object.assign({testName,
|
|
73
|
+
return Object.assign({testName, keepBatchOpen: !shouldUseBrowserHooks}, appliConfFileCopy, mappedArgs)
|
|
85
74
|
}
|
|
86
75
|
|
|
87
|
-
function
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
76
|
+
function eyesOpenToCheckMapValues(args) {
|
|
77
|
+
const {browser, waitBeforeCapture, layoutBreakpoints, accessibilityValidation} = args
|
|
78
|
+
|
|
79
|
+
const openToCheckSettingsArgs = {
|
|
80
|
+
browser,
|
|
81
|
+
waitBeforeCapture,
|
|
82
|
+
layoutBreakpoints,
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (accessibilityValidation) {
|
|
86
|
+
const {level, guidelinesVersion} = accessibilityValidation
|
|
87
|
+
openToCheckSettingsArgs.accessibilitySettings = {
|
|
88
|
+
level,
|
|
89
|
+
version: guidelinesVersion,
|
|
94
90
|
}
|
|
95
|
-
return browser
|
|
96
|
-
} else {
|
|
97
|
-
return browser
|
|
98
91
|
}
|
|
92
|
+
return openToCheckSettingsArgs
|
|
99
93
|
}
|
|
100
94
|
|
|
101
|
-
module.exports = {eyesOpenMapValues}
|
|
95
|
+
module.exports = {eyesOpenMapValues, eyesOpenToCheckMapValues}
|
package/src/expose.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
**/
|
|
9
9
|
/// <reference types="cypress" />
|
|
10
10
|
import type * as api from '@applitools/eyes-api'
|
|
11
|
+
import type * as core from '@applitools/core'
|
|
11
12
|
import {type EyesSelector, type TestResultsStatus} from '@applitools/eyes-api'
|
|
12
13
|
|
|
13
14
|
export type {EyesSelector, TestResultsStatus}
|
|
@@ -15,11 +16,12 @@ export type {EyesSelector, TestResultsStatus}
|
|
|
15
16
|
type MaybeArray<T> = T | T[]
|
|
16
17
|
|
|
17
18
|
type LegacyRegion = {left: number; top: number; width: number; height: number}
|
|
18
|
-
type Selector = {selector: string; type?: 'css' | 'xpath'; nodeType?: 'element' | 'shadow-root'} |
|
|
19
|
+
type Selector = {selector: string; type?: 'css' | 'xpath'; nodeType?: 'element' | 'shadow-root'} | string
|
|
19
20
|
type Element = HTMLElement | JQuery<HTMLElement>
|
|
20
21
|
type ElementWithOptions = {element: Element; regionId?: string; padding?: any}
|
|
22
|
+
type SpecType = core.SpecType<unknown, unknown, Element, Selector>
|
|
21
23
|
|
|
22
|
-
export type CypressCheckSettings = api.CheckSettingsAutomationPlain<
|
|
24
|
+
export type CypressCheckSettings = api.CheckSettingsAutomationPlain<SpecType> & {
|
|
23
25
|
tag?: CypressCheckSettings['name']
|
|
24
26
|
|
|
25
27
|
target?: 'window' | 'region'
|
|
@@ -47,7 +49,7 @@ export type CypressCheckSettings = api.CheckSettingsAutomationPlain<Element, Sel
|
|
|
47
49
|
ignoreCaret?: boolean
|
|
48
50
|
ignoreDisplacements?: boolean
|
|
49
51
|
}
|
|
50
|
-
export type CypressEyesConfig = api.ConfigurationPlain<
|
|
52
|
+
export type CypressEyesConfig = api.ConfigurationPlain<SpecType> & {
|
|
51
53
|
browser?: MaybeArray<
|
|
52
54
|
| NonNullable<CypressEyesConfig['browsersInfo']>[number]
|
|
53
55
|
| {deviceName: string; screenOrientation?: api.ScreenOrientationPlain; name?: string}
|
package/src/plugin/hooks.ts
CHANGED
|
@@ -35,7 +35,7 @@ export default function makeGlobalRunHooks({closeManager, closeBatches, closeUni
|
|
|
35
35
|
|
|
36
36
|
let testResults
|
|
37
37
|
for (const summary of summaries) {
|
|
38
|
-
testResults = summary.results.map(({
|
|
38
|
+
testResults = summary.results.map(({result}: any) => result)
|
|
39
39
|
}
|
|
40
40
|
if (!config.appliConfFile.dontCloseBatches) {
|
|
41
41
|
await closeBatches({
|
|
@@ -47,7 +47,7 @@ export default function makeGlobalRunHooks({closeManager, closeBatches, closeUni
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
if (config.appliConfFile.tapDirPath) {
|
|
50
|
-
|
|
50
|
+
handleTestResults.handleBatchResultsFile(testResults, {
|
|
51
51
|
tapDirPath: config.appliConfFile.tapDirPath,
|
|
52
52
|
tapFileName: config.appliConfFile.tapFileName,
|
|
53
53
|
})
|
|
@@ -55,7 +55,7 @@ export default function makePluginExport({startServer, eyesConfig}: any) {
|
|
|
55
55
|
return pluginInitArgs
|
|
56
56
|
}
|
|
57
57
|
return function getCloseServer() {
|
|
58
|
-
return eyesServer.close()
|
|
58
|
+
return new Promise<void>(res => eyesServer.close(() => res()))
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
async function setupNodeEvents(
|
package/src/plugin/server.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import connectSocket, {type SocketWithUniversal} from './webSocket'
|
|
2
|
-
|
|
3
|
-
// @ts-ignore
|
|
4
|
-
import {makeServerProcess} from '@applitools/eyes-universal'
|
|
2
|
+
import {makeCoreServerProcess} from '@applitools/core'
|
|
5
3
|
import handleTestResults from './handleTestResults'
|
|
6
4
|
import path from 'path'
|
|
7
5
|
import fs from 'fs'
|
|
@@ -44,7 +42,7 @@ export default function makeStartServer({logger}: {logger: Logger}) {
|
|
|
44
42
|
forkOptions.execPath = await which('node')
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
const {port: universalPort, close: closeUniversalServer} = await
|
|
45
|
+
const {port: universalPort, close: closeUniversalServer} = await makeCoreServerProcess({
|
|
48
46
|
idleTimeout: 0,
|
|
49
47
|
shutdownMode: 'stdin',
|
|
50
48
|
forkOptions,
|
|
@@ -126,16 +124,13 @@ export default function makeStartServer({logger}: {logger: Logger}) {
|
|
|
126
124
|
function closeManager() {
|
|
127
125
|
return Promise.all(
|
|
128
126
|
managers.map(({manager, socketWithUniversal}) =>
|
|
129
|
-
socketWithUniversal.request('EyesManager.
|
|
130
|
-
manager,
|
|
131
|
-
throwErr: false,
|
|
132
|
-
}),
|
|
127
|
+
socketWithUniversal.request('EyesManager.getResults', {manager, settings: {throwErr: false}}),
|
|
133
128
|
),
|
|
134
129
|
)
|
|
135
130
|
}
|
|
136
131
|
function closeBatches(settings: any) {
|
|
137
132
|
if (socketWithUniversal)
|
|
138
|
-
return socketWithUniversal.request('Core.
|
|
133
|
+
return socketWithUniversal.request('Core.closeBatch', {settings}).catch((err: Error) => {
|
|
139
134
|
logger.log('@@@', err)
|
|
140
135
|
})
|
|
141
136
|
}
|
|
@@ -25,7 +25,7 @@ export default ${chalk.green.bold('eyesPlugin(')}definedConfig({
|
|
|
25
25
|
//...
|
|
26
26
|
})${chalk.green.bold(')')}
|
|
27
27
|
|
|
28
|
-
For more information, visit Eyes-Cypress documentation https://
|
|
28
|
+
For more information, visit Eyes-Cypress documentation https://applitools.com/docs/api-ref/sdk-api/cypress/typescript
|
|
29
29
|
`,
|
|
30
30
|
{padding: 1, borderColor: 'cyan'},
|
|
31
31
|
),
|