html-reporter 9.9.2 → 9.10.1
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/build/gemini.d.ts +2 -0
- package/{gemini.js → build/gemini.js} +1 -1
- package/build/gemini.js.map +1 -0
- package/build/hermione.d.ts +2 -0
- package/{hermione.js → build/hermione.js} +3 -21
- package/build/hermione.js.map +1 -0
- package/build/lib/cli-commands/gui.d.ts +2 -0
- package/{lib → build/lib}/cli-commands/gui.js +5 -7
- package/build/lib/cli-commands/gui.js.map +1 -0
- package/build/lib/cli-commands/index.d.ts +3 -0
- package/{lib → build/lib}/cli-commands/index.js +1 -1
- package/build/lib/cli-commands/index.js.map +1 -0
- package/build/lib/cli-commands/merge-reports.d.ts +2 -0
- package/{lib → build/lib}/cli-commands/merge-reports.js +11 -11
- package/build/lib/cli-commands/merge-reports.js.map +1 -0
- package/build/lib/cli-commands/remove-unused-screens/index.d.ts +2 -0
- package/{lib → build/lib}/cli-commands/remove-unused-screens/index.js +61 -110
- package/build/lib/cli-commands/remove-unused-screens/index.js.map +1 -0
- package/build/lib/cli-commands/remove-unused-screens/utils.d.ts +16 -0
- package/{lib → build/lib}/cli-commands/remove-unused-screens/utils.js +10 -48
- package/build/lib/cli-commands/remove-unused-screens/utils.js.map +1 -0
- package/build/lib/common-utils.d.ts +24 -0
- package/build/lib/common-utils.js +116 -0
- package/build/lib/common-utils.js.map +1 -0
- package/build/lib/config/custom-gui-asserts.d.ts +1 -0
- package/{lib → build/lib}/config/custom-gui-asserts.js +2 -12
- package/build/lib/config/custom-gui-asserts.js.map +1 -0
- package/build/lib/config/index.d.ts +21 -0
- package/{lib → build/lib}/config/index.js +7 -32
- package/build/lib/config/index.js.map +1 -0
- package/build/lib/constants/browser.d.ts +3 -0
- package/build/lib/constants/browser.js +5 -0
- package/build/lib/constants/browser.js.map +1 -0
- package/build/lib/constants/checked-statuses.d.ts +3 -0
- package/build/lib/constants/checked-statuses.js +7 -0
- package/build/lib/constants/checked-statuses.js.map +1 -0
- package/build/lib/constants/database.d.ts +25 -0
- package/build/lib/constants/database.js +47 -0
- package/build/lib/constants/database.js.map +1 -0
- package/build/lib/constants/defaults.d.ts +18 -0
- package/{lib → build/lib}/constants/defaults.js +1 -2
- package/build/lib/constants/defaults.js.map +1 -0
- package/build/lib/constants/diff-modes.d.ts +53 -0
- package/{lib → build/lib}/constants/diff-modes.js +2 -0
- package/build/lib/constants/diff-modes.js.map +1 -0
- package/build/lib/constants/errors.d.ts +5 -0
- package/{lib → build/lib}/constants/errors.js +1 -1
- package/build/lib/constants/errors.js.map +1 -0
- package/build/lib/constants/expand-modes.d.ts +4 -0
- package/{lib → build/lib}/constants/expand-modes.js +1 -1
- package/build/lib/constants/expand-modes.js.map +1 -0
- package/build/lib/constants/extension-points.d.ts +4 -0
- package/build/lib/constants/extension-points.js +8 -0
- package/build/lib/constants/extension-points.js.map +1 -0
- package/build/lib/constants/group-tests.d.ts +7 -0
- package/{lib → build/lib}/constants/group-tests.js +2 -0
- package/build/lib/constants/group-tests.js.map +1 -0
- package/build/lib/constants/paths.d.ts +2 -0
- package/{lib → build/lib}/constants/paths.js +1 -1
- package/build/lib/constants/paths.js.map +1 -0
- package/build/lib/constants/plugin-events.d.ts +5 -0
- package/{lib → build/lib}/constants/plugin-events.js +2 -4
- package/build/lib/constants/plugin-events.js.map +1 -0
- package/build/lib/constants/save-formats.d.ts +1 -0
- package/{lib → build/lib}/constants/save-formats.js +1 -1
- package/build/lib/constants/save-formats.js.map +1 -0
- package/build/lib/constants/test-statuses.d.ts +8 -0
- package/{lib → build/lib}/constants/test-statuses.js +1 -1
- package/build/lib/constants/test-statuses.js.map +1 -0
- package/build/lib/constants/view-modes.d.ts +5 -0
- package/{lib → build/lib}/constants/view-modes.js +1 -1
- package/build/lib/constants/view-modes.js.map +1 -0
- package/build/lib/db-utils/client.d.ts +19 -0
- package/{lib → build/lib}/db-utils/client.js +18 -45
- package/build/lib/db-utils/client.js.map +1 -0
- package/build/lib/db-utils/common.d.ts +10 -0
- package/build/lib/db-utils/common.js +56 -0
- package/build/lib/db-utils/common.js.map +1 -0
- package/build/lib/db-utils/server.d.ts +16 -0
- package/{lib → build/lib}/db-utils/server.js +15 -41
- package/build/lib/db-utils/server.js.map +1 -0
- package/build/lib/gui/api/facade.d.ts +8 -0
- package/{lib → build/lib}/gui/api/facade.js +1 -4
- package/build/lib/gui/api/facade.js.map +1 -0
- package/build/lib/gui/api/index.d.ts +9 -0
- package/{lib → build/lib}/gui/api/index.js +1 -5
- package/build/lib/gui/api/index.js.map +1 -0
- package/build/lib/gui/app.d.ts +62 -0
- package/{lib → build/lib}/gui/app.js +2 -21
- package/build/lib/gui/app.js.map +1 -0
- package/build/lib/gui/constants/client-events.d.ts +6 -0
- package/{lib → build/lib}/gui/constants/client-events.js +1 -4
- package/build/lib/gui/constants/client-events.js.map +1 -0
- package/build/lib/gui/constants/custom-gui-control-types.d.ts +2 -0
- package/{lib → build/lib}/gui/constants/custom-gui-control-types.js +1 -1
- package/build/lib/gui/constants/custom-gui-control-types.js.map +1 -0
- package/build/lib/gui/constants/gui-events.d.ts +2 -0
- package/{lib → build/lib}/gui/constants/gui-events.js +1 -1
- package/build/lib/gui/constants/gui-events.js.map +1 -0
- package/build/lib/gui/constants/server.d.ts +3 -0
- package/{lib → build/lib}/gui/constants/server.js +1 -1
- package/build/lib/gui/constants/server.js.map +1 -0
- package/build/lib/gui/event-source.d.ts +6 -0
- package/{lib → build/lib}/gui/event-source.js +2 -5
- package/build/lib/gui/event-source.js.map +1 -0
- package/build/lib/gui/index.d.ts +12 -0
- package/build/lib/gui/index.js +22 -0
- package/build/lib/gui/index.js.map +1 -0
- package/build/lib/gui/routes/plugins.d.ts +2 -0
- package/{lib → build/lib}/gui/routes/plugins.js +9 -24
- package/build/lib/gui/routes/plugins.js.map +1 -0
- package/build/lib/gui/server.d.ts +8 -0
- package/{lib → build/lib}/gui/server.js +32 -51
- package/build/lib/gui/server.js.map +1 -0
- package/build/lib/gui/tool-runner/index.d.ts +123 -0
- package/{lib → build/lib}/gui/tool-runner/index.js +42 -122
- package/build/lib/gui/tool-runner/index.js.map +1 -0
- package/build/lib/gui/tool-runner/report-subscriber.d.ts +2 -0
- package/{lib → build/lib}/gui/tool-runner/report-subscriber.js +7 -30
- package/build/lib/gui/tool-runner/report-subscriber.js.map +1 -0
- package/build/lib/gui/tool-runner/runner/all-test-runner.d.ts +4 -0
- package/{lib → build/lib}/gui/tool-runner/runner/all-test-runner.js +1 -3
- package/build/lib/gui/tool-runner/runner/all-test-runner.js.map +1 -0
- package/build/lib/gui/tool-runner/runner/index.d.ts +3 -0
- package/{lib → build/lib}/gui/tool-runner/runner/index.js +1 -2
- package/build/lib/gui/tool-runner/runner/index.js.map +1 -0
- package/build/lib/gui/tool-runner/runner/runner.d.ts +6 -0
- package/{lib → build/lib}/gui/tool-runner/runner/runner.js +1 -2
- package/build/lib/gui/tool-runner/runner/runner.js.map +1 -0
- package/build/lib/gui/tool-runner/runner/specific-test-runner.d.ts +7 -0
- package/{lib → build/lib}/gui/tool-runner/runner/specific-test-runner.js +2 -8
- package/build/lib/gui/tool-runner/runner/specific-test-runner.js.map +1 -0
- package/build/lib/gui/tool-runner/utils.d.ts +7 -0
- package/{lib → build/lib}/gui/tool-runner/utils.js +11 -35
- package/build/lib/gui/tool-runner/utils.js.map +1 -0
- package/build/lib/history-utils.d.ts +1 -0
- package/{lib → build/lib}/history-utils.js +5 -20
- package/build/lib/history-utils.js.map +1 -0
- package/build/lib/local-images-saver.d.ts +4 -0
- package/build/lib/local-images-saver.js +9 -0
- package/build/lib/local-images-saver.js.map +1 -0
- package/build/lib/merge-reports/index.d.ts +4 -0
- package/{lib → build/lib}/merge-reports/index.js +3 -8
- package/build/lib/merge-reports/index.js.map +1 -0
- package/build/lib/plugin-adapter.d.ts +32 -0
- package/{lib → build/lib}/plugin-adapter.js +8 -25
- package/build/lib/plugin-adapter.js.map +1 -0
- package/build/lib/plugin-api.d.ts +57 -0
- package/{lib → build/lib}/plugin-api.js +2 -20
- package/build/lib/plugin-api.js.map +1 -0
- package/build/lib/plugin-utils.d.ts +3 -0
- package/{lib → build/lib}/plugin-utils.js +3 -5
- package/build/lib/plugin-utils.js.map +1 -0
- package/build/lib/report-builder/gui.d.ts +73 -0
- package/{lib → build/lib}/report-builder/gui.js +33 -92
- package/build/lib/report-builder/gui.js.map +1 -0
- package/build/lib/report-builder/static.d.ts +32 -0
- package/{lib → build/lib}/report-builder/static.js +25 -64
- package/build/lib/report-builder/static.js.map +1 -0
- package/build/lib/reporter-helpers.d.ts +3 -0
- package/{lib → build/lib}/reporter-helpers.js +2 -11
- package/build/lib/reporter-helpers.js.map +1 -0
- package/build/lib/server-utils.d.ts +42 -0
- package/{lib → build/lib}/server-utils.js +37 -92
- package/build/lib/server-utils.js.map +1 -0
- package/build/lib/sqlite-adapter.d.ts +78 -0
- package/{lib → build/lib}/sqlite-adapter.js +15 -56
- package/build/lib/sqlite-adapter.js.map +1 -0
- package/build/lib/static/gui.min.css +1 -0
- package/build/lib/static/gui.min.js +124 -0
- package/build/lib/static/modules/utils.d.ts +31 -0
- package/{lib → build/lib}/static/modules/utils.js +16 -56
- package/build/lib/static/modules/utils.js.map +1 -0
- package/{lib → build/lib}/static/report.min.css +1 -1
- package/build/lib/static/report.min.js +124 -0
- package/build/lib/suite-adapter.d.ts +15 -0
- package/{lib → build/lib}/suite-adapter.js +2 -18
- package/build/lib/suite-adapter.js.map +1 -0
- package/build/lib/test-adapter.d.ts +118 -0
- package/{lib → build/lib}/test-adapter.js +38 -156
- package/build/lib/test-adapter.js.map +1 -0
- package/build/lib/tests-tree-builder/base.d.ts +70 -0
- package/{lib → build/lib}/tests-tree-builder/base.js +34 -74
- package/build/lib/tests-tree-builder/base.js.map +1 -0
- package/build/lib/tests-tree-builder/gui.d.ts +47 -0
- package/{lib → build/lib}/tests-tree-builder/gui.js +12 -63
- package/build/lib/tests-tree-builder/gui.js.map +1 -0
- package/build/lib/tests-tree-builder/static.d.ts +55 -0
- package/{lib → build/lib}/tests-tree-builder/static.js +11 -42
- package/build/lib/tests-tree-builder/static.js.map +1 -0
- package/build/lib/workers/create-workers.d.ts +2 -0
- package/{lib → build/lib}/workers/create-workers.js +1 -2
- package/build/lib/workers/create-workers.js.map +1 -0
- package/build/lib/workers/worker.d.ts +1 -0
- package/build/lib/workers/worker.js +13 -0
- package/build/lib/workers/worker.js.map +1 -0
- package/build/package.json +178 -0
- package/package.json +44 -23
- package/2html-reporter.iml +0 -9
- package/CHANGELOG.md +0 -2886
- package/docs/en/html-reporter-api.md +0 -198
- package/docs/en/html-reporter-commands.md +0 -96
- package/docs/en/html-reporter-custom-gui.md +0 -99
- package/docs/en/html-reporter-events.md +0 -125
- package/docs/en/html-reporter-plugins.md +0 -265
- package/docs/en/html-reporter-setup.md +0 -378
- package/docs/en/html-reporter.md +0 -8
- package/docs/ru/html-reporter-api.md +0 -198
- package/docs/ru/html-reporter-commands.md +0 -96
- package/docs/ru/html-reporter-custom-gui.md +0 -99
- package/docs/ru/html-reporter-events.md +0 -125
- package/docs/ru/html-reporter-plugins.md +0 -265
- package/docs/ru/html-reporter-setup.md +0 -378
- package/docs/ru/html-reporter.md +0 -8
- package/lib/common-utils.js +0 -117
- package/lib/constants/browser.js +0 -3
- package/lib/constants/database.js +0 -49
- package/lib/constants/extension-points.js +0 -6
- package/lib/db-utils/common.js +0 -76
- package/lib/gui/index.js +0 -19
- package/lib/local-images-saver.js +0 -11
- package/lib/static/components/bottom-progress-bar/index.js +0 -42
- package/lib/static/components/controls/accept-opened-button.js +0 -39
- package/lib/static/components/controls/base-host-input.js +0 -39
- package/lib/static/components/controls/browser-list/index.js +0 -239
- package/lib/static/components/controls/browser-list/index.styl +0 -52
- package/lib/static/components/controls/browser-list/label.js +0 -60
- package/lib/static/components/controls/browser-list/label.styl +0 -18
- package/lib/static/components/controls/browser-list/utils.js +0 -43
- package/lib/static/components/controls/common-controls.js +0 -75
- package/lib/static/components/controls/common-filters.js +0 -32
- package/lib/static/components/controls/control-button.js +0 -54
- package/lib/static/components/controls/controls.less +0 -109
- package/lib/static/components/controls/custom-gui-controls.js +0 -70
- package/lib/static/components/controls/find-same-diffs-button.js +0 -47
- package/lib/static/components/controls/gui-controls.js +0 -81
- package/lib/static/components/controls/menu-bar.js +0 -47
- package/lib/static/components/controls/report-controls.js +0 -21
- package/lib/static/components/controls/report-info.js +0 -31
- package/lib/static/components/controls/run-button.js +0 -27
- package/lib/static/components/controls/selects/control.js +0 -51
- package/lib/static/components/controls/selects/group-tests.js +0 -94
- package/lib/static/components/controls/selects/index.styl +0 -57
- package/lib/static/components/controls/strict-match-filter-input.js +0 -39
- package/lib/static/components/controls/test-name-filter-input.js +0 -42
- package/lib/static/components/custom-scripts.js +0 -23
- package/lib/static/components/details.js +0 -58
- package/lib/static/components/error-boundary.js +0 -26
- package/lib/static/components/extension-point.js +0 -106
- package/lib/static/components/favicon-changer.js +0 -56
- package/lib/static/components/group-tests/item.js +0 -39
- package/lib/static/components/group-tests/list.js +0 -71
- package/lib/static/components/group-tests/prop-types.js +0 -12
- package/lib/static/components/gui.js +0 -105
- package/lib/static/components/header/header.css +0 -5
- package/lib/static/components/header/index.js +0 -26
- package/lib/static/components/header/summary/dbBtn.js +0 -36
- package/lib/static/components/header/summary/dbSummary.js +0 -49
- package/lib/static/components/header/summary/index.js +0 -43
- package/lib/static/components/header/summary/item.js +0 -28
- package/lib/static/components/header/summary/summary.css +0 -77
- package/lib/static/components/icons/arrow.js +0 -24
- package/lib/static/components/icons/arrows-close.js +0 -25
- package/lib/static/components/icons/arrows-move.js +0 -24
- package/lib/static/components/icons/arrows-open.js +0 -25
- package/lib/static/components/icons/view-in-browser/index.js +0 -59
- package/lib/static/components/icons/view-in-browser/index.styl +0 -28
- package/lib/static/components/loading.js +0 -25
- package/lib/static/components/main-tree.js +0 -23
- package/lib/static/components/modals/find-same-diffs.js +0 -34
- package/lib/static/components/modals/index.js +0 -6
- package/lib/static/components/modals/modal.css +0 -3
- package/lib/static/components/modals/modal.js +0 -27
- package/lib/static/components/modals/screenshot-accepter/body.js +0 -88
- package/lib/static/components/modals/screenshot-accepter/header.js +0 -192
- package/lib/static/components/modals/screenshot-accepter/index.js +0 -228
- package/lib/static/components/modals/screenshot-accepter/meta.js +0 -32
- package/lib/static/components/modals/screenshot-accepter/style.css +0 -115
- package/lib/static/components/popup/index.js +0 -85
- package/lib/static/components/popup/index.styl +0 -37
- package/lib/static/components/progress-bar/index.js +0 -13
- package/lib/static/components/progress-bar/index.styl +0 -24
- package/lib/static/components/report.js +0 -72
- package/lib/static/components/retry-switcher/index.js +0 -36
- package/lib/static/components/retry-switcher/item.js +0 -55
- package/lib/static/components/section/body/description.js +0 -24
- package/lib/static/components/section/body/history/index.js +0 -29
- package/lib/static/components/section/body/history/index.styl +0 -4
- package/lib/static/components/section/body/index.js +0 -114
- package/lib/static/components/section/body/meta-info/content.js +0 -114
- package/lib/static/components/section/body/meta-info/index.js +0 -33
- package/lib/static/components/section/body/result.js +0 -41
- package/lib/static/components/section/body/tabs.js +0 -52
- package/lib/static/components/section/section-browser.js +0 -113
- package/lib/static/components/section/section-common.js +0 -100
- package/lib/static/components/section/section-wrapper.js +0 -20
- package/lib/static/components/section/title/browser-skipped.js +0 -22
- package/lib/static/components/section/title/browser.js +0 -74
- package/lib/static/components/section/title/simple.js +0 -82
- package/lib/static/components/state/error-details.js +0 -18
- package/lib/static/components/state/index.js +0 -208
- package/lib/static/components/state/screenshot/diff-circle.js +0 -66
- package/lib/static/components/state/screenshot/full.js +0 -28
- package/lib/static/components/state/screenshot/resized.js +0 -90
- package/lib/static/components/state/screenshot/with-encode-uri.js +0 -44
- package/lib/static/components/state/screenshot/with-synced-scale.js +0 -116
- package/lib/static/components/state/state-error.js +0 -140
- package/lib/static/components/state/state-fail/index.js +0 -161
- package/lib/static/components/state/state-fail/index.styl +0 -31
- package/lib/static/components/state/state-fail/onion-skin-diff/index.js +0 -43
- package/lib/static/components/state/state-fail/onion-skin-diff/index.styl +0 -19
- package/lib/static/components/state/state-fail/prop-types.js +0 -16
- package/lib/static/components/state/state-fail/swipe-diff/index.js +0 -138
- package/lib/static/components/state/state-fail/swipe-diff/index.styl +0 -82
- package/lib/static/components/state/state-fail/switch-diff/index.js +0 -36
- package/lib/static/components/state/state-fail/switch-diff/index.styl +0 -12
- package/lib/static/components/state/state-fail/useFitImages.js +0 -63
- package/lib/static/components/state/state-success.js +0 -23
- package/lib/static/components/sticky-header/gui.js +0 -12
- package/lib/static/components/sticky-header/index.js +0 -36
- package/lib/static/components/sticky-header/index.styl +0 -37
- package/lib/static/components/sticky-header/report.js +0 -14
- package/lib/static/components/suites.js +0 -157
- package/lib/static/containers/array/array.styl +0 -32
- package/lib/static/containers/array/index.js +0 -61
- package/lib/static/containers/modal.js +0 -43
- package/lib/static/gui.css +0 -161
- package/lib/static/gui.js +0 -14
- package/lib/static/gui.min.css +0 -1
- package/lib/static/gui.min.js +0 -124
- package/lib/static/hooks/useElementSize.js +0 -30
- package/lib/static/hooks/useEventListener.js +0 -25
- package/lib/static/hooks/useWindowSize.js +0 -25
- package/lib/static/index.js +0 -14
- package/lib/static/modules/action-names.js +0 -57
- package/lib/static/modules/actions.js +0 -332
- package/lib/static/modules/custom-queries.js +0 -27
- package/lib/static/modules/default-state.js +0 -84
- package/lib/static/modules/load-plugin.js +0 -109
- package/lib/static/modules/local-storage-wrapper.js +0 -54
- package/lib/static/modules/middlewares/local-storage.js +0 -30
- package/lib/static/modules/middlewares/metrika.js +0 -121
- package/lib/static/modules/plugins.js +0 -52
- package/lib/static/modules/query-params.js +0 -98
- package/lib/static/modules/reducers/api-values.js +0 -25
- package/lib/static/modules/reducers/auto-run.js +0 -14
- package/lib/static/modules/reducers/bottom-progress-bar.js +0 -16
- package/lib/static/modules/reducers/browsers.js +0 -43
- package/lib/static/modules/reducers/close-ids.js +0 -12
- package/lib/static/modules/reducers/config.js +0 -48
- package/lib/static/modules/reducers/date.js +0 -16
- package/lib/static/modules/reducers/db.js +0 -30
- package/lib/static/modules/reducers/fetch-db-details.js +0 -13
- package/lib/static/modules/reducers/grouped-tests/by/meta.js +0 -31
- package/lib/static/modules/reducers/grouped-tests/by/result.js +0 -57
- package/lib/static/modules/reducers/grouped-tests/helpers.js +0 -91
- package/lib/static/modules/reducers/grouped-tests/index.js +0 -52
- package/lib/static/modules/reducers/gui.js +0 -16
- package/lib/static/modules/reducers/index.js +0 -56
- package/lib/static/modules/reducers/loading.js +0 -12
- package/lib/static/modules/reducers/modals.js +0 -16
- package/lib/static/modules/reducers/notifications.js +0 -12
- package/lib/static/modules/reducers/plugins.js +0 -25
- package/lib/static/modules/reducers/processing.js +0 -21
- package/lib/static/modules/reducers/running.js +0 -19
- package/lib/static/modules/reducers/skips.js +0 -15
- package/lib/static/modules/reducers/stats.js +0 -21
- package/lib/static/modules/reducers/stopping.js +0 -16
- package/lib/static/modules/reducers/tree/helpers.js +0 -28
- package/lib/static/modules/reducers/tree/index.js +0 -314
- package/lib/static/modules/reducers/tree/nodes/browsers.js +0 -109
- package/lib/static/modules/reducers/tree/nodes/images.js +0 -59
- package/lib/static/modules/reducers/tree/nodes/results.js +0 -39
- package/lib/static/modules/reducers/tree/nodes/suites.js +0 -239
- package/lib/static/modules/reducers/view.js +0 -93
- package/lib/static/modules/selectors/grouped-tests.js +0 -8
- package/lib/static/modules/selectors/index.js +0 -3
- package/lib/static/modules/selectors/stats.js +0 -33
- package/lib/static/modules/selectors/tree.js +0 -256
- package/lib/static/modules/selectors/view.js +0 -5
- package/lib/static/modules/store.js +0 -25
- package/lib/static/modules/web-vitals.js +0 -13
- package/lib/static/modules/yandex-metrika.js +0 -50
- package/lib/static/report.min.js +0 -124
- package/lib/static/styles.css +0 -887
- package/lib/static/template.html +0 -13
- package/lib/workers/worker.js +0 -15
- package/webpack.common.js +0 -95
- package/webpack.dev.js +0 -25
- package/webpack.prod.js +0 -19
- /package/{lib → build/lib}/static/gui.html +0 -0
- /package/{lib → build/lib}/static/icons/favicon-failure.png +0 -0
- /package/{lib → build/lib}/static/icons/favicon-running.png +0 -0
- /package/{lib → build/lib}/static/icons/favicon-success.png +0 -0
- /package/{lib → build/lib}/static/icons/favicon.png +0 -0
- /package/{lib → build/lib}/static/index.html +0 -0
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import {get, last} from 'lodash';
|
|
2
|
-
import React, {Component, Fragment} from 'react';
|
|
3
|
-
import {connect} from 'react-redux';
|
|
4
|
-
import {bindActionCreators} from 'redux';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
import classNames from 'classnames';
|
|
7
|
-
import * as actions from '../../modules/actions';
|
|
8
|
-
import {mkGetLastImageByStateName} from '../../modules/selectors/tree';
|
|
9
|
-
import StateError from './state-error';
|
|
10
|
-
import StateSuccess from './state-success';
|
|
11
|
-
import StateFail from './state-fail';
|
|
12
|
-
import ControlButton from '../controls/control-button';
|
|
13
|
-
import FindSameDiffsButton from '../controls/find-same-diffs-button';
|
|
14
|
-
import ArrowsOpen from '../icons/arrows-open';
|
|
15
|
-
import {types as modalTypes} from '../modals';
|
|
16
|
-
import {isAcceptable, isNodeSuccessful, isScreenRevertable} from '../../modules/utils';
|
|
17
|
-
import {isSuccessStatus, isFailStatus, isErroredStatus, isUpdatedStatus, isIdleStatus} from '../../../common-utils';
|
|
18
|
-
|
|
19
|
-
class State extends Component {
|
|
20
|
-
static propTypes = {
|
|
21
|
-
result: PropTypes.shape({
|
|
22
|
-
status: PropTypes.string.isRequired,
|
|
23
|
-
error: PropTypes.object
|
|
24
|
-
}).isRequired,
|
|
25
|
-
imageId: PropTypes.string,
|
|
26
|
-
// from store
|
|
27
|
-
gui: PropTypes.bool.isRequired,
|
|
28
|
-
image: PropTypes.shape({
|
|
29
|
-
status: PropTypes.string,
|
|
30
|
-
error: PropTypes.object,
|
|
31
|
-
stateName: PropTypes.string,
|
|
32
|
-
expectedImg: PropTypes.object
|
|
33
|
-
}).isRequired,
|
|
34
|
-
shouldImageBeOpened: PropTypes.bool.isRequired,
|
|
35
|
-
isScreenshotAccepterDisabled: PropTypes.bool.isRequired,
|
|
36
|
-
isLastResult: PropTypes.bool.isRequired
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
toggleModal = () => {
|
|
40
|
-
const {actions, image} = this.props;
|
|
41
|
-
|
|
42
|
-
actions.openModal({
|
|
43
|
-
id: modalTypes.SCREENSHOT_ACCEPTER,
|
|
44
|
-
type: modalTypes.SCREENSHOT_ACCEPTER,
|
|
45
|
-
className: 'screenshot-accepter',
|
|
46
|
-
data: {image}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
onToggleStateResult = () => {
|
|
51
|
-
const {imageId, image, shouldImageBeOpened} = this.props;
|
|
52
|
-
|
|
53
|
-
if (!image.stateName) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
this.props.actions.toggleStateResult({imageId, shouldBeOpened: !shouldImageBeOpened});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
onTestAccept = () => {
|
|
61
|
-
this.props.actions.acceptTest(this.props.imageId);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
onScreenshotUndo = () => {
|
|
65
|
-
this.props.actions.undoAcceptImage(this.props.imageId);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
_drawFailImageControls() {
|
|
69
|
-
if (!this.props.gui) {
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const {node, imageId, result, isScreenshotAccepterDisabled} = this.props;
|
|
74
|
-
const isAcceptDisabled = !isAcceptable(node);
|
|
75
|
-
const isFindSameDiffDisabled = !isFailStatus(node.status);
|
|
76
|
-
|
|
77
|
-
if (isAcceptDisabled && isFindSameDiffDisabled && isScreenshotAccepterDisabled) {
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return (
|
|
82
|
-
<div className="state-controls">
|
|
83
|
-
<ControlButton
|
|
84
|
-
label="✔ Accept"
|
|
85
|
-
isSuiteControl={true}
|
|
86
|
-
isDisabled={isAcceptDisabled}
|
|
87
|
-
handler={this.onTestAccept}
|
|
88
|
-
/>
|
|
89
|
-
<FindSameDiffsButton
|
|
90
|
-
imageId={imageId}
|
|
91
|
-
browserId={result.parentId}
|
|
92
|
-
isDisabled={isFindSameDiffDisabled}
|
|
93
|
-
/>
|
|
94
|
-
<ControlButton
|
|
95
|
-
label={<Fragment>
|
|
96
|
-
<ArrowsOpen />
|
|
97
|
-
Switch accept mode
|
|
98
|
-
</Fragment>}
|
|
99
|
-
title="Open mode with fast screenshot accepting"
|
|
100
|
-
isSuiteControl={true}
|
|
101
|
-
isDisabled={isScreenshotAccepterDisabled}
|
|
102
|
-
extendClassNames="screenshot-accepter__arrows-open-btn"
|
|
103
|
-
handler={() => this.toggleModal()}
|
|
104
|
-
/>
|
|
105
|
-
</div>
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
_drawUpdatedImageControls() {
|
|
110
|
-
const {gui, image, isLastResult} = this.props;
|
|
111
|
-
|
|
112
|
-
if (!isScreenRevertable({image, gui, isLastResult})) {
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return (
|
|
117
|
-
<div className="state-controls">
|
|
118
|
-
<ControlButton
|
|
119
|
-
label="⎌ Undo"
|
|
120
|
-
isSuiteControl={true}
|
|
121
|
-
handler={this.onScreenshotUndo}
|
|
122
|
-
/>
|
|
123
|
-
</div>
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
_getStateTitle() {
|
|
128
|
-
const {image, shouldImageBeOpened} = this.props;
|
|
129
|
-
|
|
130
|
-
if (!image.stateName) {
|
|
131
|
-
return null;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const className = classNames(
|
|
135
|
-
'state-title',
|
|
136
|
-
{'state-title_collapsed': !shouldImageBeOpened},
|
|
137
|
-
`state-title_${image.status}`
|
|
138
|
-
);
|
|
139
|
-
|
|
140
|
-
return <div className={className} onClick={this.onToggleStateResult}>{image.stateName}</div>;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
render() {
|
|
144
|
-
if (!this.props.shouldImageBeOpened) {
|
|
145
|
-
return (
|
|
146
|
-
<Fragment>
|
|
147
|
-
<hr className="tab__separator" />
|
|
148
|
-
{this._getStateTitle()}
|
|
149
|
-
</Fragment>
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
const {node, result, image} = this.props;
|
|
154
|
-
const {status, error} = node;
|
|
155
|
-
let elem = null;
|
|
156
|
-
|
|
157
|
-
if (isErroredStatus(status)) {
|
|
158
|
-
elem = <StateError result={result} image={image} />;
|
|
159
|
-
} else if (isSuccessStatus(status) || isUpdatedStatus(status) || (isIdleStatus(status) && get(image.expectedImg, 'path'))) {
|
|
160
|
-
elem = <StateSuccess status={status} expectedImg={image.expectedImg} />;
|
|
161
|
-
} else if (isFailStatus(status)) {
|
|
162
|
-
elem = error
|
|
163
|
-
? <StateError result={result} image={image} />
|
|
164
|
-
: <StateFail image={image} />;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
return (
|
|
168
|
-
<Fragment>
|
|
169
|
-
<hr className="tab__separator"/>
|
|
170
|
-
{this._getStateTitle()}
|
|
171
|
-
{this._drawFailImageControls()}
|
|
172
|
-
{this._drawUpdatedImageControls()}
|
|
173
|
-
{elem ? <div className='image-box__container'>{elem}</div> : null}
|
|
174
|
-
</Fragment>
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export default connect(
|
|
180
|
-
() => {
|
|
181
|
-
const getLastImageByStateName = mkGetLastImageByStateName();
|
|
182
|
-
|
|
183
|
-
return (state, {imageId, result}) => {
|
|
184
|
-
const {gui, tree} = state;
|
|
185
|
-
const image = tree.images.byId[imageId] || {};
|
|
186
|
-
const shouldImageBeOpened = image.stateName ? tree.images.stateById[imageId].shouldBeOpened : true;
|
|
187
|
-
const node = imageId ? image : result;
|
|
188
|
-
const browser = state.tree.browsers.byId[result.parentId];
|
|
189
|
-
const isLastResult = last(browser.resultIds) === result.id;
|
|
190
|
-
let isScreenshotAccepterDisabled = true;
|
|
191
|
-
|
|
192
|
-
if (gui && imageId) {
|
|
193
|
-
const lastImage = getLastImageByStateName(state, {imageId}) || {};
|
|
194
|
-
isScreenshotAccepterDisabled = isNodeSuccessful(lastImage) || !isAcceptable(node);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
return {
|
|
198
|
-
gui,
|
|
199
|
-
image,
|
|
200
|
-
node,
|
|
201
|
-
shouldImageBeOpened,
|
|
202
|
-
isScreenshotAccepterDisabled,
|
|
203
|
-
isLastResult
|
|
204
|
-
};
|
|
205
|
-
};
|
|
206
|
-
},
|
|
207
|
-
(dispatch) => ({actions: bindActionCreators(actions, dispatch)})
|
|
208
|
-
)(State);
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import React, {Component} from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import {keyframes} from 'styled-components';
|
|
6
|
-
import {CIRCLE_RADIUS} from '../../../../constants/defaults';
|
|
7
|
-
|
|
8
|
-
export default class DiffCircle extends Component {
|
|
9
|
-
static propTypes = {
|
|
10
|
-
originalImageWidth: PropTypes.number.isRequired,
|
|
11
|
-
diffTarget: PropTypes.object.isRequired,
|
|
12
|
-
diffBounds: PropTypes.object.isRequired,
|
|
13
|
-
display: PropTypes.bool.isRequired,
|
|
14
|
-
toggleDiff: PropTypes.func.isRequired
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
_getRect() {
|
|
18
|
-
const {originalImageWidth, diffBounds, diffTarget} = this.props;
|
|
19
|
-
const targetRect = diffTarget.getBoundingClientRect();
|
|
20
|
-
const sizeCoeff = diffTarget.offsetWidth / originalImageWidth;
|
|
21
|
-
|
|
22
|
-
const rectHeight = Math.ceil(sizeCoeff * (diffBounds.bottom - diffBounds.top + 1));
|
|
23
|
-
const rectWidth = Math.ceil(sizeCoeff * (diffBounds.right - diffBounds.left + 1));
|
|
24
|
-
|
|
25
|
-
const rectMiddleX = (diffBounds.left + diffBounds.right) / 2;
|
|
26
|
-
const rectMiddleY = (diffBounds.top + diffBounds.bottom) / 2;
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
x: targetRect.left + sizeCoeff * rectMiddleX,
|
|
30
|
-
y: targetRect.top + sizeCoeff * rectMiddleY,
|
|
31
|
-
minSize: Math.floor(Math.sqrt(rectWidth * rectWidth + rectHeight * rectHeight))
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
render() {
|
|
36
|
-
const {display, toggleDiff} = this.props;
|
|
37
|
-
|
|
38
|
-
if (!display) {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const diffRect = this._getRect();
|
|
43
|
-
const diffCircle = {
|
|
44
|
-
width: `${diffRect.minSize}px`,
|
|
45
|
-
height: `${diffRect.minSize}px`,
|
|
46
|
-
top: `${Math.ceil(diffRect.y - diffRect.minSize / 2)}px`,
|
|
47
|
-
left: `${Math.ceil(diffRect.x - diffRect.minSize / 2)}px`
|
|
48
|
-
};
|
|
49
|
-
const radius = diffRect.minSize + CIRCLE_RADIUS;
|
|
50
|
-
|
|
51
|
-
const animation = keyframes`
|
|
52
|
-
100% {
|
|
53
|
-
transform: scale(${radius / diffRect.minSize})
|
|
54
|
-
}
|
|
55
|
-
`;
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<div
|
|
59
|
-
className='diff-circle'
|
|
60
|
-
style={{animation: `${animation} 1s ease-out`, ...diffCircle}}
|
|
61
|
-
onAnimationEnd={() => toggleDiff()}
|
|
62
|
-
>
|
|
63
|
-
</div>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import React, {Component} from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import withEncodeUri from './with-encode-uri';
|
|
6
|
-
|
|
7
|
-
class FullScreenshot extends Component {
|
|
8
|
-
static propTypes = {
|
|
9
|
-
imgRef: PropTypes.shape({
|
|
10
|
-
current: PropTypes.instanceOf(Element)
|
|
11
|
-
}),
|
|
12
|
-
style: PropTypes.shape({
|
|
13
|
-
width: PropTypes.number,
|
|
14
|
-
opacity: PropTypes.number,
|
|
15
|
-
visibility: PropTypes.string
|
|
16
|
-
}),
|
|
17
|
-
// from withEncodeUri
|
|
18
|
-
imageUrl: PropTypes.string.isRequired
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
render() {
|
|
22
|
-
const {imageUrl, className, imgRef, style} = this.props;
|
|
23
|
-
|
|
24
|
-
return <img className={className} src={imageUrl} ref={imgRef} style={style} />;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export default withEncodeUri(FullScreenshot);
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import React, {Component, Fragment} from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import classNames from 'classnames';
|
|
6
|
-
import DiffCircle from './diff-circle';
|
|
7
|
-
import withEncodeUri from './with-encode-uri';
|
|
8
|
-
|
|
9
|
-
class ResizedScreenshot extends Component {
|
|
10
|
-
constructor(props) {
|
|
11
|
-
super(props);
|
|
12
|
-
|
|
13
|
-
this.state = {
|
|
14
|
-
showDiffCircle: false,
|
|
15
|
-
diffTarget: {}
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
static propTypes = {
|
|
20
|
-
image: PropTypes.shape({
|
|
21
|
-
path: PropTypes.string.isRequired,
|
|
22
|
-
size: PropTypes.shape({
|
|
23
|
-
width: PropTypes.number,
|
|
24
|
-
height: PropTypes.number
|
|
25
|
-
})
|
|
26
|
-
}).isRequired,
|
|
27
|
-
diffClusters: PropTypes.array,
|
|
28
|
-
overrideWidth: PropTypes.number,
|
|
29
|
-
// from withEncodeUri
|
|
30
|
-
imageUrl: PropTypes.string.isRequired
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
_getScreenshotComponent(elem, diffClusters) {
|
|
34
|
-
return <Fragment>
|
|
35
|
-
{diffClusters && diffClusters.map((c, id) => <DiffCircle
|
|
36
|
-
originalImageWidth={this.props.image.size.width}
|
|
37
|
-
diffTarget={this.state.diffTarget}
|
|
38
|
-
display={this.state.showDiffCircle}
|
|
39
|
-
toggleDiff={this.toggleDiff}
|
|
40
|
-
diffBounds={c}
|
|
41
|
-
key={id}
|
|
42
|
-
/>)}
|
|
43
|
-
{elem}
|
|
44
|
-
</Fragment>;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
toggleDiff = () => {
|
|
48
|
-
this.setState({showDiffCircle: !this.state.showDiffCircle});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
_handleDiffClick = () => ({target}) => {
|
|
52
|
-
this.toggleDiff();
|
|
53
|
-
this.setState({diffTarget: target.parentElement});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
render() {
|
|
57
|
-
const {imageUrl, image: {size: imgSize}, diffClusters, overrideWidth, style} = this.props;
|
|
58
|
-
const cursorStyle = diffClusters ? {cursor: 'pointer'} : {};
|
|
59
|
-
|
|
60
|
-
if (!imgSize) {
|
|
61
|
-
const elem = (
|
|
62
|
-
<div className="image-box__screenshot-container image-box__screenshot-container_auto-size">
|
|
63
|
-
<img src={imageUrl} style={{width: '100%', height: '100%', style, ...cursorStyle}}/>
|
|
64
|
-
</div>
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
return this._getScreenshotComponent(elem, diffClusters);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const imgClassNames = classNames(
|
|
71
|
-
'image-box__screenshot',
|
|
72
|
-
this.props.className
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
const paddingTop = ((imgSize.height / imgSize.width) * 100).toFixed(2);
|
|
76
|
-
const elem = (
|
|
77
|
-
<div
|
|
78
|
-
onClick={diffClusters && this._handleDiffClick(diffClusters)}
|
|
79
|
-
className="image-box__screenshot-container image-box__screenshot-container_fixed-size"
|
|
80
|
-
style={{width: overrideWidth || imgSize.width, paddingTop: `${paddingTop}%`}}
|
|
81
|
-
>
|
|
82
|
-
<img src={imageUrl} className={imgClassNames} style={{...style, ...cursorStyle}} />
|
|
83
|
-
</div>
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
return this._getScreenshotComponent(elem, diffClusters);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export default withEncodeUri(ResizedScreenshot);
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import {isUrl} from '../../../../common-utils';
|
|
4
|
-
|
|
5
|
-
// for prevent image caching
|
|
6
|
-
function addTimestamp(imagePath) {
|
|
7
|
-
return `${imagePath}?t=${Date.now()}`;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function encodeUri(imagePath) {
|
|
11
|
-
if (isUrl(imagePath)) {
|
|
12
|
-
return imagePath;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return imagePath
|
|
16
|
-
// we can't use path.sep here because on Windows browser returns '/' instead of '\\'
|
|
17
|
-
.split(/\/|\\/)
|
|
18
|
-
.map((item) => encodeURIComponent(item))
|
|
19
|
-
.join('/');
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function withEncodeUri(ScreenshotComponent) {
|
|
23
|
-
return function wrapper(props) {
|
|
24
|
-
const {noCache, image: {path: imgPath}} = props;
|
|
25
|
-
|
|
26
|
-
const imageUrl = noCache
|
|
27
|
-
? addTimestamp(encodeUri(imgPath))
|
|
28
|
-
: encodeUri(imgPath);
|
|
29
|
-
|
|
30
|
-
return <ScreenshotComponent
|
|
31
|
-
imageUrl={imageUrl}
|
|
32
|
-
{...props}
|
|
33
|
-
/>;
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
withEncodeUri.propTypes = {
|
|
38
|
-
noCache: PropTypes.bool,
|
|
39
|
-
image: PropTypes.shape({
|
|
40
|
-
path: PropTypes.string.isRequired
|
|
41
|
-
}).isRequired
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export default withEncodeUri;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import React, {Component} from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import ResizeObserver from 'rc-resize-observer';
|
|
4
|
-
|
|
5
|
-
export default (WrappedComponent) => class WithSyncedScale extends Component {
|
|
6
|
-
static propTypes = {
|
|
7
|
-
image1: PropTypes.shape({
|
|
8
|
-
size: PropTypes.shape({
|
|
9
|
-
width: PropTypes.number,
|
|
10
|
-
height: PropTypes.number
|
|
11
|
-
})
|
|
12
|
-
}).isRequired,
|
|
13
|
-
image2: PropTypes.shape({
|
|
14
|
-
size: PropTypes.shape({
|
|
15
|
-
width: PropTypes.number,
|
|
16
|
-
height: PropTypes.number
|
|
17
|
-
})
|
|
18
|
-
}).isRequired
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
constructor(props) {
|
|
22
|
-
super(props);
|
|
23
|
-
|
|
24
|
-
const {image1, image2} = props;
|
|
25
|
-
|
|
26
|
-
this._scaleFactor = 1;
|
|
27
|
-
this._shouldScale = image1.size.width !== image2.size.width;
|
|
28
|
-
this._isFirstImageWider = image1.size.width > image2.size.width;
|
|
29
|
-
|
|
30
|
-
this.state = {
|
|
31
|
-
syncedImage1: {
|
|
32
|
-
containerRef: React.createRef(),
|
|
33
|
-
width: image1.size.width
|
|
34
|
-
},
|
|
35
|
-
syncedImage2: {
|
|
36
|
-
containerRef: React.createRef(),
|
|
37
|
-
width: image2.size.width
|
|
38
|
-
},
|
|
39
|
-
resizesNum: 0
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
componentDidMount() {
|
|
44
|
-
this._handleResize();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
_calcScaleFactor = () => {
|
|
48
|
-
if (!this._shouldScale) {
|
|
49
|
-
return this._scaleFactor;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const {image1, image2} = this.props;
|
|
53
|
-
const {syncedImage1, syncedImage2} = this.state;
|
|
54
|
-
|
|
55
|
-
const imgWidth = this._isFirstImageWider ? image1.size.width : image2.size.width;
|
|
56
|
-
const renderedImgWidth = this._isFirstImageWider
|
|
57
|
-
? this.getRenderedImgWidth(syncedImage1)
|
|
58
|
-
: this.getRenderedImgWidth(syncedImage2);
|
|
59
|
-
|
|
60
|
-
return renderedImgWidth / imgWidth;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
_getScaledWidth = (image) => {
|
|
64
|
-
if (!this._shouldScale) {
|
|
65
|
-
return image.size.width;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const scaledWidth = Math.ceil(image.size.width * this._scaleFactor);
|
|
69
|
-
|
|
70
|
-
return Math.min(scaledWidth, image.size.width);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
getRenderedImgWidth(syncedImage) {
|
|
74
|
-
return syncedImage.containerRef.current
|
|
75
|
-
? syncedImage.containerRef.current.offsetWidth
|
|
76
|
-
: syncedImage.width;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
_handleResize = () => {
|
|
80
|
-
if (!this._shouldScale) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const {image1, image2} = this.props;
|
|
85
|
-
this._scaleFactor = this._calcScaleFactor();
|
|
86
|
-
|
|
87
|
-
this.setState(prevState => ({
|
|
88
|
-
syncedImage1: {
|
|
89
|
-
...prevState.syncedImage1,
|
|
90
|
-
width: this._isFirstImageWider ? image1.size.width : this._getScaledWidth(image1)
|
|
91
|
-
},
|
|
92
|
-
syncedImage2: {
|
|
93
|
-
...prevState.syncedImage2,
|
|
94
|
-
width: this._isFirstImageWider ? this._getScaledWidth(image2) : image2.size.width
|
|
95
|
-
},
|
|
96
|
-
resizesNum: prevState.resizesNum + 1
|
|
97
|
-
}));
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
render() {
|
|
101
|
-
const {syncedImage1, syncedImage2, resizesNum} = this.state;
|
|
102
|
-
|
|
103
|
-
return (
|
|
104
|
-
<ResizeObserver onResize={this._handleResize}>
|
|
105
|
-
<WrappedComponent
|
|
106
|
-
syncedImage1={syncedImage1}
|
|
107
|
-
syncedImage2={syncedImage2}
|
|
108
|
-
resizesNum={resizesNum}
|
|
109
|
-
getRenderedImgWidth={this.getRenderedImgWidth}
|
|
110
|
-
|
|
111
|
-
{...this.props}
|
|
112
|
-
/>
|
|
113
|
-
</ResizeObserver>
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
};
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import React, {Component, Fragment} from 'react';
|
|
4
|
-
import {connect} from 'react-redux';
|
|
5
|
-
import {bindActionCreators} from 'redux';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import {isEmpty, map, isFunction} from 'lodash';
|
|
8
|
-
import ReactHtmlParser from 'react-html-parser';
|
|
9
|
-
import * as actions from '../../modules/actions';
|
|
10
|
-
import ResizedScreenshot from './screenshot/resized';
|
|
11
|
-
import {isNoRefImageError, isAssertViewError} from '../../modules/utils';
|
|
12
|
-
import ErrorDetails from './error-details';
|
|
13
|
-
import Details from '../details';
|
|
14
|
-
import {ERROR_TITLE_TEXT_LENGTH} from '../../../constants/errors';
|
|
15
|
-
|
|
16
|
-
class StateError extends Component {
|
|
17
|
-
static propTypes = {
|
|
18
|
-
result: PropTypes.shape({
|
|
19
|
-
error: PropTypes.object,
|
|
20
|
-
errorDetails: PropTypes.object
|
|
21
|
-
}).isRequired,
|
|
22
|
-
image: PropTypes.shape({
|
|
23
|
-
stateName: PropTypes.string,
|
|
24
|
-
error: PropTypes.object,
|
|
25
|
-
actualImg: PropTypes.object
|
|
26
|
-
}).isRequired,
|
|
27
|
-
// from store
|
|
28
|
-
error: PropTypes.object.isRequired,
|
|
29
|
-
errorDetails: PropTypes.object,
|
|
30
|
-
errorPatterns: PropTypes.array.isRequired
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
_getErrorPattern() {
|
|
34
|
-
const {errorPatterns, error} = this.props;
|
|
35
|
-
|
|
36
|
-
return errorPatterns.find(({regexp}) => error.message.match(regexp));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
_drawImage() {
|
|
40
|
-
const {image, error} = this.props;
|
|
41
|
-
|
|
42
|
-
if (!image.actualImg) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return isNoRefImageError(error)
|
|
47
|
-
? <ResizedScreenshot image={image.actualImg} />
|
|
48
|
-
: <Details
|
|
49
|
-
title="Page screenshot"
|
|
50
|
-
content={() => <ResizedScreenshot image={image.actualImg} />}
|
|
51
|
-
extendClassNames="details_type_image"
|
|
52
|
-
onClick={this.onTogglePageScreenshot}
|
|
53
|
-
/>;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
onTogglePageScreenshot = () => {
|
|
57
|
-
this.props.actions.togglePageScreenshot();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
_errorToElements(error) {
|
|
61
|
-
return map(error, (value, key) => {
|
|
62
|
-
if (!value) {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
let titleText = '';
|
|
67
|
-
let content = '';
|
|
68
|
-
|
|
69
|
-
if (typeof value === 'string') {
|
|
70
|
-
if (value.match(/\n/)) {
|
|
71
|
-
[titleText, ...content] = value.split('\n');
|
|
72
|
-
} else if (value.length < ERROR_TITLE_TEXT_LENGTH) {
|
|
73
|
-
titleText = value;
|
|
74
|
-
} else {
|
|
75
|
-
[titleText, ...content] = splitBySpace(value);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (Array.isArray(content)) {
|
|
79
|
-
content = content.join('\n');
|
|
80
|
-
}
|
|
81
|
-
} else {
|
|
82
|
-
titleText = <span>show more</span>;
|
|
83
|
-
content = isFunction(value) ? value : () => value;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const title = <Fragment><span className="error__item-key">{key}: </span>{titleText}</Fragment>;
|
|
87
|
-
|
|
88
|
-
return <Details
|
|
89
|
-
key={key}
|
|
90
|
-
title={title}
|
|
91
|
-
content={content}
|
|
92
|
-
extendClassNames="error__item"
|
|
93
|
-
/>;
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
_shouldDrawErrorInfo(error) {
|
|
98
|
-
return !isAssertViewError(error);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
render() {
|
|
102
|
-
const {error, errorDetails} = this.props;
|
|
103
|
-
const errorPattern = this._getErrorPattern();
|
|
104
|
-
|
|
105
|
-
const extendedError = isEmpty(errorPattern)
|
|
106
|
-
? error
|
|
107
|
-
: {...error, message: `${errorPattern.name}\n${error.message}`, hint: () => parseHtmlString(errorPattern.hint)};
|
|
108
|
-
|
|
109
|
-
return (
|
|
110
|
-
<div className="image-box__image image-box__image_single">
|
|
111
|
-
{this._shouldDrawErrorInfo(extendedError) && <div className="error">{this._errorToElements(extendedError)}</div>}
|
|
112
|
-
{errorDetails && <ErrorDetails errorDetails={errorDetails} />}
|
|
113
|
-
{this._drawImage()}
|
|
114
|
-
</div>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export default connect(
|
|
120
|
-
({config: {errorPatterns}}, {result, image}) => {
|
|
121
|
-
const error = image.error || result.error;
|
|
122
|
-
const errorDetails = image.stateName ? null : result.errorDetails;
|
|
123
|
-
|
|
124
|
-
return {error, errorDetails, errorPatterns};
|
|
125
|
-
},
|
|
126
|
-
(dispatch) => ({actions: bindActionCreators(actions, dispatch)})
|
|
127
|
-
)(StateError);
|
|
128
|
-
|
|
129
|
-
function parseHtmlString(str = '') {
|
|
130
|
-
const html = str ? ReactHtmlParser(str) : null;
|
|
131
|
-
|
|
132
|
-
return Array.isArray(html) && html.length === 1 ? html[0] : html;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function splitBySpace(str) {
|
|
136
|
-
const spaceIndex = str.slice(0, ERROR_TITLE_TEXT_LENGTH).lastIndexOf(' ');
|
|
137
|
-
const breakIndex = spaceIndex === -1 ? ERROR_TITLE_TEXT_LENGTH : spaceIndex;
|
|
138
|
-
|
|
139
|
-
return [str.slice(0, breakIndex), str.slice(breakIndex + 1)];
|
|
140
|
-
}
|