@syngrisi/syngrisi 2.2.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/.nvmrc +1 -0
- package/LICENSE.md +9 -0
- package/README.md +139 -0
- package/config.js +17 -0
- package/dist/config.js +16 -0
- package/dist/src/server/models/index.js +508 -0
- package/dist/src/server/models/plugins/index.js +4 -0
- package/dist/src/server/models/plugins/paginate.plugin.js +76 -0
- package/dist/src/server/models/plugins/paginateDistinct.plugin.js +76 -0
- package/dist/src/server/models/plugins/toJSON.plugin.js +39 -0
- package/dist/src/server/schemas/createCheck.shema.js +17 -0
- package/dist/src/server/schemas/getBaseline.shema.js +12 -0
- package/dist/src/server/utils/paramsGuard.js +18 -0
- package/dist/src/tasks/backup.js +68 -0
- package/dist/src/tasks/lib/common.js +14 -0
- package/dist/src/tasks/lib/utils.js +14 -0
- package/dist/src/tasks/migrations/2.0.migration.js +86 -0
- package/dist/src/tasks/migrations/2.0.migration_mql.js +57 -0
- package/dist/src/tasks/reindex.js +28 -0
- package/dist/src/tasks/restore.js +86 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/docker-compose.yml +70 -0
- package/mvc/views/react/admin/index.html +22 -0
- package/mvc/views/react/assets/LogicalGroup.95929360.js +15993 -0
- package/mvc/views/react/assets/PasswordInput.8a73fdd2.js +299 -0
- package/mvc/views/react/assets/admin.94703bdc.js +14448 -0
- package/mvc/views/react/assets/auth.748478ef.js +673 -0
- package/mvc/views/react/assets/bg_2_0_dark_L2.3a31edc0.png +0 -0
- package/mvc/views/react/assets/favicon.bf5828d5.svg +7 -0
- package/mvc/views/react/assets/index.a5606313.css +23 -0
- package/mvc/views/react/assets/roboto-v30-latin-100.0f303f31.woff2 +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-100.34e9582c.woff +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-500.9ce7f3ac.woff +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-500.b0195382.woff2 +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-700.e0fd57c0.woff +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-700.f5aebdfe.woff2 +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-regular.f2abf7fb.woff +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-regular.f6734f81.woff2 +0 -0
- package/mvc/views/react/assets/root.136e0ea3.js +25451 -0
- package/mvc/views/react/assets/use-form.57ebe175.js +24472 -0
- package/mvc/views/react/assets/use-form.ecb4391b.css +36 -0
- package/mvc/views/react/auth/index.html +22 -0
- package/mvc/views/react/index.html +19 -0
- package/mvc/views/react/index2/index.html +21 -0
- package/package.json +144 -0
- package/server.js +166 -0
- package/src/server/controllers/app.controller.js +21 -0
- package/src/server/controllers/auth.controller.js +156 -0
- package/src/server/controllers/baseline.controller.js +24 -0
- package/src/server/controllers/check.controller.js +56 -0
- package/src/server/controllers/client.controller.js +173 -0
- package/src/server/controllers/index.js +12 -0
- package/src/server/controllers/logs.controller.js +30 -0
- package/src/server/controllers/runs.controller.js +25 -0
- package/src/server/controllers/settings.controller.js +23 -0
- package/src/server/controllers/snapshots.controller.js +17 -0
- package/src/server/controllers/suite.controller.js +24 -0
- package/src/server/controllers/tasks.controller.js +47 -0
- package/src/server/controllers/test.controller.js +70 -0
- package/src/server/controllers/users.controller.js +79 -0
- package/src/server/data/custom_devices.json +8 -0
- package/src/server/data/devices.json +773 -0
- package/src/server/data/get_devices.sh +2 -0
- package/src/server/lib/AppSettings.js +56 -0
- package/src/server/lib/admin.json +9 -0
- package/src/server/lib/comparator.js +147 -0
- package/src/server/lib/compareImagesNode.js +60 -0
- package/src/server/lib/dbItems.js +215 -0
- package/src/server/lib/ensureLogin/ensureLoggedIn.js +223 -0
- package/src/server/lib/ensureLogin/ensureLoggedOut.js +44 -0
- package/src/server/lib/getElementsByPixPositionsFromDump.js +72 -0
- package/src/server/lib/guest.json +9 -0
- package/src/server/lib/initialAppSettings.json +18 -0
- package/src/server/lib/logger.js +95 -0
- package/src/server/lib/onStart.js +53 -0
- package/src/server/lib/parseDiff.js.bak +72 -0
- package/src/server/lib/testAdmin.json +9 -0
- package/src/server/lib/testUsers.json +41 -0
- package/src/server/middlewares/authorization.js +50 -0
- package/src/server/middlewares/disableCors.js +19 -0
- package/src/server/models/index.js +534 -0
- package/src/server/models/plugins/index.js +3 -0
- package/src/server/models/plugins/paginate.plugin.js +83 -0
- package/src/server/models/plugins/paginateDistinct.plugin.js +80 -0
- package/src/server/models/plugins/toJSON.plugin.js +44 -0
- package/src/server/routes/ui/admin.js +20 -0
- package/src/server/routes/ui/auth.js +15 -0
- package/src/server/routes/ui/index.js +19 -0
- package/src/server/routes/v1/app.route.js +9 -0
- package/src/server/routes/v1/auth.route.js +12 -0
- package/src/server/routes/v1/baselines.route.js +14 -0
- package/src/server/routes/v1/checks.route.js +25 -0
- package/src/server/routes/v1/client.route.js +39 -0
- package/src/server/routes/v1/index.js +82 -0
- package/src/server/routes/v1/logs.route.js +16 -0
- package/src/server/routes/v1/runs.route.js +15 -0
- package/src/server/routes/v1/settings.route.js +23 -0
- package/src/server/routes/v1/snapshots.route.js +11 -0
- package/src/server/routes/v1/suites.route.js +15 -0
- package/src/server/routes/v1/tasks.route.js +59 -0
- package/src/server/routes/v1/test.route.js +20 -0
- package/src/server/routes/v1/test_distinct.route.js +14 -0
- package/src/server/routes/v1/users.route.js +36 -0
- package/src/server/schemas/createCheck.shema.ts +17 -0
- package/src/server/schemas/getBaseline.shema.ts +12 -0
- package/src/server/services/app.service.js +23 -0
- package/src/server/services/check.service.js +178 -0
- package/src/server/services/client.service.js +648 -0
- package/src/server/services/generic.service.js +51 -0
- package/src/server/services/index.js +12 -0
- package/src/server/services/logs.service.js +38 -0
- package/src/server/services/run.service.js +40 -0
- package/src/server/services/suite.service.js +39 -0
- package/src/server/services/tasks.service.js +536 -0
- package/src/server/services/test.service.js +72 -0
- package/src/server/services/user.service.js +128 -0
- package/src/server/utils/ApiError.js +14 -0
- package/src/server/utils/catchAsync.js +8 -0
- package/src/server/utils/check.js +58 -0
- package/src/server/utils/dateToISO8601.js +2 -0
- package/src/server/utils/deserializeIfJSON.js +9 -0
- package/src/server/utils/formatISOToDateTime.js +6 -0
- package/src/server/utils/index.js +10 -0
- package/src/server/utils/isJSON.js +6 -0
- package/src/server/utils/paramsGuard.ts +15 -0
- package/src/server/utils/pick.js +15 -0
- package/src/server/utils/prettyCheckParams.js +13 -0
- package/src/server/utils/snapshots.js +73 -0
- package/src/server/utils/subDays.js +7 -0
- package/src/server/utils/tests.js +36 -0
- package/src/server/utils/utils.js +146 -0
- package/src/tasks/backup.js.bak +84 -0
- package/src/tasks/backup.ts +53 -0
- package/src/tasks/lib/common.js +24 -0
- package/src/tasks/lib/utils.js +15 -0
- package/src/tasks/migrations/2.0.migration.js +86 -0
- package/src/tasks/migrations/2.0.migration.ts +95 -0
- package/src/tasks/migrations/2.0.migration_mql.js +63 -0
- package/src/tasks/reindex.js +36 -0
- package/src/tasks/restore.js.bak +100 -0
- package/src/tasks/restore.ts +75 -0
- package/src/ui-app/.eslintrc.json +119 -0
- package/src/ui-app/README.md +15 -0
- package/src/ui-app/admin/AdminLayout.tsx +38 -0
- package/src/ui-app/admin/App.tsx +108 -0
- package/src/ui-app/admin/AppContext.ts +3 -0
- package/src/ui-app/admin/components/Header/AdminHeader.tsx +148 -0
- package/src/ui-app/admin/components/Logs/AdminLogs.tsx +142 -0
- package/src/ui-app/admin/components/Logs/RefreshActionIcon.tsx +60 -0
- package/src/ui-app/admin/components/Logs/Table/AdminLogsTable.tsx +81 -0
- package/src/ui-app/admin/components/Logs/Table/AdminLogsTableFilter.tsx +170 -0
- package/src/ui-app/admin/components/Logs/Table/AdminLogsTableHeads.tsx +50 -0
- package/src/ui-app/admin/components/Logs/Table/AdminLogsTableRows.tsx +207 -0
- package/src/ui-app/admin/components/Logs/Table/AdminLogsTableSettings.tsx +95 -0
- package/src/ui-app/admin/components/Logs/Table/InfinityScrollSkeleton.tsx +77 -0
- package/src/ui-app/admin/components/Logs/Table/InfinityScrollSkeletonFIller.tsx +57 -0
- package/src/ui-app/admin/components/Logs/Table/PagesCountAffix.tsx +61 -0
- package/src/ui-app/admin/components/Logs/Table/adminLogsCreateStyle.tsx +36 -0
- package/src/ui-app/admin/components/Logs/Table/adminLogsTableColumns.ts +52 -0
- package/src/ui-app/admin/components/Logs/UnfoldActionIcon.tsx +39 -0
- package/src/ui-app/admin/components/Navbar/AdminNavbar.tsx +50 -0
- package/src/ui-app/admin/components/Navbar/NavbarLinksGroup.tsx +104 -0
- package/src/ui-app/admin/components/Settings/AdminSettings.tsx +51 -0
- package/src/ui-app/admin/components/Settings/Forms/Boolean.tsx +59 -0
- package/src/ui-app/admin/components/Settings/Forms/FormWrapper.tsx +45 -0
- package/src/ui-app/admin/components/Settings/Forms/index.tsx +5 -0
- package/src/ui-app/admin/components/Settings/Forms/interfaces.tsx +17 -0
- package/src/ui-app/admin/components/Tasks/Task.tsx +138 -0
- package/src/ui-app/admin/components/Tasks/TaskWrapper.tsx +11 -0
- package/src/ui-app/admin/components/Tasks/tasksList.ts +59 -0
- package/src/ui-app/admin/components/Users/AdminUsers.tsx +182 -0
- package/src/ui-app/admin/components/Users/UserAddForm.tsx +137 -0
- package/src/ui-app/admin/components/Users/UserForm.tsx +196 -0
- package/src/ui-app/admin/hooks/useParams.tsx +18 -0
- package/src/ui-app/admin/index.html +17 -0
- package/src/ui-app/admin/main.tsx +24 -0
- package/src/ui-app/asserts/css/auth/index.css +23 -0
- package/src/ui-app/asserts/css/styles.css +36 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-100.eot +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-100.svg +313 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-100.ttf +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-100.woff +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-100.woff2 +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-500.eot +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-500.svg +305 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-500.ttf +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-500.woff +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-500.woff2 +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-700.eot +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-700.svg +309 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-700.ttf +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-700.woff +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-700.woff2 +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-regular.eot +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-regular.svg +308 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-regular.ttf +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-regular.woff +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-regular.woff2 +0 -0
- package/src/ui-app/asserts/images/background.jpg +0 -0
- package/src/ui-app/asserts/images/bg_2_0_dark_L2.png +0 -0
- package/src/ui-app/asserts/images/favicon.svg +7 -0
- package/src/ui-app/auth/App.tsx +82 -0
- package/src/ui-app/auth/commonStyles.tsx +26 -0
- package/src/ui-app/auth/components/AuthFooter.tsx +51 -0
- package/src/ui-app/auth/components/AuthLogo.tsx +58 -0
- package/src/ui-app/auth/components/ChangePasswordForm.tsx +216 -0
- package/src/ui-app/auth/components/ChangePasswordSuccessForm.tsx +38 -0
- package/src/ui-app/auth/components/LoginForm.tsx +148 -0
- package/src/ui-app/auth/components/LogoutForm.tsx +89 -0
- package/src/ui-app/auth/components/ToggleThemeButton.tsx +41 -0
- package/src/ui-app/auth/components/change-password/Bars.tsx +45 -0
- package/src/ui-app/auth/components/change-password/PasswordRequirement.tsx +14 -0
- package/src/ui-app/auth/components/change-password/requirements.tsx +6 -0
- package/src/ui-app/auth/index.html +17 -0
- package/src/ui-app/auth/main.tsx +12 -0
- package/src/ui-app/auth/routes.tsx +26 -0
- package/src/ui-app/config.ts +15 -0
- package/src/ui-app/index.html +12 -0
- package/src/ui-app/index2/App.tsx +162 -0
- package/src/ui-app/index2/AppContext.ts +3 -0
- package/src/ui-app/index2/IndexLayout.tsx +34 -0
- package/src/ui-app/index2/components/Header/HeaderIndex.tsx +248 -0
- package/src/ui-app/index2/components/Header/QuickFilter.tsx +312 -0
- package/src/ui-app/index2/components/Navbar/Items/AcceptStatusItem.tsx +42 -0
- package/src/ui-app/index2/components/Navbar/Items/BaseItemWrapper.tsx +94 -0
- package/src/ui-app/index2/components/Navbar/Items/BrowserItem.tsx +42 -0
- package/src/ui-app/index2/components/Navbar/Items/PlatformItem.tsx +42 -0
- package/src/ui-app/index2/components/Navbar/Items/RemoveItemModalAsk.tsx +71 -0
- package/src/ui-app/index2/components/Navbar/Items/RemoveItemPopover.tsx +58 -0
- package/src/ui-app/index2/components/Navbar/Items/RemoveSuiteModalAsk.tsx +61 -0
- package/src/ui-app/index2/components/Navbar/Items/RunItem.tsx +149 -0
- package/src/ui-app/index2/components/Navbar/Items/StatusItem.tsx +42 -0
- package/src/ui-app/index2/components/Navbar/Items/SuiteItem.tsx +109 -0
- package/src/ui-app/index2/components/Navbar/Items/index.tsx +6 -0
- package/src/ui-app/index2/components/Navbar/NavbarFilter.tsx +93 -0
- package/src/ui-app/index2/components/Navbar/NavbarGroupBySelect.tsx +83 -0
- package/src/ui-app/index2/components/Navbar/NavbarIndex.tsx +247 -0
- package/src/ui-app/index2/components/Navbar/NavbarItems.tsx +38 -0
- package/src/ui-app/index2/components/Navbar/NavbarSort.tsx +105 -0
- package/src/ui-app/index2/components/Navbar/Skeletons/RunsDummySkeleton.tsx +27 -0
- package/src/ui-app/index2/components/Navbar/Skeletons/SimpleDummySkeleton.tsx +23 -0
- package/src/ui-app/index2/components/Navbar/Skeletons/SkeletonWrapper.tsx +45 -0
- package/src/ui-app/index2/components/Navbar/Skeletons/SuitesDummySkeleton.tsx +27 -0
- package/src/ui-app/index2/components/Tests/Table/AcceptTestModalAsk.tsx +68 -0
- package/src/ui-app/index2/components/Tests/Table/AcceptTestsButton.tsx +44 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/Branch.tsx +35 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/BrowserName.tsx +33 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/BrowserVersion.tsx +31 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/CellWrapper.tsx +49 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/Os.tsx +32 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/StartDate.tsx +34 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/Status.tsx +50 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/ViewPort.tsx +46 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/AcceptButton.tsx +142 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/Check.tsx +281 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/Canvas.tsx +36 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/helpers.ts +72 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/mainView.ts +495 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/sideToSideView.ts +398 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/simpleView.ts +21 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/CheckDetails.tsx +237 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Header.tsx +221 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/RelatedChecks/RelatedCheckItem.tsx +167 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/RelatedChecks/RelatedCheckSort.tsx +81 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/RelatedChecks/RelatedChecks.tsx +197 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/RelatedChecks/RelatedChecksItems.tsx +31 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/RelatedChecks/RelatedChecksSkeleton.tsx +37 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/HighlightButton.tsx +56 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/RegionsToolbar.tsx +150 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/ScreenshotDetails.tsx +137 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/Toolbar.tsx +101 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/ViewSegmentedControl.tsx +159 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/ZoomToolbar.tsx +326 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/highlightDiff.ts +167 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/hooks/useRelatedChecks.tsx +43 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckModal.tsx +119 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/Checks.tsx +91 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/ChecksSkeleton.tsx +21 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/PreviewCheckTooltipLabel.tsx +121 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/RemoveButton.tsx +63 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/ViewPortLabel.tsx +94 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/checkSizes.ts +27 -0
- package/src/ui-app/index2/components/Tests/Table/Filter.tsx +179 -0
- package/src/ui-app/index2/components/Tests/Table/Heads.tsx +54 -0
- package/src/ui-app/index2/components/Tests/Table/InfinityScrollSkeleton.tsx +71 -0
- package/src/ui-app/index2/components/Tests/Table/PagesCountAffix.tsx +61 -0
- package/src/ui-app/index2/components/Tests/Table/RefreshActionIcon.tsx +65 -0
- package/src/ui-app/index2/components/Tests/Table/RemoveTestModalAsk.tsx +66 -0
- package/src/ui-app/index2/components/Tests/Table/RemoveTestsButton.tsx +43 -0
- package/src/ui-app/index2/components/Tests/Table/Row.tsx +128 -0
- package/src/ui-app/index2/components/Tests/Table/Rows.tsx +87 -0
- package/src/ui-app/index2/components/Tests/Table/Settings.tsx +121 -0
- package/src/ui-app/index2/components/Tests/Table/TestsTable.tsx +140 -0
- package/src/ui-app/index2/components/Tests/Table/UnfoldActionIcon.tsx +39 -0
- package/src/ui-app/index2/components/Tests/Table/tableColumns.ts +80 -0
- package/src/ui-app/index2/components/Tests/Table/testsCreateStyle.tsx +35 -0
- package/src/ui-app/index2/components/Tests/Tests.tsx +157 -0
- package/src/ui-app/index2/hooks/useIndexSubpageEffect.tsx +14 -0
- package/src/ui-app/index2/hooks/useNavbarActiveItems.tsx +66 -0
- package/src/ui-app/index2/hooks/useParams.tsx +25 -0
- package/src/ui-app/index2/index.html +17 -0
- package/src/ui-app/index2/main.tsx +33 -0
- package/src/ui-app/package-lock.json +6150 -0
- package/src/ui-app/package.json +58 -0
- package/src/ui-app/shared/components/ActionPopoverIcon.tsx +116 -0
- package/src/ui-app/shared/components/Check/AcceptedStatusIcon.tsx +51 -0
- package/src/ui-app/shared/components/Check/BrowserIcon.tsx +50 -0
- package/src/ui-app/shared/components/Check/OsIcon.tsx +73 -0
- package/src/ui-app/shared/components/Check/Status.tsx +37 -0
- package/src/ui-app/shared/components/Check/StatusIcon.tsx +66 -0
- package/src/ui-app/shared/components/Email.tsx +83 -0
- package/src/ui-app/shared/components/Header/ApiKeyModalAsk.tsx +31 -0
- package/src/ui-app/shared/components/Header/ApiKeyModalResult.tsx +89 -0
- package/src/ui-app/shared/components/Header/HeaderLogo.tsx +82 -0
- package/src/ui-app/shared/components/Header/UserInfoModal.tsx +92 -0
- package/src/ui-app/shared/components/Header/UserMenu.tsx +151 -0
- package/src/ui-app/shared/components/Password.tsx +95 -0
- package/src/ui-app/shared/components/RelativeDrawer.tsx +43 -0
- package/src/ui-app/shared/components/SafeSelect.tsx +95 -0
- package/src/ui-app/shared/components/Tests/StatusesRing.tsx +66 -0
- package/src/ui-app/shared/components/ToggleThemeButton.tsx +33 -0
- package/src/ui-app/shared/components/Users/LabelUser.tsx +60 -0
- package/src/ui-app/shared/components/errors/ErrorFallback.tsx +66 -0
- package/src/ui-app/shared/components/filter/AcceptedFilter.tsx +20 -0
- package/src/ui-app/shared/components/filter/BrowserNameFilter.tsx +20 -0
- package/src/ui-app/shared/components/filter/CommonDistinctFilter.tsx +104 -0
- package/src/ui-app/shared/components/filter/DateFilter.tsx +54 -0
- package/src/ui-app/shared/components/filter/FilterWrapper.tsx +80 -0
- package/src/ui-app/shared/components/filter/IdFilter.tsx +60 -0
- package/src/ui-app/shared/components/filter/LogLevelFilter.tsx +77 -0
- package/src/ui-app/shared/components/filter/LogicalGroup.tsx +179 -0
- package/src/ui-app/shared/components/filter/OsFilter.tsx +20 -0
- package/src/ui-app/shared/components/filter/StatusFilter.tsx +20 -0
- package/src/ui-app/shared/components/filter/StringFilter.tsx +55 -0
- package/src/ui-app/shared/components/filter/index.ts +19 -0
- package/src/ui-app/shared/components/heaserLinks.tsx +4 -0
- package/src/ui-app/shared/hooks/index.ts +3 -0
- package/src/ui-app/shared/hooks/useColorSheme.ts +22 -0
- package/src/ui-app/shared/hooks/useDistinctLogQuery.tsx +33 -0
- package/src/ui-app/shared/hooks/useDistinctQuery.tsx +37 -0
- package/src/ui-app/shared/hooks/useInfinityScroll.tsx +163 -0
- package/src/ui-app/shared/hooks/useInfinityScrollRelatedChecks.tsx +60 -0
- package/src/ui-app/shared/hooks/useNavProgressFetchEffect.tsx +17 -0
- package/src/ui-app/shared/hooks/useSubpageEffect.tsx +28 -0
- package/src/ui-app/shared/hooks/user.hooks.ts +49 -0
- package/src/ui-app/shared/interfaces/ILog.tsx +13 -0
- package/src/ui-app/shared/interfaces/IUser.tsx +13 -0
- package/src/ui-app/shared/interfaces/logQueries.tsx +31 -0
- package/src/ui-app/shared/navigation/interfaces.tsx +7 -0
- package/src/ui-app/shared/navigation/navigationData.tsx +191 -0
- package/src/ui-app/shared/services/checks.service.ts +39 -0
- package/src/ui-app/shared/services/generic.service.ts +115 -0
- package/src/ui-app/shared/services/index.ts +6 -0
- package/src/ui-app/shared/services/runs.service.ts +20 -0
- package/src/ui-app/shared/services/suites.service.ts +20 -0
- package/src/ui-app/shared/services/tests.service.ts +39 -0
- package/src/ui-app/shared/services/users.service.ts +29 -0
- package/src/ui-app/shared/utils/Logger.ts +12 -0
- package/src/ui-app/shared/utils/SearchParams.ts +17 -0
- package/src/ui-app/shared/utils/filters.tsx +14 -0
- package/src/ui-app/shared/utils/index.ts +5 -0
- package/src/ui-app/shared/utils/utils.tsx +70 -0
- package/src/ui-app/stub.html +12 -0
- package/src/ui-app/stub.tsx +58 -0
- package/src/ui-app/stubDemoColors.tsx +47 -0
- package/src/ui-app/stubDemoNav.tsx +41 -0
- package/src/ui-app/tsconfig.json +21 -0
- package/src/ui-app/tsconfig.node.json +12 -0
- package/static/A.png +0 -0
- package/static/B.png +0 -0
- package/static/affected.html +39 -0
- package/static/affected_2.html +40 -0
- package/static/data/custom_devices.json +14 -0
- package/static/grids/desktop-higher.html +72 -0
- package/static/grids/desktop-wider.html +72 -0
- package/static/grids/desktop.html +61 -0
- package/static/grids/fit-in-view.html +62 -0
- package/static/js/canvasjs.min.js.bak +957 -0
- package/static/js/chart.js.bak +92 -0
- package/static/js/jquery-3.3.1.slim.js.bak +8269 -0
- package/static/js/jquery-3.3.1.slim.min.js.bak +2 -0
- package/static/js/moment.min.js.bak +2 -0
- package/static/low_diff_0.png +0 -0
- package/static/low_diff_1.png +0 -0
- package/static/vShift.png +0 -0
- package/static/vShift_bottom.png +0 -0
- package/static/vShift_top.png +0 -0
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v20.9.0
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018-2023 Viktar Silakou
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Syngrisi: Visual Testing Tool <a name="about"></a>
|
|
2
|
+
|
|
3
|
+
Syngrisi is designed to facilitate automated visual regression testing. It seamlessly integrates with both new and
|
|
4
|
+
existing test automation kits, providing an API for automated solutions and a user-friendly UI for reviewing and
|
|
5
|
+
managing visual test data.
|
|
6
|
+
|
|
7
|
+
## Try with a Single-Click
|
|
8
|
+
|
|
9
|
+
To quickly preview the project without setting it up locally, click the 'Open in Gitpod' button. Gitpod will automatically set up an environment, install the [Syngrisi Cucumber Boilerplate Project](https://github.com/syngrisi/syngrisi-cucumber-boilerplate), and launch the Syngrisi instance for you.
|
|
10
|
+
|
|
11
|
+
[](https://gitpod.io/#https://github.com/syngrisi/syngrisi-cucumber-boilerplate)
|
|
12
|
+
|
|
13
|
+
## System Prerequisites <a name="prerequisites"></a>
|
|
14
|
+
|
|
15
|
+
There are two modes in which Syngrisi can be run:
|
|
16
|
+
|
|
17
|
+
- **Native Mode:** Utilize Node.js to run Syngrisi directly on your operating system for local execution.
|
|
18
|
+
- **Container Mode:** Utilizing Docker and Docker Compose, this mode is more apt for production environments.
|
|
19
|
+
|
|
20
|
+
### Native Mode
|
|
21
|
+
|
|
22
|
+
* [NodeJS](https://nodejs.org/en/download/) `v20.9.0` or above.
|
|
23
|
+
* [MongoDB Community Edition](https://docs.mongodb.com/manual/administration/install-community/) `6.0` or above
|
|
24
|
+
|
|
25
|
+
### Container Mode
|
|
26
|
+
|
|
27
|
+
* [Docker + Docker Compose](https://docs.docker.com/engine/install/)
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
https://user-images.githubusercontent.com/23633060/225095007-39ee0a29-61c1-4f46-99ab-1af67052accb.mp4
|
|
32
|
+
|
|
33
|
+
> 💡If you want to try Syngrisi for the first time, you can use [boilerplate projects](#boilerplates); they are installed easily and quickly and allow you to evaluate the basic capabilities of the tool.
|
|
34
|
+
|
|
35
|
+
### Native Mode Installation
|
|
36
|
+
|
|
37
|
+
To install Syngrisi in the current folder:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm init sy@latest
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
To install to a specific folder:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm init sy@latest <path_to_syngrisi>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
For more details on setup customization, refer to the [create-sy](../create-sy) package documentation.
|
|
50
|
+
|
|
51
|
+
> ⚠️ Important: Ensure that MongoDB is running before starting Syngrisi in native mode.
|
|
52
|
+
|
|
53
|
+
To run the server, execute:
|
|
54
|
+
|
|
55
|
+
```shell script
|
|
56
|
+
npx sy
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Container Mode
|
|
60
|
+
|
|
61
|
+
In addition to running the application natively, it can also be launched in a Docker container using a Docker Compose
|
|
62
|
+
file. To download and execute Docker and Docker Compose files for Syngrisi, follow these steps:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Check if docker-compose is installed
|
|
66
|
+
command -v docker-compose >/dev/null 2>&1 || { echo >&2 "docker-compose is required; please install it and run this command again."; exit 1; }
|
|
67
|
+
|
|
68
|
+
# Create the project folder
|
|
69
|
+
mkdir my_new_syngrisi_project && cd my_new_syngrisi_project
|
|
70
|
+
|
|
71
|
+
# Download Docker and Docker Compose files
|
|
72
|
+
curl -LO https://raw.githubusercontent.com/syngrisi/syngrisi/main/packages/syngrisi/syngrisi-app.dockerfile
|
|
73
|
+
curl -LO https://raw.githubusercontent.com/syngrisi/syngrisi/main/packages/syngrisi/docker-compose.yml
|
|
74
|
+
|
|
75
|
+
# Create and start services
|
|
76
|
+
sudo docker-compose up
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
You are free to modify the Docker Compose file according to your requirements. Ensure that service definitions and options are set up correctly; otherwise, services may not function as expected.
|
|
80
|
+
|
|
81
|
+
Environment variables for Docker Compose can be configured either in an environment file or directly in the shell. For detailed
|
|
82
|
+
configuration instructions, please refer to the Syngrisi documentation.
|
|
83
|
+
|
|
84
|
+
```shell script
|
|
85
|
+
sudo docker-compose up
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Syngrisi Boilerplates <a name="boilerplates"></a>
|
|
89
|
+
|
|
90
|
+
To quickly take a look at Syngrisi or start a new automation test project, you can use one of the boilerplates:
|
|
91
|
+
|
|
92
|
+
* [Syngrisi Cucumber Boilerplate project](https://github.com/syngrisi/syngrisi-cucumber-boilerplate): the project contains all the necessary steps for functional tests + steps for visual checks.
|
|
93
|
+
* [Syngrisi Playwright Boilerplate](https://github.com/syngrisi/syngrisi-playwright-boilerplate): Starter project for functional Playwright tests with the ability to do visual checks based on Syngrisi
|
|
94
|
+
|
|
95
|
+
## Configuration via Environment Variables <a name="env"></a>
|
|
96
|
+
|
|
97
|
+
Customize Syngrisi's behavior effortlessly using environment variables, without any need to modify the codebase.
|
|
98
|
+
The System Environment variables have priority more than correspondent Syngrisi Admin Settings if they exist.
|
|
99
|
+
For example, to set the log level to debug, use the following command:
|
|
100
|
+
|
|
101
|
+
Windows:`set SYNGRISI_LOG_LEVEL=debug`
|
|
102
|
+
macOS/Linux: `export SYNGRISI_LOG_LEVEL=debug`
|
|
103
|
+
|
|
104
|
+
You can also include the variables in your `.env` or modify variables in `docker-compose.yml` file before start Syngrisi
|
|
105
|
+
service.
|
|
106
|
+
|
|
107
|
+
| Variable | Host | Docker | Description | Default Value |
|
|
108
|
+
|--------------------------------|------|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|
|
|
109
|
+
| `SYNGRISI_DOCKER_IMAGES_PATH` | - | + | Path to the internal Docker folder for Syngrisi images, including screenshots and diffs. | `./.snapshots-images` |
|
|
110
|
+
| `SYNGRISI_DOCKER_PORT` | - | + | Docker external Syngrisi App Server Port (host port) | `5000` |
|
|
111
|
+
| `SYNGRISI_DOCKER_DB_PORT` | - | + | Docker external Syngrisi Database Server Port (host port) | `27017` |
|
|
112
|
+
| `SYNGRISI_DOCKER_DB_AUTH_ARG` | - | + | To enable mongo database authentication set it to `--auth` be sure that you create user for `SyngrisiDb` database and add appropriate values to connection string | `--noauth` |
|
|
113
|
+
| `SYNGRISI_DOCKER_BACKUPS_PATH` | - | + | Host Backup Folder path | ./backups/ |
|
|
114
|
+
| `SYNGRISI_DOCKER_DB_PATH` | - | + | Host Path to Syngrisi Database files | `./data/db_data` |
|
|
115
|
+
| `SYNGRISI_DB_URI` | + | + | [Connection URI](https://www.mongodb.com/docs/manual/reference/connection-string/) for Mongo DB service | `mongodb://127.0.0.1:27017/SyngrisiDb` |
|
|
116
|
+
| `SYNGRISI_IMAGES_PATH` | + | + | Path to the folder for Syngrisi images, including screenshots and diffs. | `./.snapshots-images/` |
|
|
117
|
+
| `SYNGRISI_APP_PORT` | + | - | TCP port for application server | `3000` |
|
|
118
|
+
| `SYNGRISI_AUTH` | + | + | Enables authentication | `1` |
|
|
119
|
+
| `MONGODB_ROOT_USERNAME` | - | + | Username for the Database Root user, that will be created at first Applications start | - |
|
|
120
|
+
| `MONGODB_ROOT_PASSWORD` | - | + | Password for the Database Root user, that will be created at first Applications start | - |
|
|
121
|
+
| `LOGLEVEL` | + | - | Log level (`error` `warn`,`info`,`verbose`,`debug`,`silly`) | `debug` |
|
|
122
|
+
| `SYNGRISI_PAGINATION_SIZE` | + | - | Number of tests items on that return `/checks?page={page_num}` API | `50` |
|
|
123
|
+
| `SYNGRISI_TEST_MODE` | + | + | Enables test admin user if equal `1`, used only for tests purposes | `0` |
|
|
124
|
+
| `SYNGRISI_DISABLE_FIRST_RUN` | + | + | Disable first run procedure, disabled if equal `1`, used only for tests purposes | `0` |
|
|
125
|
+
| `SYNGRISI_DISABLE_DEV_CORS` | + | - | Disable CORS for vite dev server, only for dev and test purposes | `-` |
|
|
126
|
+
| `SYNGRISI_SESSION_STORE_KEY` | + | + | A Secret for session storage | random generated |
|
|
127
|
+
| `SYNGRISI_COVERAGE` | + | - | Enable coverage, if `true` generated coverage data to `./coverage` | - |
|
|
128
|
+
| `SYNGRISI_HTTP_LOG` | + | + | Enable HTTP logs, if `true` logging all HTTP request to `./logs/http.log` file | `false` |
|
|
129
|
+
|
|
130
|
+
## Devices list <a name="devices"></a>
|
|
131
|
+
|
|
132
|
+
Syngrisi includes a [list](./static/data/custom_devices.json) of recognized devices, sourced from BrowserStack.
|
|
133
|
+
|
|
134
|
+
The application sets the platform icon based on this list. Do not edit this file directly. If you wish to add your own devices, simply create an additional file named `custom_devices.json`; the data from this file will be appended to the main list.
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
|
|
138
|
+
Syngrisi is available under the MIT License. For more details, refer to the [LICENSE](./LICENSE.md) file.
|
|
139
|
+
|
package/config.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
require('dotenv')
|
|
3
|
+
.config();
|
|
4
|
+
|
|
5
|
+
const bsPath = process.env.SYNGRISI_IMAGES_PATH || './.snapshots-images/';
|
|
6
|
+
if (!fs.existsSync(bsPath)) {
|
|
7
|
+
fs.mkdirSync(bsPath, { recursive: true });
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
exports.config = {
|
|
11
|
+
defaultImagesPath: bsPath,
|
|
12
|
+
connectionString: process.env.SYNGRISI_DB_URI || process.env.VRS_CONN_STRING || 'mongodb://127.0.0.1:27017/SyngrisiDb',
|
|
13
|
+
port: process.env.SYNGRISI_APP_PORT || 3000,
|
|
14
|
+
backupsFolder: './backups',
|
|
15
|
+
enableHttpLogger: process.env.SYNGRISI_HTTP_LOG,
|
|
16
|
+
httpLoggerFilePath: './logs/http.log'
|
|
17
|
+
};
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
require('dotenv')
|
|
4
|
+
.config();
|
|
5
|
+
const bsPath = process.env.SYNGRISI_IMAGES_PATH || './.snapshots-images/';
|
|
6
|
+
if (!fs.existsSync(bsPath)) {
|
|
7
|
+
fs.mkdirSync(bsPath, { recursive: true });
|
|
8
|
+
}
|
|
9
|
+
exports.config = {
|
|
10
|
+
defaultImagesPath: bsPath,
|
|
11
|
+
connectionString: process.env.SYNGRISI_DB_URI || process.env.VRS_CONN_STRING || 'mongodb://127.0.0.1:27017/SyngrisiDb',
|
|
12
|
+
port: process.env.SYNGRISI_APP_PORT || 3000,
|
|
13
|
+
backupsFolder: './backups',
|
|
14
|
+
enableHttpLogger: process.env.SYNGRISI_HTTP_LOG,
|
|
15
|
+
httpLoggerFilePath: './logs/http.log'
|
|
16
|
+
};
|
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable valid-jsdoc,func-names */
|
|
3
|
+
const passportLocalMongoose = require('passport-local-mongoose');
|
|
4
|
+
const mongoose = require('mongoose');
|
|
5
|
+
const { toJSON, paginate, paginateDistinct } = require('./plugins');
|
|
6
|
+
const { Schema } = mongoose;
|
|
7
|
+
const SnapshotSchema = new Schema({
|
|
8
|
+
name: {
|
|
9
|
+
type: String,
|
|
10
|
+
required: 'SnapshotSchema: the name of the snapshot entity is empty',
|
|
11
|
+
},
|
|
12
|
+
path: {
|
|
13
|
+
type: String,
|
|
14
|
+
},
|
|
15
|
+
filename: {
|
|
16
|
+
type: String,
|
|
17
|
+
},
|
|
18
|
+
imghash: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: 'SnapshotSchema: the image hash of the snapshot entity is empty',
|
|
21
|
+
},
|
|
22
|
+
createdDate: {
|
|
23
|
+
type: Date,
|
|
24
|
+
default: Date.now,
|
|
25
|
+
},
|
|
26
|
+
vOffset: {
|
|
27
|
+
type: Number,
|
|
28
|
+
},
|
|
29
|
+
hOffset: {
|
|
30
|
+
type: Number,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
const CheckSchema = new Schema({
|
|
34
|
+
name: {
|
|
35
|
+
type: String,
|
|
36
|
+
required: 'CheckSchema: the name of the check entity is empty',
|
|
37
|
+
},
|
|
38
|
+
test: {
|
|
39
|
+
type: Schema.Types.ObjectId,
|
|
40
|
+
ref: 'VRSTest',
|
|
41
|
+
required: 'CheckSchema: the test name of the check entity is empty',
|
|
42
|
+
},
|
|
43
|
+
suite: {
|
|
44
|
+
type: Schema.Types.ObjectId,
|
|
45
|
+
ref: 'VRSSuite',
|
|
46
|
+
required: 'CheckSchema: the app field is empty',
|
|
47
|
+
},
|
|
48
|
+
app: {
|
|
49
|
+
type: Schema.Types.ObjectId,
|
|
50
|
+
ref: 'VRSApp',
|
|
51
|
+
required: 'CheckSchema: the app field is empty',
|
|
52
|
+
},
|
|
53
|
+
branch: {
|
|
54
|
+
type: String,
|
|
55
|
+
},
|
|
56
|
+
realBaselineId: {
|
|
57
|
+
type: Schema.Types.ObjectId,
|
|
58
|
+
ref: 'VRSBaseline',
|
|
59
|
+
},
|
|
60
|
+
baselineId: {
|
|
61
|
+
type: Schema.Types.ObjectId,
|
|
62
|
+
ref: 'VRSSnapshot',
|
|
63
|
+
},
|
|
64
|
+
actualSnapshotId: {
|
|
65
|
+
type: Schema.Types.ObjectId,
|
|
66
|
+
ref: 'VRSSnapshot',
|
|
67
|
+
},
|
|
68
|
+
diffId: {
|
|
69
|
+
type: Schema.Types.ObjectId,
|
|
70
|
+
ref: 'VRSSnapshot',
|
|
71
|
+
},
|
|
72
|
+
createdDate: {
|
|
73
|
+
type: Date,
|
|
74
|
+
required: true,
|
|
75
|
+
default: Date.now,
|
|
76
|
+
},
|
|
77
|
+
updatedDate: {
|
|
78
|
+
type: Date,
|
|
79
|
+
},
|
|
80
|
+
status: {
|
|
81
|
+
type: [{
|
|
82
|
+
type: String,
|
|
83
|
+
enum: {
|
|
84
|
+
values: ['new', 'pending', 'approved', 'running', 'passed', 'failed', 'aborted'],
|
|
85
|
+
message: 'status is required',
|
|
86
|
+
},
|
|
87
|
+
}],
|
|
88
|
+
default: 'new',
|
|
89
|
+
},
|
|
90
|
+
browserName: {
|
|
91
|
+
type: String,
|
|
92
|
+
},
|
|
93
|
+
browserVersion: {
|
|
94
|
+
type: String,
|
|
95
|
+
},
|
|
96
|
+
browserFullVersion: {
|
|
97
|
+
type: String,
|
|
98
|
+
},
|
|
99
|
+
viewport: {
|
|
100
|
+
type: String,
|
|
101
|
+
},
|
|
102
|
+
os: {
|
|
103
|
+
type: String,
|
|
104
|
+
},
|
|
105
|
+
domDump: {
|
|
106
|
+
type: String,
|
|
107
|
+
},
|
|
108
|
+
result: {
|
|
109
|
+
type: String,
|
|
110
|
+
default: '{}',
|
|
111
|
+
},
|
|
112
|
+
run: {
|
|
113
|
+
type: Schema.Types.ObjectId,
|
|
114
|
+
},
|
|
115
|
+
markedAs: {
|
|
116
|
+
type: String,
|
|
117
|
+
enum: ['bug', 'accepted'],
|
|
118
|
+
},
|
|
119
|
+
markedDate: {
|
|
120
|
+
type: Date,
|
|
121
|
+
},
|
|
122
|
+
markedById: {
|
|
123
|
+
type: Schema.Types.ObjectId,
|
|
124
|
+
ref: 'VRSUser',
|
|
125
|
+
},
|
|
126
|
+
markedByUsername: {
|
|
127
|
+
type: String,
|
|
128
|
+
},
|
|
129
|
+
markedBugComment: {
|
|
130
|
+
type: String,
|
|
131
|
+
},
|
|
132
|
+
creatorId: {
|
|
133
|
+
type: Schema.Types.ObjectId,
|
|
134
|
+
ref: 'VRSUser',
|
|
135
|
+
},
|
|
136
|
+
creatorUsername: {
|
|
137
|
+
type: String,
|
|
138
|
+
},
|
|
139
|
+
failReasons: {
|
|
140
|
+
type: [String],
|
|
141
|
+
},
|
|
142
|
+
vOffset: {
|
|
143
|
+
type: String,
|
|
144
|
+
},
|
|
145
|
+
topStablePixels: {
|
|
146
|
+
type: String,
|
|
147
|
+
},
|
|
148
|
+
meta: {
|
|
149
|
+
type: Object,
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
const BaselineSchema = new Schema({
|
|
153
|
+
snapshootId: Schema.Types.ObjectId,
|
|
154
|
+
name: {
|
|
155
|
+
type: String,
|
|
156
|
+
required: 'VRSBaselineSchema: the name of the snapshoot entity is empty',
|
|
157
|
+
},
|
|
158
|
+
app: {
|
|
159
|
+
type: Schema.Types.ObjectId,
|
|
160
|
+
ref: 'VRSApp',
|
|
161
|
+
required: 'VRSBaselineSchema: the app field is empty',
|
|
162
|
+
},
|
|
163
|
+
branch: {
|
|
164
|
+
type: String,
|
|
165
|
+
},
|
|
166
|
+
browserName: {
|
|
167
|
+
type: String,
|
|
168
|
+
},
|
|
169
|
+
browserVersion: {
|
|
170
|
+
type: String,
|
|
171
|
+
},
|
|
172
|
+
browserFullVersion: {
|
|
173
|
+
type: String,
|
|
174
|
+
},
|
|
175
|
+
viewport: {
|
|
176
|
+
type: String,
|
|
177
|
+
},
|
|
178
|
+
os: {
|
|
179
|
+
type: String,
|
|
180
|
+
},
|
|
181
|
+
markedAs: {
|
|
182
|
+
type: String,
|
|
183
|
+
enum: ['bug', 'accepted'],
|
|
184
|
+
},
|
|
185
|
+
lastMarkedDate: {
|
|
186
|
+
type: Date,
|
|
187
|
+
},
|
|
188
|
+
createdDate: {
|
|
189
|
+
type: Date,
|
|
190
|
+
},
|
|
191
|
+
updatedDate: {
|
|
192
|
+
type: Date,
|
|
193
|
+
},
|
|
194
|
+
markedById: {
|
|
195
|
+
type: Schema.Types.ObjectId,
|
|
196
|
+
ref: 'VRSUser',
|
|
197
|
+
},
|
|
198
|
+
markedByUsername: {
|
|
199
|
+
type: String,
|
|
200
|
+
},
|
|
201
|
+
ignoreRegions: {
|
|
202
|
+
type: String,
|
|
203
|
+
},
|
|
204
|
+
boundRegions: {
|
|
205
|
+
type: String,
|
|
206
|
+
},
|
|
207
|
+
matchType: {
|
|
208
|
+
type: String,
|
|
209
|
+
// enum: ['antialiasing', 'nothing', 'less', 'colors', 'alpha'],
|
|
210
|
+
enum: ['antialiasing', 'nothing', 'colors'],
|
|
211
|
+
},
|
|
212
|
+
meta: {
|
|
213
|
+
type: Object,
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
const TestSchema = new Schema({
|
|
217
|
+
name: {
|
|
218
|
+
type: String,
|
|
219
|
+
required: 'TestSchema: the test name is empty',
|
|
220
|
+
},
|
|
221
|
+
description: {
|
|
222
|
+
type: String,
|
|
223
|
+
},
|
|
224
|
+
status: {
|
|
225
|
+
type: String,
|
|
226
|
+
},
|
|
227
|
+
browserName: {
|
|
228
|
+
type: String,
|
|
229
|
+
},
|
|
230
|
+
browserVersion: {
|
|
231
|
+
type: String,
|
|
232
|
+
},
|
|
233
|
+
branch: {
|
|
234
|
+
type: String,
|
|
235
|
+
},
|
|
236
|
+
tags: {
|
|
237
|
+
type: [String],
|
|
238
|
+
},
|
|
239
|
+
viewport: {
|
|
240
|
+
type: String,
|
|
241
|
+
},
|
|
242
|
+
// after handle all checks inside the test
|
|
243
|
+
calculatedViewport: {
|
|
244
|
+
type: String,
|
|
245
|
+
},
|
|
246
|
+
os: {
|
|
247
|
+
type: String,
|
|
248
|
+
},
|
|
249
|
+
app: {
|
|
250
|
+
type: Schema.Types.ObjectId,
|
|
251
|
+
ref: 'VRSApp',
|
|
252
|
+
required: 'TestSchema: the app field is empty',
|
|
253
|
+
},
|
|
254
|
+
blinking: {
|
|
255
|
+
type: Number,
|
|
256
|
+
default: 0,
|
|
257
|
+
},
|
|
258
|
+
updatedDate: {
|
|
259
|
+
type: Date,
|
|
260
|
+
},
|
|
261
|
+
startDate: {
|
|
262
|
+
type: Date,
|
|
263
|
+
},
|
|
264
|
+
checks: [
|
|
265
|
+
{
|
|
266
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
267
|
+
ref: 'VRSCheck',
|
|
268
|
+
},
|
|
269
|
+
],
|
|
270
|
+
suite: {
|
|
271
|
+
type: Schema.Types.ObjectId,
|
|
272
|
+
ref: 'VRSSuite',
|
|
273
|
+
},
|
|
274
|
+
run: {
|
|
275
|
+
type: Schema.Types.ObjectId,
|
|
276
|
+
ref: 'VRSRun',
|
|
277
|
+
},
|
|
278
|
+
markedAs: {
|
|
279
|
+
type: String,
|
|
280
|
+
enum: ['Bug', 'Accepted', 'Unaccepted', 'Partially'],
|
|
281
|
+
},
|
|
282
|
+
creatorId: {
|
|
283
|
+
type: Schema.Types.ObjectId,
|
|
284
|
+
ref: 'VRSUser',
|
|
285
|
+
},
|
|
286
|
+
creatorUsername: {
|
|
287
|
+
type: String,
|
|
288
|
+
},
|
|
289
|
+
meta: {
|
|
290
|
+
type: Object,
|
|
291
|
+
},
|
|
292
|
+
}, { strictQuery: true }); // remove filters that not exist in schema
|
|
293
|
+
const SuiteSchema = new Schema({
|
|
294
|
+
name: {
|
|
295
|
+
type: String,
|
|
296
|
+
default: 'Others',
|
|
297
|
+
unique: true,
|
|
298
|
+
required: 'SuiteSchema: the suite name is empty',
|
|
299
|
+
},
|
|
300
|
+
tags: {
|
|
301
|
+
type: [String],
|
|
302
|
+
},
|
|
303
|
+
app: {
|
|
304
|
+
type: Schema.Types.ObjectId,
|
|
305
|
+
ref: 'VRSApp',
|
|
306
|
+
required: 'SuiteSchema: the app field is empty',
|
|
307
|
+
},
|
|
308
|
+
description: {
|
|
309
|
+
type: String,
|
|
310
|
+
},
|
|
311
|
+
updatedDate: {
|
|
312
|
+
type: Date,
|
|
313
|
+
default: Date.now,
|
|
314
|
+
},
|
|
315
|
+
createdDate: {
|
|
316
|
+
type: Date,
|
|
317
|
+
},
|
|
318
|
+
meta: {
|
|
319
|
+
type: Object,
|
|
320
|
+
},
|
|
321
|
+
});
|
|
322
|
+
const RunSchema = new Schema({
|
|
323
|
+
name: {
|
|
324
|
+
type: String,
|
|
325
|
+
required: 'RunSchema: the run name cannot be empty',
|
|
326
|
+
},
|
|
327
|
+
app: {
|
|
328
|
+
type: Schema.Types.ObjectId,
|
|
329
|
+
ref: 'VRSApp',
|
|
330
|
+
required: 'RunSchema: the app field is empty',
|
|
331
|
+
},
|
|
332
|
+
ident: {
|
|
333
|
+
type: String,
|
|
334
|
+
unique: true,
|
|
335
|
+
required: 'RunSchema: the run ident run cannot be empty',
|
|
336
|
+
},
|
|
337
|
+
description: {
|
|
338
|
+
type: String,
|
|
339
|
+
},
|
|
340
|
+
updatedDate: {
|
|
341
|
+
type: Date,
|
|
342
|
+
default: Date.now,
|
|
343
|
+
},
|
|
344
|
+
createdDate: {
|
|
345
|
+
type: Date,
|
|
346
|
+
},
|
|
347
|
+
parameters: {
|
|
348
|
+
type: [String],
|
|
349
|
+
},
|
|
350
|
+
meta: {
|
|
351
|
+
type: Object,
|
|
352
|
+
},
|
|
353
|
+
});
|
|
354
|
+
const LogSchema = new Schema({
|
|
355
|
+
timestamp: {
|
|
356
|
+
type: Date,
|
|
357
|
+
},
|
|
358
|
+
level: {
|
|
359
|
+
type: String,
|
|
360
|
+
},
|
|
361
|
+
message: {
|
|
362
|
+
type: String,
|
|
363
|
+
},
|
|
364
|
+
meta: {
|
|
365
|
+
type: Object,
|
|
366
|
+
},
|
|
367
|
+
hostname: {
|
|
368
|
+
type: Object,
|
|
369
|
+
},
|
|
370
|
+
});
|
|
371
|
+
// this is the Projects Schema `VRSAppSchema` name is for historical reason
|
|
372
|
+
const AppSchema = new Schema({
|
|
373
|
+
name: {
|
|
374
|
+
type: String,
|
|
375
|
+
default: 'Others',
|
|
376
|
+
unique: true,
|
|
377
|
+
required: 'AppSchema: the Application name is empty',
|
|
378
|
+
},
|
|
379
|
+
description: {
|
|
380
|
+
type: String,
|
|
381
|
+
},
|
|
382
|
+
version: {
|
|
383
|
+
type: String,
|
|
384
|
+
},
|
|
385
|
+
updatedDate: {
|
|
386
|
+
type: Date,
|
|
387
|
+
},
|
|
388
|
+
createdDate: {
|
|
389
|
+
type: Date,
|
|
390
|
+
},
|
|
391
|
+
meta: {
|
|
392
|
+
type: Object,
|
|
393
|
+
},
|
|
394
|
+
});
|
|
395
|
+
const UserSchema = new Schema({
|
|
396
|
+
username: {
|
|
397
|
+
type: String,
|
|
398
|
+
unique: true,
|
|
399
|
+
required: 'UserSchema: the username name is empty',
|
|
400
|
+
},
|
|
401
|
+
firstName: {
|
|
402
|
+
type: String,
|
|
403
|
+
required: 'UserSchema: the firstName name is empty',
|
|
404
|
+
},
|
|
405
|
+
lastName: {
|
|
406
|
+
type: String,
|
|
407
|
+
required: 'UserSchema: the lastName name is empty',
|
|
408
|
+
},
|
|
409
|
+
role: {
|
|
410
|
+
type: String,
|
|
411
|
+
enum: {
|
|
412
|
+
values: ['admin', 'reviewer', 'user'],
|
|
413
|
+
message: 'UserSchema: role is required',
|
|
414
|
+
required: 'UserSchema: role is required',
|
|
415
|
+
},
|
|
416
|
+
},
|
|
417
|
+
password: {
|
|
418
|
+
type: String,
|
|
419
|
+
},
|
|
420
|
+
token: {
|
|
421
|
+
type: String,
|
|
422
|
+
},
|
|
423
|
+
apiKey: {
|
|
424
|
+
type: String,
|
|
425
|
+
},
|
|
426
|
+
createdDate: {
|
|
427
|
+
type: Date,
|
|
428
|
+
},
|
|
429
|
+
updatedDate: {
|
|
430
|
+
type: Date,
|
|
431
|
+
},
|
|
432
|
+
expiration: {
|
|
433
|
+
type: Date,
|
|
434
|
+
},
|
|
435
|
+
meta: {
|
|
436
|
+
type: Object,
|
|
437
|
+
},
|
|
438
|
+
});
|
|
439
|
+
const AppSettingsSchema = new Schema({
|
|
440
|
+
name: {
|
|
441
|
+
type: String,
|
|
442
|
+
unique: true,
|
|
443
|
+
required: 'AppSettingsSchema: the name is empty',
|
|
444
|
+
},
|
|
445
|
+
label: {
|
|
446
|
+
type: String,
|
|
447
|
+
required: 'AppSettingsSchema: the label is empty',
|
|
448
|
+
},
|
|
449
|
+
description: {
|
|
450
|
+
type: String,
|
|
451
|
+
},
|
|
452
|
+
type: {
|
|
453
|
+
type: String,
|
|
454
|
+
required: 'AppSettingsSchema: the type is empty',
|
|
455
|
+
},
|
|
456
|
+
value: {
|
|
457
|
+
type: Schema.Types.Mixed,
|
|
458
|
+
required: 'AppSettingsSchema: the value is empty',
|
|
459
|
+
},
|
|
460
|
+
env_variable: {
|
|
461
|
+
type: String,
|
|
462
|
+
},
|
|
463
|
+
enabled: {
|
|
464
|
+
type: Boolean,
|
|
465
|
+
},
|
|
466
|
+
});
|
|
467
|
+
AppSettingsSchema.plugin(toJSON);
|
|
468
|
+
LogSchema.plugin(toJSON);
|
|
469
|
+
LogSchema.plugin(paginate);
|
|
470
|
+
UserSchema.plugin(toJSON);
|
|
471
|
+
UserSchema.plugin(paginate);
|
|
472
|
+
RunSchema.plugin(paginate);
|
|
473
|
+
RunSchema.plugin(toJSON);
|
|
474
|
+
SuiteSchema.plugin(paginate);
|
|
475
|
+
SuiteSchema.plugin(toJSON);
|
|
476
|
+
AppSchema.plugin(paginate);
|
|
477
|
+
AppSchema.plugin(toJSON);
|
|
478
|
+
BaselineSchema.plugin(toJSON);
|
|
479
|
+
BaselineSchema.plugin(paginate);
|
|
480
|
+
SnapshotSchema.plugin(toJSON);
|
|
481
|
+
SnapshotSchema.plugin(paginate);
|
|
482
|
+
CheckSchema.plugin(toJSON);
|
|
483
|
+
CheckSchema.plugin(paginate);
|
|
484
|
+
TestSchema.plugin(toJSON);
|
|
485
|
+
TestSchema.plugin(paginate);
|
|
486
|
+
TestSchema.plugin(paginateDistinct);
|
|
487
|
+
/**
|
|
488
|
+
* Check if email is taken
|
|
489
|
+
* @param {string} username - The user's email
|
|
490
|
+
* @param {ObjectId} [excludeUserId] - The id of the user to be excluded
|
|
491
|
+
* @returns {Promise<boolean>}
|
|
492
|
+
*/
|
|
493
|
+
UserSchema.statics.isEmailTaken = async function (username, excludeUserId) {
|
|
494
|
+
const user = await this.findOne({ username, _id: { $ne: excludeUserId } });
|
|
495
|
+
return !!user;
|
|
496
|
+
};
|
|
497
|
+
UserSchema.plugin(passportLocalMongoose, { hashField: 'password' });
|
|
498
|
+
const Snapshot = mongoose.model('VRSSnapshot', SnapshotSchema);
|
|
499
|
+
const Check = mongoose.model('VRSCheck', CheckSchema);
|
|
500
|
+
const Test = mongoose.model('VRSTest', TestSchema);
|
|
501
|
+
const Log = mongoose.model('VRSLog', LogSchema);
|
|
502
|
+
const Suite = mongoose.model('VRSSuite', SuiteSchema);
|
|
503
|
+
const App = mongoose.model('VRSApp', AppSchema);
|
|
504
|
+
const Run = mongoose.model('VRSRun', RunSchema);
|
|
505
|
+
const User = mongoose.model('VRSUser', UserSchema);
|
|
506
|
+
const Baseline = mongoose.model('VRSBaseline', BaselineSchema);
|
|
507
|
+
const AppSettings = mongoose.model('VRSAppSettings', AppSettingsSchema);
|
|
508
|
+
module.exports = { Snapshot, Check, Test, Log, Suite, App, Run, User, Baseline, AppSettings };
|