mockaton 8.1.2 → 8.1.3
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/package.json +8 -3
- package/src/Dashboard.js +5 -3
- package/ui-tests/_setup.js +32 -0
- package/ui-tests/bulk-select.test.js +10 -0
- package/ui-tests/bulk-select.vp1024x800.dark.gold.png +0 -0
- package/ui-tests/bulk-select.vp1024x800.light.gold.png +0 -0
- package/ui-tests/initial-dashboard-state.test.js +4 -0
- package/ui-tests/initial-dashboard-state.vp1024x800.dark.gold.png +0 -0
- package/ui-tests/initial-dashboard-state.vp1024x800.light.gold.png +0 -0
- package/ui-tests/payload-viewer-formats-json.test.js +9 -0
- package/ui-tests/payload-viewer-formats-json.vp1024x800.dark.gold.png +0 -0
- package/ui-tests/payload-viewer-formats-json.vp1024x800.light.gold.png +0 -0
- package/ui-tests/payload-viewer-renders-images.test.js +9 -0
- package/ui-tests/payload-viewer-renders-images.vp1024x800.dark.gold.png +0 -0
- package/ui-tests/payload-viewer-renders-images.vp1024x800.light.gold.png +0 -0
- package/ui-tests/select-mock-variant.test.js +10 -0
- package/ui-tests/select-mock-variant.vp1024x800.dark.gold.png +0 -0
- package/ui-tests/select-mock-variant.vp1024x800.light.gold.png +0 -0
package/package.json
CHANGED
|
@@ -2,14 +2,19 @@
|
|
|
2
2
|
"name": "mockaton",
|
|
3
3
|
"description": "A deterministic server-side for developing and testing frontend clients",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "8.1.
|
|
5
|
+
"version": "8.1.3",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"types": "index.d.ts",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"repository": "https://github.com/ericfortis/mockaton",
|
|
10
10
|
"scripts": {
|
|
11
|
-
"test": "node --test",
|
|
11
|
+
"test": "node --test src/**.test.js",
|
|
12
12
|
"demo": "node _usage_example.js",
|
|
13
|
-
"demo:ts": "node --import=tsx _usage_example.js"
|
|
13
|
+
"demo:ts": "node --import=tsx _usage_example.js",
|
|
14
|
+
"demo:test-ui": "node --test --import=./ui-tests/_setup.js --experimental-test-isolation=none \"./ui-tests/**/*.test.js\""
|
|
15
|
+
},
|
|
16
|
+
"optionalDependencies": {
|
|
17
|
+
"puppeteer": "23.7.1",
|
|
18
|
+
"pixaton": "0.1.0"
|
|
14
19
|
}
|
|
15
20
|
}
|
package/src/Dashboard.js
CHANGED
|
@@ -94,8 +94,8 @@ function CookieSelector({ list }) {
|
|
|
94
94
|
title: disabled ? Strings.cookie_disabled_title : '',
|
|
95
95
|
onChange
|
|
96
96
|
},
|
|
97
|
-
list.map(([
|
|
98
|
-
r('option', { value
|
|
97
|
+
list.map(([value, selected]) =>
|
|
98
|
+
r('option', { value, selected }, value)))))
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
|
|
@@ -113,6 +113,7 @@ function BulkSelector({ comments }) {
|
|
|
113
113
|
r('label', null,
|
|
114
114
|
r('span', null, Strings.bulk_select_by_comment),
|
|
115
115
|
r('select', {
|
|
116
|
+
'data-qaid': 'BulkSelector',
|
|
116
117
|
autocomplete: 'off',
|
|
117
118
|
disabled,
|
|
118
119
|
title: disabled ? Strings.bulk_select_by_comment_disabled_title : '',
|
|
@@ -280,13 +281,14 @@ function MockSelector({ broker }) {
|
|
|
280
281
|
}
|
|
281
282
|
|
|
282
283
|
const selected = broker.currentMock.file
|
|
283
|
-
const { status } = parseFilename(selected)
|
|
284
|
+
const { status, urlMask } = parseFilename(selected)
|
|
284
285
|
const files = broker.mocks.filter(item =>
|
|
285
286
|
status === 500 ||
|
|
286
287
|
!item.includes(DEFAULT_500_COMMENT))
|
|
287
288
|
|
|
288
289
|
return (
|
|
289
290
|
r('select', {
|
|
291
|
+
'data-qaid': urlMask,
|
|
290
292
|
autocomplete: 'off',
|
|
291
293
|
className: className(selected === files[0], status),
|
|
292
294
|
disabled: files.length <= 1,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { after } from 'node:test'
|
|
2
|
+
import { launch } from 'puppeteer'
|
|
3
|
+
import {
|
|
4
|
+
removeDiffsAndCandidates,
|
|
5
|
+
testPixels as _testPixels,
|
|
6
|
+
diffServer
|
|
7
|
+
} from 'pixaton'
|
|
8
|
+
import { Commander } from '../index.js'
|
|
9
|
+
|
|
10
|
+
// Before running these tests you need to spin up the demo:
|
|
11
|
+
// npm run demo
|
|
12
|
+
|
|
13
|
+
const MOCKATON_ADDR = 'http://localhost:2345'
|
|
14
|
+
const mockaton = new Commander(MOCKATON_ADDR)
|
|
15
|
+
|
|
16
|
+
const testsDir = import.meta.dirname
|
|
17
|
+
|
|
18
|
+
removeDiffsAndCandidates(testsDir)
|
|
19
|
+
const browser = await launch({ headless: true })
|
|
20
|
+
const page = await browser.newPage()
|
|
21
|
+
|
|
22
|
+
after(() => {
|
|
23
|
+
browser?.close()
|
|
24
|
+
diffServer(testsDir)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export function testPixels(testFileName, options = {}) {
|
|
28
|
+
options.beforeSuite = async () => await mockaton.reset()
|
|
29
|
+
options.viewports ??= [{ width: 1024, height: 800 }]
|
|
30
|
+
options.colorSchemes ??= ['light', 'dark']
|
|
31
|
+
_testPixels(page, testFileName, MOCKATON_ADDR + '/mockaton', 'body', options)
|
|
32
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|