From 09c6db9bb5bcbc2b4a34f3f1f2c96e660593e103 Mon Sep 17 00:00:00 2001 From: Mariia Aloshyna <55138456+mariia-aloshyna@users.noreply.github.com> Date: Thu, 31 Aug 2023 16:42:56 +0300 Subject: [PATCH] UIPFIMP-59: upgrade React to v18 and remove bigtest (#146) --- CHANGELOG.md | 3 +- index.js | 2 +- jest.config.js | 5 +- karma.conf.js | 2 - package.json | 44 +- .../FindImportProfile}/FindImportProfile.js | 0 .../FindImportProfile.test.js | 4 +- .../AbstractContainer.js | 0 .../ActionProfilesContainer.js | 0 .../JobProfilesContainer.js | 0 .../MappingProfilesContainer.js | 0 .../MatchProfilesContainer.js | 0 .../FindImportProfileContainer/index.js | 0 .../tests/ActionProfilesContainer.test.js | 4 +- .../tests/JobProfilesContainer.test.js | 4 +- .../tests/MappingProfilesContainer.test.js | 4 +- .../tests/MatchProfilesContainer.test.js | 4 +- .../FindImportProfile}/index.js | 0 .../utils/fetchAssociations.js | 0 test/bigtest/.eslintrc | 8 - test/bigtest/helpers/PluginHarness.js | 82 ---- .../helpers/PluginHarnessSingleSelect.js | 83 ---- test/bigtest/helpers/appInit.js | 38 -- test/bigtest/index.js | 7 - .../interactors/ApplicationInteractor.js | 12 - .../findImportProfileInteractor.js | 53 --- test/bigtest/mocks/actionProfiles.js | 69 --- test/bigtest/mocks/fieldMappingProfiles.js | 66 --- test/bigtest/mocks/profileAssociations.js | 28 -- test/bigtest/network/index.js | 31 -- test/bigtest/tests/findImportProfiles.e2e.js | 253 ----------- .../findImportProfilesSingleSelect.e2e.js | 193 --------- .../tests/relinkConfirmationModal.e2e.js | 397 ------------------ 33 files changed, 34 insertions(+), 1362 deletions(-) delete mode 100644 karma.conf.js rename {FindImportProfile => src/FindImportProfile}/FindImportProfile.js (100%) rename {FindImportProfile => src/FindImportProfile}/FindImportProfile.test.js (98%) rename {FindImportProfile => src/FindImportProfile}/FindImportProfileContainer/AbstractContainer.js (100%) rename {FindImportProfile => src/FindImportProfile}/FindImportProfileContainer/ActionProfilesContainer.js (100%) rename {FindImportProfile => src/FindImportProfile}/FindImportProfileContainer/JobProfilesContainer.js (100%) rename {FindImportProfile => src/FindImportProfile}/FindImportProfileContainer/MappingProfilesContainer.js (100%) rename {FindImportProfile => src/FindImportProfile}/FindImportProfileContainer/MatchProfilesContainer.js (100%) rename {FindImportProfile => src/FindImportProfile}/FindImportProfileContainer/index.js (100%) rename {FindImportProfile => src/FindImportProfile}/FindImportProfileContainer/tests/ActionProfilesContainer.test.js (96%) rename {FindImportProfile => src/FindImportProfile}/FindImportProfileContainer/tests/JobProfilesContainer.test.js (95%) rename {FindImportProfile => src/FindImportProfile}/FindImportProfileContainer/tests/MappingProfilesContainer.test.js (95%) rename {FindImportProfile => src/FindImportProfile}/FindImportProfileContainer/tests/MatchProfilesContainer.test.js (95%) rename {FindImportProfile => src/FindImportProfile}/index.js (100%) rename {FindImportProfile => src/FindImportProfile}/utils/fetchAssociations.js (100%) delete mode 100644 test/bigtest/.eslintrc delete mode 100644 test/bigtest/helpers/PluginHarness.js delete mode 100644 test/bigtest/helpers/PluginHarnessSingleSelect.js delete mode 100644 test/bigtest/helpers/appInit.js delete mode 100644 test/bigtest/index.js delete mode 100644 test/bigtest/interactors/ApplicationInteractor.js delete mode 100644 test/bigtest/interactors/findImportProfileInteractor.js delete mode 100644 test/bigtest/mocks/actionProfiles.js delete mode 100644 test/bigtest/mocks/fieldMappingProfiles.js delete mode 100644 test/bigtest/mocks/profileAssociations.js delete mode 100644 test/bigtest/network/index.js delete mode 100644 test/bigtest/tests/findImportProfiles.e2e.js delete mode 100644 test/bigtest/tests/findImportProfilesSingleSelect.e2e.js delete mode 100644 test/bigtest/tests/relinkConfirmationModal.e2e.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 2326ae5..2311865 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,12 @@ # Change history for ui-plugin-find-import-profile -## **6.1.0** (in progress) +## **7.0.0** (in progress) ### Features added: * Add accessibiity testing to automated tests in UIPFIMP (UIPFIMP-57) * Return profile associations when linking the profile instead of the record itself (UIPFIMP-58) * Update Node.js to v18 in GitHub Actions (UIPFIMP-60) +* *BREAKING* bump `react` to `v18`, and get rid of bigtest (UIPFIMP-59) ## [6.0.1](https://github.com/folio-org/ui-plugin-find-import-profile/tree/v6.0.1) (2023-02-24) diff --git a/index.js b/index.js index 0458c71..95f5ee5 100644 --- a/index.js +++ b/index.js @@ -1 +1 @@ -export { default } from './FindImportProfile'; +export { default } from './src/FindImportProfile'; diff --git a/jest.config.js b/jest.config.js index 40c021c..f2b24de 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,7 +1,7 @@ // eslint-disable-next-line import/no-extraneous-dependencies const path = require('path'); -const esModules = ['@folio', 'ky'].join('|'); +const esModules = ['@folio', 'ky', 'uuid'].join('|'); module.exports = { collectCoverageFrom: [ @@ -18,7 +18,8 @@ module.exports = { '^.+\\.(css)$': 'identity-obj-proxy', '^.+\\.(svg)$': 'identity-obj-proxy', }, - testMatch: ['**/FindImportProfile/**/?(*.)test.{js,jsx}'], + testEnvironment: 'jsdom', + testMatch: ['**/(lib|src)/**/?(*.)test.{js,jsx}'], testPathIgnorePatterns: ['/node_modules/'], setupFilesAfterEnv: [path.join(__dirname, './test/jest/jest.setup.js')], }; diff --git a/karma.conf.js b/karma.conf.js deleted file mode 100644 index 3ea1124..0000000 --- a/karma.conf.js +++ /dev/null @@ -1,2 +0,0 @@ -/** @param {import('karma').Config} config */ -module.exports = config => config.set({ client: { captureConsole: false } }); diff --git a/package.json b/package.json index d4eee03..a0c4734 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@folio/plugin-find-import-profile", - "version": "6.0.1", + "version": "7.0.0", "description": "Find and select Data Import Profiles plugin for Stripes", "repository": "folio-org/ui-plugin-find-import-profile", "publishConfig": { @@ -34,24 +34,19 @@ "devDependencies": { "@babel/core": "^7.17.10", "@babel/eslint-parser": "^7.17.0", - "@babel/plugin-transform-class-properties": "^7.16.0", "@babel/plugin-proposal-decorators": "^7.16.4", "@babel/plugin-transform-class-properties": "^7.22.5", "@babel/plugin-transform-runtime": "^7.16.4", "@babel/preset-react": "^7.16.0", - "@bigtest/interactor": "^0.9.1", - "@bigtest/mocha": "^0.5.2", - "@bigtest/react": "^0.1.2", - "@folio/eslint-config-stripes": "^6.1.0", - "@folio/stripes": "^8.0.0", - "@folio/stripes-cli": "^2.6.0", + "@folio/eslint-config-stripes": "^7.0.0", + "@folio/stripes": "^9.0.0", + "@folio/stripes-cli": "^3.0.0", "@folio/stripes-testing": "^4.5.0", "@formatjs/cli": "^4.2.10", "@testing-library/jest-dom": "^5.14.1", - "@testing-library/react": "^12.1.2", - "babel-jest": "^26.1.0", + "@testing-library/react": "^14.0.0", + "babel-jest": "^29.6.3", "babel-polyfill": "^6.26.0", - "chai": "^4.2.0", "eslint": "^7.32.0", "eslint-import-resolver-alias": "^1.1.2", "eslint-plugin-babel": "^5.3.0", @@ -60,31 +55,28 @@ "eslint-plugin-react": "^7.19.0", "eslint-plugin-react-hooks": "^1.7.0", "identity-obj-proxy": "^3.0.0", - "inflected": "^2.0.4", - "jest": "^26.1.0", - "jest-junit": "^13.0.0", - "miragejs": "^0.1.40", - "mocha": "^9.0.0", - "query-string": "^5.0.0", - "react": "^17.0.2", - "react-dom": "^17.0.2", + "jest": "^29.6.3", + "jest-environment-jsdom": "^29.5.0", + "jest-junit": "^16.0.0", + "query-string": "^7.0.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", "react-intl": "^5.7.0", "react-router": "^5.2.0", - "react-router-dom": "^5.2.0", - "sinon": "^7.2.2" + "react-router-dom": "^5.2.0" }, "dependencies": { - "@folio/data-import": "^6.0.0", - "@folio/stripes-acq-components": "~4.0.0", - "@folio/stripes-data-transfer-components": "^5.4.0", + "@folio/data-import": "^7.0.0", + "@folio/stripes-acq-components": "^5.0.0", + "@folio/stripes-data-transfer-components": "^6.0.0", "classnames": "^2.2.5", "lodash": "^4.16.4", "prop-types": "^15.6.0", "redux-form": "^8.3.7" }, "peerDependencies": { - "@folio/stripes": "^8.0.0", - "react": "^17.0.2", + "@folio/stripes": "^9.0.0", + "react": "^18.2.0", "react-intl": "^5.7.0", "react-router": "^5.2.0", "react-router-dom": "^5.2.0" diff --git a/FindImportProfile/FindImportProfile.js b/src/FindImportProfile/FindImportProfile.js similarity index 100% rename from FindImportProfile/FindImportProfile.js rename to src/FindImportProfile/FindImportProfile.js diff --git a/FindImportProfile/FindImportProfile.test.js b/src/FindImportProfile/FindImportProfile.test.js similarity index 98% rename from FindImportProfile/FindImportProfile.test.js rename to src/FindImportProfile/FindImportProfile.test.js index f42aad2..9e5a318 100644 --- a/FindImportProfile/FindImportProfile.test.js +++ b/src/FindImportProfile/FindImportProfile.test.js @@ -7,9 +7,9 @@ import { runAxeTest } from '@folio/stripes-testing'; import { renderWithIntl } from '@folio/stripes-data-transfer-components/test/jest/helpers'; -import '../test/jest/__mock__'; +import '../../test/jest/__mock__'; import { buildStripes } from '@folio/data-import/test/jest/helpers'; -import { translationsProperties } from '../test/jest/helpers'; +import { translationsProperties } from '../../test/jest/helpers'; import FindImportProfile from './FindImportProfile'; diff --git a/FindImportProfile/FindImportProfileContainer/AbstractContainer.js b/src/FindImportProfile/FindImportProfileContainer/AbstractContainer.js similarity index 100% rename from FindImportProfile/FindImportProfileContainer/AbstractContainer.js rename to src/FindImportProfile/FindImportProfileContainer/AbstractContainer.js diff --git a/FindImportProfile/FindImportProfileContainer/ActionProfilesContainer.js b/src/FindImportProfile/FindImportProfileContainer/ActionProfilesContainer.js similarity index 100% rename from FindImportProfile/FindImportProfileContainer/ActionProfilesContainer.js rename to src/FindImportProfile/FindImportProfileContainer/ActionProfilesContainer.js diff --git a/FindImportProfile/FindImportProfileContainer/JobProfilesContainer.js b/src/FindImportProfile/FindImportProfileContainer/JobProfilesContainer.js similarity index 100% rename from FindImportProfile/FindImportProfileContainer/JobProfilesContainer.js rename to src/FindImportProfile/FindImportProfileContainer/JobProfilesContainer.js diff --git a/FindImportProfile/FindImportProfileContainer/MappingProfilesContainer.js b/src/FindImportProfile/FindImportProfileContainer/MappingProfilesContainer.js similarity index 100% rename from FindImportProfile/FindImportProfileContainer/MappingProfilesContainer.js rename to src/FindImportProfile/FindImportProfileContainer/MappingProfilesContainer.js diff --git a/FindImportProfile/FindImportProfileContainer/MatchProfilesContainer.js b/src/FindImportProfile/FindImportProfileContainer/MatchProfilesContainer.js similarity index 100% rename from FindImportProfile/FindImportProfileContainer/MatchProfilesContainer.js rename to src/FindImportProfile/FindImportProfileContainer/MatchProfilesContainer.js diff --git a/FindImportProfile/FindImportProfileContainer/index.js b/src/FindImportProfile/FindImportProfileContainer/index.js similarity index 100% rename from FindImportProfile/FindImportProfileContainer/index.js rename to src/FindImportProfile/FindImportProfileContainer/index.js diff --git a/FindImportProfile/FindImportProfileContainer/tests/ActionProfilesContainer.test.js b/src/FindImportProfile/FindImportProfileContainer/tests/ActionProfilesContainer.test.js similarity index 96% rename from FindImportProfile/FindImportProfileContainer/tests/ActionProfilesContainer.test.js rename to src/FindImportProfile/FindImportProfileContainer/tests/ActionProfilesContainer.test.js index 3d904f7..fa2a2e6 100644 --- a/FindImportProfile/FindImportProfileContainer/tests/ActionProfilesContainer.test.js +++ b/src/FindImportProfile/FindImportProfileContainer/tests/ActionProfilesContainer.test.js @@ -7,14 +7,14 @@ import { runAxeTest } from '@folio/stripes-testing'; import { renderWithIntl } from '@folio/stripes-data-transfer-components/test/jest/helpers'; -import '../../../test/jest/__mock__'; +import '../../../../test/jest/__mock__'; import { buildMutator, buildResources, } from '@folio/stripes-data-transfer-components/test/helpers'; import { buildStripes } from '@folio/data-import/test/jest/helpers'; import { actionProfilesShape } from '@folio/data-import/src/settings/ActionProfiles'; -import { translationsProperties } from '../../../test/jest/helpers'; +import { translationsProperties } from '../../../../test/jest/helpers'; import ActionProfilesContainer from '../ActionProfilesContainer'; diff --git a/FindImportProfile/FindImportProfileContainer/tests/JobProfilesContainer.test.js b/src/FindImportProfile/FindImportProfileContainer/tests/JobProfilesContainer.test.js similarity index 95% rename from FindImportProfile/FindImportProfileContainer/tests/JobProfilesContainer.test.js rename to src/FindImportProfile/FindImportProfileContainer/tests/JobProfilesContainer.test.js index 534a5c1..1a815f3 100644 --- a/FindImportProfile/FindImportProfileContainer/tests/JobProfilesContainer.test.js +++ b/src/FindImportProfile/FindImportProfileContainer/tests/JobProfilesContainer.test.js @@ -7,14 +7,14 @@ import { runAxeTest } from '@folio/stripes-testing'; import { renderWithIntl } from '@folio/stripes-data-transfer-components/test/jest/helpers'; -import '../../../test/jest/__mock__'; +import '../../../../test/jest/__mock__'; import { buildMutator, buildResources, } from '@folio/stripes-data-transfer-components/test/helpers'; import { buildStripes } from '@folio/data-import/test/jest/helpers'; import { jobProfilesShape } from '@folio/data-import/src/settings/JobProfiles'; -import { translationsProperties } from '../../../test/jest/helpers'; +import { translationsProperties } from '../../../../test/jest/helpers'; import JobProfilesContainer from '../JobProfilesContainer'; diff --git a/FindImportProfile/FindImportProfileContainer/tests/MappingProfilesContainer.test.js b/src/FindImportProfile/FindImportProfileContainer/tests/MappingProfilesContainer.test.js similarity index 95% rename from FindImportProfile/FindImportProfileContainer/tests/MappingProfilesContainer.test.js rename to src/FindImportProfile/FindImportProfileContainer/tests/MappingProfilesContainer.test.js index 426016d..280a156 100644 --- a/FindImportProfile/FindImportProfileContainer/tests/MappingProfilesContainer.test.js +++ b/src/FindImportProfile/FindImportProfileContainer/tests/MappingProfilesContainer.test.js @@ -7,14 +7,14 @@ import { runAxeTest } from '@folio/stripes-testing'; import { renderWithIntl } from '@folio/stripes-data-transfer-components/test/jest/helpers'; -import '../../../test/jest/__mock__'; +import '../../../../test/jest/__mock__'; import { buildMutator, buildResources, } from '@folio/stripes-data-transfer-components/test/helpers'; import { buildStripes } from '@folio/data-import/test/jest/helpers'; import { mappingProfilesShape } from '@folio/data-import/src/settings/MappingProfiles'; -import { translationsProperties } from '../../../test/jest/helpers'; +import { translationsProperties } from '../../../../test/jest/helpers'; import MappingProfilesContainer from '../MappingProfilesContainer'; diff --git a/FindImportProfile/FindImportProfileContainer/tests/MatchProfilesContainer.test.js b/src/FindImportProfile/FindImportProfileContainer/tests/MatchProfilesContainer.test.js similarity index 95% rename from FindImportProfile/FindImportProfileContainer/tests/MatchProfilesContainer.test.js rename to src/FindImportProfile/FindImportProfileContainer/tests/MatchProfilesContainer.test.js index 9cfd4b1..98ca7fa 100644 --- a/FindImportProfile/FindImportProfileContainer/tests/MatchProfilesContainer.test.js +++ b/src/FindImportProfile/FindImportProfileContainer/tests/MatchProfilesContainer.test.js @@ -7,14 +7,14 @@ import { runAxeTest } from '@folio/stripes-testing'; import { renderWithIntl } from '@folio/stripes-data-transfer-components/test/jest/helpers'; -import '../../../test/jest/__mock__'; +import '../../../../test/jest/__mock__'; import { buildMutator, buildResources, } from '@folio/stripes-data-transfer-components/test/helpers'; import { buildStripes } from '@folio/data-import/test/jest/helpers'; import { matchProfilesShape } from '@folio/data-import/src/settings/MatchProfiles'; -import { translationsProperties } from '../../../test/jest/helpers'; +import { translationsProperties } from '../../../../test/jest/helpers'; import MatchProfilesContainer from '../MatchProfilesContainer'; diff --git a/FindImportProfile/index.js b/src/FindImportProfile/index.js similarity index 100% rename from FindImportProfile/index.js rename to src/FindImportProfile/index.js diff --git a/FindImportProfile/utils/fetchAssociations.js b/src/FindImportProfile/utils/fetchAssociations.js similarity index 100% rename from FindImportProfile/utils/fetchAssociations.js rename to src/FindImportProfile/utils/fetchAssociations.js diff --git a/test/bigtest/.eslintrc b/test/bigtest/.eslintrc deleted file mode 100644 index d570554..0000000 --- a/test/bigtest/.eslintrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "rules": { - "filenames/match-exported": "off", - "func-names": "off", - "no-unused-expressions": "off", - "one-var": "off" - } -} diff --git a/test/bigtest/helpers/PluginHarness.js b/test/bigtest/helpers/PluginHarness.js deleted file mode 100644 index 03de427..0000000 --- a/test/bigtest/helpers/PluginHarness.js +++ /dev/null @@ -1,82 +0,0 @@ -import React from 'react'; -import { FormattedMessage } from 'react-intl'; -import { - noop, - get, -} from 'lodash'; - -import { Pluggable } from '@folio/stripes/core'; -import { - ENTITY_KEYS, - ASSOCIATION_TYPES, -} from '@folio/data-import/src/utils/constants'; - -const { - ACTION_PROFILES, - JOB_PROFILES, - MATCH_PROFILES, - MAPPING_PROFILES, -} = ENTITY_KEYS; -const { - actionProfiles, - jobProfiles, - mappingProfiles, -} = ASSOCIATION_TYPES; -const associationPairs = { - actionProfiles: { - parentType: mappingProfiles, - masterType: actionProfiles, - }, - jobProfiles: { - parentType: actionProfiles, - masterType: jobProfiles, - }, - matchProfiles: { - parentType: jobProfiles, - masterType: jobProfiles, - }, - mappingProfiles: { - parentType: actionProfiles, - masterType: actionProfiles, - }, -}; - -const PluginHarness = props => { - const layout = keys => keys.map((item, i) => ( -
- } - searchButtonStyle="default" - onLink={noop} - entityKey={item} - parentType={get(associationPairs, [item, 'parentType'], '')} - masterType={get(associationPairs, [item, 'masterType'], '')} - profileName="Profile name" - dataKey={item} - disabled={false} - isMultiLink={false} - marginTop0 - data-test-plugin-find-record-button - {...props} - > - - - - -
- )); - - return ( - <> - {layout([ACTION_PROFILES, JOB_PROFILES, MATCH_PROFILES, MAPPING_PROFILES])} - - ); -}; - -export default PluginHarness; diff --git a/test/bigtest/helpers/PluginHarnessSingleSelect.js b/test/bigtest/helpers/PluginHarnessSingleSelect.js deleted file mode 100644 index 9b779a4..0000000 --- a/test/bigtest/helpers/PluginHarnessSingleSelect.js +++ /dev/null @@ -1,83 +0,0 @@ -import React from 'react'; -import { FormattedMessage } from 'react-intl'; -import { - noop, - get, -} from 'lodash'; - -import { Pluggable } from '@folio/stripes/core'; -import { - ENTITY_KEYS, - ASSOCIATION_TYPES, -} from '@folio/data-import/src/utils/constants'; - -const { - ACTION_PROFILES, - JOB_PROFILES, - MATCH_PROFILES, - MAPPING_PROFILES, -} = ENTITY_KEYS; -const { - actionProfiles, - jobProfiles, - mappingProfiles, -} = ASSOCIATION_TYPES; -const associationPairs = { - actionProfiles: { - parentType: mappingProfiles, - masterType: actionProfiles, - }, - jobProfiles: { - parentType: actionProfiles, - masterType: jobProfiles, - }, - matchProfiles: { - parentType: jobProfiles, - masterType: jobProfiles, - }, - mappingProfiles: { - parentType: actionProfiles, - masterType: actionProfiles, - }, -}; - -const PluginHarnessSingleSelect = props => { - const layout = keys => keys.map((item, i) => ( -
- } - searchButtonStyle="default" - onLink={noop} - entityKey={item} - parentType={get(associationPairs, [item, 'parentType'], '')} - masterType={get(associationPairs, [item, 'masterType'], '')} - profileName="Profile name" - dataKey={item} - disabled={false} - isSingleSelect - isMultiLink={false} - marginTop0 - data-test-plugin-find-record-button - {...props} - > - - - - -
- )); - - return ( - <> - {layout([ACTION_PROFILES, JOB_PROFILES, MATCH_PROFILES, MAPPING_PROFILES])} - - ); -}; - -export default PluginHarnessSingleSelect; diff --git a/test/bigtest/helpers/appInit.js b/test/bigtest/helpers/appInit.js deleted file mode 100644 index 541aa53..0000000 --- a/test/bigtest/helpers/appInit.js +++ /dev/null @@ -1,38 +0,0 @@ -import { setupStripesCore } from '@folio/stripes/core/test'; -import moduleTranslations from '@folio/data-import/translations/ui-data-import/en'; -import translations from '@folio/stripes-acq-components/translations/stripes-acq-components/en'; -import prefixKeys from '@folio/stripes-acq-components/test/bigtest/helpers/prefixKeys'; - -import mirageOptions from '../network'; -import PluginHarness from './PluginHarness'; -import PluginHarnessSingleSelect from './PluginHarnessSingleSelect'; - -export default function appInit({ - isSingleSelect, - scenarios, - hasAllPerms = true, -} = {}) { - setupStripesCore({ - mirageOptions: { - serverType: 'miragejs', - ...mirageOptions, - }, - scenarios, - stripesConfig: { hasAllPerms }, - - // setup a dummy app for the plugin that renders a harness. - modules: [{ - type: 'app', - name: '@folio/ui-dummy', - displayName: 'dummy.title', - route: '/dummy', - module: isSingleSelect ? PluginHarnessSingleSelect : PluginHarness, - }], - - translations: { - 'dummy.title': 'Dummy', - ...prefixKeys(moduleTranslations, 'ui-data-import'), - ...prefixKeys(translations, 'stripes-acq-components'), - }, - }); -} diff --git a/test/bigtest/index.js b/test/bigtest/index.js deleted file mode 100644 index 6fc8459..0000000 --- a/test/bigtest/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import 'babel-polyfill'; - -// require all modules ending in "-test" from the current directory and -// all subdirectories -const requireTest = require.context('./tests/', true, /\.e2e/); - -requireTest.keys().forEach(requireTest); diff --git a/test/bigtest/interactors/ApplicationInteractor.js b/test/bigtest/interactors/ApplicationInteractor.js deleted file mode 100644 index 57bedc9..0000000 --- a/test/bigtest/interactors/ApplicationInteractor.js +++ /dev/null @@ -1,12 +0,0 @@ -import { - interactor, - isPresent, -} from '@bigtest/interactor'; - -@interactor -class ApplicationInteractor { - static defaultScope = '#ModuleContainer'; - pluginNotFound = isPresent('[data-test-no-plugin-available]'); -} - -export default ApplicationInteractor; diff --git a/test/bigtest/interactors/findImportProfileInteractor.js b/test/bigtest/interactors/findImportProfileInteractor.js deleted file mode 100644 index 5cb69f2..0000000 --- a/test/bigtest/interactors/findImportProfileInteractor.js +++ /dev/null @@ -1,53 +0,0 @@ -/* eslint-disable max-classes-per-file */ -import { - interactor, - scoped, - collection, - clickable, - is, - property, - text, -} from '@bigtest/interactor'; - -import ConfirmationModalInteractor from '@folio/stripes-components/lib/ConfirmationModal/tests/interactor'; -import { ENTITY_KEYS } from '@folio/data-import/src/utils/constants'; - -const buttonProperties = { - click: clickable(), - isFocused: is(':focus'), -}; - -@interactor -class PluginModalInteractor { - static defaultScope = '[data-test-find-records-modal]'; - - instances = collection('[role=rowgroup] [role=row]', { - name: text('[role=gridcell] [class*="label--"]'), - click: clickable('[data-row-inner]'), - selectLine: clickable('input[type="checkbox"]'), - }); - - save = scoped('[data-test-find-records-modal-save]', { - click: clickable(), - isDisabled: property('disabled'), - }); - - selectAll = scoped('[data-test-find-records-modal-select-all]', { click: clickable() }); - confirmationModal = new ConfirmationModalInteractor('#relink-profile'); -} - -@interactor -class FindImportProfileInteractor { - actionProfileButton = scoped(`#${ENTITY_KEYS.ACTION_PROFILES} [data-test-plugin-find-record-button]`, buttonProperties); - jobProfileButton = scoped(`#${ENTITY_KEYS.JOB_PROFILES} [data-test-plugin-find-record-button]`, buttonProperties); - matchProfileButton = scoped(`#${ENTITY_KEYS.MATCH_PROFILES} [data-test-plugin-find-record-button]`, buttonProperties); - mappingProfileButton = scoped(`#${ENTITY_KEYS.MAPPING_PROFILES} [data-test-plugin-find-record-button]`, buttonProperties); - - modal = new PluginModalInteractor(); - - whenLoaded() { - return this.timeout(5000).when(() => this.modal.instances.isPresent); - } -} - -export default FindImportProfileInteractor; diff --git a/test/bigtest/mocks/actionProfiles.js b/test/bigtest/mocks/actionProfiles.js deleted file mode 100644 index c171f5a..0000000 --- a/test/bigtest/mocks/actionProfiles.js +++ /dev/null @@ -1,69 +0,0 @@ -export const actionProfiles = [ - { - id: 'ba8d822f-97db-4794-8393-562a0b2cf755', - name: 'Create authority MARC', - description: '', - tags: { tagList: ['authorities'] }, - reactTo: 'NON-MATCH', - action: 'CREATE', - folioRecord: 'MARC_AUTHORITY', - deleted: false, - userInfo: { - firstName: 'DIKU', - lastName: 'ADMINISTRATOR', - userName: 'diku_admin', - }, - metadata: { - createdDate: '2018-10-30T12:45:33.000+0000', - createdByUserId: '', - createdByUsername: '', - updatedDate: '2018-11-03T11:22:30.000+0000', - updatedByUserId: '', - updatedByUsername: '', - }, - }, { - id: '51c8b6ac-0424-4c8d-9a53-7a810be50ff7', - name: 'Create DDA holdings', - description: '', - tags: { tagList: ['dda-related'] }, - reactTo: 'NON-MATCH', - action: 'CREATE', - folioRecord: 'HOLDINGS', - deleted: false, - userInfo: { - firstName: 'DIKU', - lastName: 'ADMINISTRATOR', - userName: 'diku_admin', - }, - metadata: { - createdDate: '2018-11-02T10:20:32.000+0000', - createdByUserId: '', - createdByUsername: '', - updatedDate: '2018-12-02T10:45:21.000+0000', - updatedByUserId: '', - updatedByUsername: '', - }, - }, { - id: '13cd54b7-47cb-4b47-8103-1c98b761f80d', - name: 'Create DDA instance', - description: 'URL in holdings record', - tags: { tagList: ['dda-related'] }, - reactTo: 'NON-MATCH', - action: 'CREATE', - folioRecord: 'INSTANCE', - deleted: false, - userInfo: { - firstName: 'DIKU', - lastName: 'ADMINISTRATOR', - userName: 'diku_admin', - }, - metadata: { - createdDate: '2018-11-01T10:37:53.000+0000', - createdByUserId: '', - createdByUsername: '', - updatedDate: '2018-12-03T11:45:21.000+0000', - updatedByUserId: '', - updatedByUsername: '', - }, - }, -]; diff --git a/test/bigtest/mocks/fieldMappingProfiles.js b/test/bigtest/mocks/fieldMappingProfiles.js deleted file mode 100644 index bfac44a..0000000 --- a/test/bigtest/mocks/fieldMappingProfiles.js +++ /dev/null @@ -1,66 +0,0 @@ -export const fieldMappingProfiles = [ - { - id: '0d991835-fabb-4234-8472-3ae94bc7a1b3', - name: 'MARC brief instance 1', - description: 'Preliminary instance from CoolVendor MARC order record', - tags: { tagList: ['cool-vendor'] }, - incomingRecordType: 'MARC_BIBLIOGRAPHIC', - folioRecord: 'INSTANCE', - deleted: false, - userInfo: { - firstName: 'DIKU', - lastName: 'ADMINISTRATOR', - userName: 'diku_admin', - }, - metadata: { - createdDate: '2018-11-02T12:09:51.000+0000', - createdByUserId: '', - createdByUsername: '', - updatedDate: '2018-11-22T12:09:51.000+0000', - updatedByUserId: '', - updatedByUsername: '', - }, - }, { - id: '5b546bd4-ac38-44a8-aea1-30e460a9700f', - name: 'Prelim holding from Bib 1', - description: 'Preliminary holdings from CoolVendor MARC order record', - tags: { tagList: ['cool-vendor'] }, - incomingRecordType: 'MARC_BIBLIOGRAPHIC', - folioRecord: 'HOLDINGS', - deleted: false, - userInfo: { - firstName: 'DIKU', - lastName: 'ADMINISTRATOR', - userName: 'diku_admin', - }, - metadata: { - createdDate: '2018-11-03T10:01:30.000+0000', - createdByUserId: '', - createdByUsername: '', - updatedDate: '2018-11-06T10:01:30.000+0000', - updatedByUserId: '', - updatedByUsername: '', - }, - }, { - id: 'fce00bb4-6dea-499d-8645-c55c584a2970', - name: 'Prelim item from MARC', - description: 'Preliminary item from CoolVendor MARC order record', - tags: { tagList: ['cool-vendor'] }, - incomingRecordType: 'MARC_BIBLIOGRAPHIC', - folioRecord: 'ITEM', - deleted: false, - userInfo: { - firstName: 'DIKU', - lastName: 'ADMINISTRATOR', - userName: 'diku_admin', - }, - metadata: { - createdDate: '2018-11-03T11:22:30.000+0000', - createdByUserId: '', - createdByUsername: '', - updatedDate: '2018-11-09T11:22:30.000+0000', - updatedByUserId: '', - updatedByUsername: '', - }, - }, -]; diff --git a/test/bigtest/mocks/profileAssociations.js b/test/bigtest/mocks/profileAssociations.js deleted file mode 100644 index a7f92f2..0000000 --- a/test/bigtest/mocks/profileAssociations.js +++ /dev/null @@ -1,28 +0,0 @@ -export const profileAssociations = [{ - id: 'c5bccf59-cb5f-4edf-95a1-5dae28d75747', - contentType: 'MAPPING_PROFILE', - childSnapshotWrappers: [{ - id: '93691541-5fb7-4ef9-951d-dbb8d762f9bb', - contentType: 'ACTION_PROFILE', - content: { - id: '93691541-5fb7-4ef9-951d-dbb8d762f9bb', - name: 'Create MARC Bib', - description: 'Create new MARC bib', - tags: { tagList: ['acq-related', 'preliminary'] }, - }, - }], -}, { - id: '0d85d496-4504-4e79-be97-c6995d101b7e', - contentType: 'MAPPING_PROFILE', - childSnapshotWrappers: [{ - id: '968cfe23-909e-422b-8a24-2387971b9d0b', - contentType: 'ACTION_PROFILE', - content: { - id: '968cfe23-909e-422b-8a24-2387971b9d0b', - name: 'Create order', - description: 'Order data in 9xx fields', - tags: { tagList: ['acq-related', 'preliminary'] }, - }, - childSnapshotWrappers: [], - }], -}]; diff --git a/test/bigtest/network/index.js b/test/bigtest/network/index.js deleted file mode 100644 index 67d7d4b..0000000 --- a/test/bigtest/network/index.js +++ /dev/null @@ -1,31 +0,0 @@ -import { - camelize, - underscore, -} from 'inflected'; - -const req = require.context('@folio/data-import/test/bigtest/network', true, /\.\/.*\.js$/); - -const modules = req.keys().reduce((acc, modulePath) => { - const [, moduleType, moduleName] = modulePath.split('/'); - - if (moduleType === 'configs') return acc; - - if (moduleName) { - const moduleKey = camelize(underscore(moduleName.replace('.js', '')), false); - - return Object.assign(acc, { - [moduleType]: { - ...(acc[moduleType] || {}), - [moduleKey]: req(modulePath).default, - }, - }); - } - - if (modulePath === './config.js') { - return Object.assign(acc, { baseConfig: req(modulePath).default }); - } - - return acc; -}, {}); - -export default modules; diff --git a/test/bigtest/tests/findImportProfiles.e2e.js b/test/bigtest/tests/findImportProfiles.e2e.js deleted file mode 100644 index e6ba61a..0000000 --- a/test/bigtest/tests/findImportProfiles.e2e.js +++ /dev/null @@ -1,253 +0,0 @@ -import { - describe, - beforeEach, - it, -} from '@bigtest/mocha'; -import { expect } from 'chai'; - -import appInit from '../helpers/appInit'; -import FindImportProfileInteractor from '../interactors/findImportProfileInteractor'; - -const ACTION_PROFILES_COUNT = 6; -const MATCH_PROFILES_COUNT = 10; -const JOB_PROFILES_COUNT = 3; - -describe('Find Import Profiles plugin', function () { - const findProfiles = new FindImportProfileInteractor(); - - describe('For action profile', () => { - appInit({ scenarios: ['fetch-action-profiles-success', 'fetch-users', 'fetch-tags', 'tags-enabled'] }); - - beforeEach(async function () { - this.visit('/dummy'); - await findProfiles.whenLoaded(); - }); - - describe('Pick Profiles button', () => { - it('should be rendered', function () { - return expect(findProfiles.actionProfileButton.isPresent).to.be.true; - }); - - describe('click action', function () { - beforeEach(async function () { - await findProfiles.actionProfileButton.click(); - }); - - it('should open a modal', function () { - return expect(findProfiles.modal.isPresent).to.be.true; - }); - }); - }); - - describe('modal list', function () { - beforeEach(async function () { - await findProfiles.actionProfileButton.click(); - }); - - it('should return a set of results', function () { - return expect(findProfiles.modal.instances().length).to.be.equal(ACTION_PROFILES_COUNT); - }); - - it('should display disabled save button', function () { - return expect(findProfiles.modal.save.isDisabled).to.be.true; - }); - - describe('select a line', function () { - beforeEach(async function () { - await findProfiles.modal.instances(1).selectLine(); - }); - - it('should enable Save button', function () { - return expect(findProfiles.modal.save.isDisabled).to.be.false; - }); - }); - - describe('select all', function () { - beforeEach(async function () { - await findProfiles.modal.selectAll.click(); - }); - - it('should enable Save button', function () { - return expect(findProfiles.modal.save.isDisabled).to.be.false; - }); - }); - }); - }); - - describe('For job profile', () => { - appInit({ scenarios: ['fetch-job-profiles-success', 'fetch-users', 'fetch-tags', 'tags-enabled'] }); - - beforeEach(async function () { - this.visit('/dummy'); - await findProfiles.whenLoaded(); - }); - - describe('Pick Profiles button', () => { - it('should be rendered', function () { - return expect(findProfiles.jobProfileButton.isPresent).to.be.true; - }); - - describe('click action', function () { - beforeEach(async function () { - await findProfiles.jobProfileButton.click(); - }); - - it('should open a modal', function () { - return expect(findProfiles.modal.isPresent).to.be.true; - }); - }); - }); - - describe('modal list', function () { - beforeEach(async function () { - await findProfiles.jobProfileButton.click(); - }); - - it('should return a set of results', function () { - return expect(findProfiles.modal.instances().length).to.be.equal(JOB_PROFILES_COUNT); - }); - - it('should display disabled save button', function () { - return expect(findProfiles.modal.save.isDisabled).to.be.true; - }); - - describe('select a line', function () { - beforeEach(async function () { - await findProfiles.modal.instances(1).selectLine(); - }); - - it('should enable Save button', function () { - return expect(findProfiles.modal.save.isDisabled).to.be.false; - }); - }); - - describe('select all', function () { - beforeEach(async function () { - await findProfiles.modal.selectAll.click(); - }); - - it('should enable Save button', function () { - return expect(findProfiles.modal.save.isDisabled).to.be.false; - }); - }); - }); - }); - - describe('For match profile', () => { - appInit({ scenarios: ['fetch-match-profiles-success', 'fetch-users', 'fetch-tags', 'tags-enabled'] }); - - beforeEach(async function () { - this.visit('/dummy'); - await findProfiles.whenLoaded(); - }); - - describe('Pick Profiles button', () => { - it('should be rendered', function () { - return expect(findProfiles.matchProfileButton.isPresent).to.be.true; - }); - - describe('click action', function () { - beforeEach(async function () { - await findProfiles.matchProfileButton.click(); - }); - - it('should open a modal', function () { - return expect(findProfiles.modal.isPresent).to.be.true; - }); - }); - }); - - describe('modal list', function () { - beforeEach(async function () { - await findProfiles.matchProfileButton.click(); - }); - - it('should return a set of results', function () { - return expect(findProfiles.modal.instances().length).to.be.equal(MATCH_PROFILES_COUNT); - }); - - it('should display disabled save button', function () { - return expect(findProfiles.modal.save.isDisabled).to.be.true; - }); - - describe('select a line', function () { - beforeEach(async function () { - await findProfiles.modal.instances(1).selectLine(); - }); - - it('should enable Save button', function () { - return expect(findProfiles.modal.save.isDisabled).to.be.false; - }); - }); - - describe('select all', function () { - beforeEach(async function () { - await findProfiles.modal.selectAll.click(); - }); - - it('should enable Save button', function () { - return expect(findProfiles.modal.save.isDisabled).to.be.false; - }); - }); - }); - }); - - describe('For mapping profile', () => { - appInit({ scenarios: ['fetch-mapping-profiles-success', 'fetch-users', 'fetch-tags', 'tags-enabled'] }); - - beforeEach(async function () { - this.visit('/dummy'); - await findProfiles.whenLoaded(); - }); - - describe('Pick Profiles button', () => { - it('should be rendered', function () { - return expect(findProfiles.mappingProfileButton.isPresent).to.be.true; - }); - - describe('click action', function () { - beforeEach(async function () { - await findProfiles.mappingProfileButton.click(); - }); - - it('should open a modal', function () { - return expect(findProfiles.modal.isPresent).to.be.true; - }); - }); - }); - - describe('modal list', function () { - beforeEach(async function () { - await findProfiles.mappingProfileButton.click(); - }); - - it('should return a set of results', function () { - return expect(findProfiles.modal.instances().length).to.be.equal(5); - }); - - it('should display disabled save button', function () { - return expect(findProfiles.modal.save.isDisabled).to.be.true; - }); - - describe('select a line', function () { - beforeEach(async function () { - await findProfiles.modal.instances(1).selectLine(); - }); - - it('should enable Save button', function () { - return expect(findProfiles.modal.save.isDisabled).to.be.false; - }); - }); - - describe('select all', function () { - beforeEach(async function () { - await findProfiles.modal.selectAll.click(); - }); - - it('should enable Save button', function () { - return expect(findProfiles.modal.save.isDisabled).to.be.false; - }); - }); - }); - }); -}); diff --git a/test/bigtest/tests/findImportProfilesSingleSelect.e2e.js b/test/bigtest/tests/findImportProfilesSingleSelect.e2e.js deleted file mode 100644 index 4a4e15b..0000000 --- a/test/bigtest/tests/findImportProfilesSingleSelect.e2e.js +++ /dev/null @@ -1,193 +0,0 @@ -import { - describe, - beforeEach, - it, -} from '@bigtest/mocha'; -import { expect } from 'chai'; - -import appInit from '../helpers/appInit'; -import FindImportProfileInteractor from '../interactors/findImportProfileInteractor'; - -const ACTION_PROFILES_COUNT = 6; -const MATCH_PROFILES_COUNT = 10; -const JOB_PROFILES_COUNT = 3; - -describe('Find Data Import Profiles plugin with single select option', function () { - const findProfiles = new FindImportProfileInteractor(); - - describe('For action profiles', () => { - appInit({ - isSingleSelect: true, - scenarios: ['fetch-action-profiles-success', 'fetch-users', 'fetch-tags', 'tags-enabled'], - }); - - beforeEach(async function () { - this.visit('/dummy'); - await findProfiles.whenLoaded(); - }); - - describe('Pick profiles button', () => { - it('should be rendered', function () { - return expect(findProfiles.actionProfileButton.isPresent).to.be.true; - }); - - describe('click action', function () { - beforeEach(async function () { - await findProfiles.actionProfileButton.click(); - }); - - it('should open a modal', function () { - return expect(findProfiles.modal.isPresent).to.be.true; - }); - }); - }); - - describe('modal list', function () { - beforeEach(async function () { - await findProfiles.actionProfileButton.click(); - }); - - it('should return a set of results', function () { - return expect(findProfiles.modal.instances().length).to.be.equal(ACTION_PROFILES_COUNT); - }); - - it('list should be sorted by the "name" column by default', () => { - expect(findProfiles.modal.instances(0).name).to.be.equal('Name 0'); - expect(findProfiles.modal.instances(1).name).to.be.equal('Name 1'); - expect(findProfiles.modal.instances(2).name).to.be.equal('Name 2'); - }); - }); - }); - - describe('For job profiles', () => { - appInit({ - isSingleSelect: true, - scenarios: ['fetch-job-profiles-success', 'fetch-users', 'fetch-tags', 'tags-enabled'], - }); - - beforeEach(async function () { - this.visit('/dummy'); - await findProfiles.whenLoaded(); - }); - - describe('Pick profiles button', () => { - it('should be rendered', function () { - return expect(findProfiles.jobProfileButton.isPresent).to.be.true; - }); - - describe('click action', function () { - beforeEach(async function () { - await findProfiles.jobProfileButton.click(); - }); - - it('should open a modal', function () { - return expect(findProfiles.modal.isPresent).to.be.true; - }); - }); - }); - - describe('modal list', function () { - beforeEach(async function () { - await findProfiles.jobProfileButton.click(); - }); - - it('should return a set of results', function () { - return expect(findProfiles.modal.instances().length).to.be.equal(JOB_PROFILES_COUNT); - }); - - it('list should be sorted by the "name" column by default', () => { - expect(findProfiles.modal.instances(0).name).to.be.equal('Approval plan records'); - expect(findProfiles.modal.instances(1).name).to.be.equal('Create orders from acquisitions'); - expect(findProfiles.modal.instances(2).name).to.be.equal('DDA discovery records'); - }); - }); - }); - - describe('For match profiles', () => { - appInit({ - isSingleSelect: true, - scenarios: ['fetch-match-profiles-success', 'fetch-users', 'fetch-tags', 'tags-enabled'], - }); - - beforeEach(async function () { - this.visit('/dummy'); - await findProfiles.whenLoaded(); - }); - - describe('Pick profiles button', () => { - it('should be rendered', function () { - return expect(findProfiles.matchProfileButton.isPresent).to.be.true; - }); - - describe('click action', function () { - beforeEach(async function () { - await findProfiles.matchProfileButton.click(); - }); - - it('should open a modal', function () { - return expect(findProfiles.modal.isPresent).to.be.true; - }); - }); - }); - - describe('modal list', function () { - beforeEach(async function () { - await findProfiles.matchProfileButton.click(); - }); - - it('should return a set of results', function () { - return expect(findProfiles.modal.instances().length).to.be.equal(MATCH_PROFILES_COUNT); - }); - - it('list should be sorted by the "name" column by default', () => { - expect(findProfiles.modal.instances(0).name).to.be.equal('001 to Instance HRID'); - expect(findProfiles.modal.instances(1).name).to.be.equal('EDI regular'); - expect(findProfiles.modal.instances(2).name).to.be.equal('Invoice check'); - }); - }); - }); - - describe('For mapping profiles', () => { - appInit({ - isSingleSelect: true, - scenarios: ['fetch-mapping-profiles-success', 'fetch-users', 'fetch-tags', 'tags-enabled'], - }); - - beforeEach(async function () { - this.visit('/dummy'); - await findProfiles.whenLoaded(); - }); - - describe('Pick profiles button', () => { - it('should be rendered', function () { - return expect(findProfiles.mappingProfileButton.isPresent).to.be.true; - }); - - describe('click action', function () { - beforeEach(async function () { - await findProfiles.mappingProfileButton.click(); - }); - - it('should open a modal', function () { - return expect(findProfiles.modal.isPresent).to.be.true; - }); - }); - }); - - describe('modal list', function () { - beforeEach(async function () { - await findProfiles.mappingProfileButton.click(); - }); - - it('should return a set of results', function () { - return expect(findProfiles.modal.instances().length).to.be.equal(5); - }); - - it('list should be sorted by the "name" column by default', () => { - expect(findProfiles.modal.instances(0).name).to.be.equal('Name 0'); - expect(findProfiles.modal.instances(1).name).to.be.equal('Name 1'); - expect(findProfiles.modal.instances(2).name).to.be.equal('Name 2'); - }); - }); - }); -}); diff --git a/test/bigtest/tests/relinkConfirmationModal.e2e.js b/test/bigtest/tests/relinkConfirmationModal.e2e.js deleted file mode 100644 index 0392875..0000000 --- a/test/bigtest/tests/relinkConfirmationModal.e2e.js +++ /dev/null @@ -1,397 +0,0 @@ -import { - describe, - beforeEach, - it, -} from '@bigtest/mocha'; -import { expect } from 'chai'; - -import appInit from '../helpers/appInit'; -import FindImportProfileInteractor from '../interactors/findImportProfileInteractor'; - -describe('Relink confirmation modal', () => { - const findProfiles = new FindImportProfileInteractor(); - - describe('For action profiles', () => { - describe('In single select mode', () => { - appInit({ - isSingleSelect: true, - scenarios: ['fetch-action-profiles-success', 'fetch-users', 'fetch-tags', 'tags-enabled'], - }); - - beforeEach(async function () { - this.visit('/dummy'); - this.server.get('/data-import-profiles/profileAssociations/:id/details', { childSnapshotWrappers: [{ contentType: 'MAPPING_PROFILE' }] }); - await findProfiles.whenLoaded(); - await findProfiles.actionProfileButton.click(); - }); - - describe('when select a line (click on it)', () => { - beforeEach(async () => { - await findProfiles.modal.instances(1).click(); - }); - - it('then confirmation modal appears', () => { - return expect(findProfiles.modal.confirmationModal.isPresent).to.be.true; - }); - - describe('when click on "Cancel" button', () => { - beforeEach(async () => { - await findProfiles.modal.confirmationModal.cancelButton.click(); - }); - - it('then close the confirmation modal', () => { - return expect(findProfiles.modal.confirmationModal.isPresent).to.be.false; - }); - - it('and return to the profile component search', () => { - return expect(findProfiles.modal.isPresent).to.be.true; - }); - }); - - describe('when click on "Relink" button', () => { - beforeEach(async () => { - await findProfiles.modal.confirmationModal.confirmButton.click(); - }); - - it('then close the confirmation modal', () => { - return expect(findProfiles.modal.confirmationModal.isPresent).to.be.false; - }); - - it('and close the profile component search', () => { - return expect(findProfiles.modal.isPresent).to.be.false; - }); - }); - }); - }); - - describe('In multi select mode', () => { - appInit({ scenarios: ['fetch-action-profiles-success', 'fetch-users', 'fetch-tags', 'tags-enabled'] }); - - beforeEach(async function () { - this.visit('/dummy'); - this.server.get('/data-import-profiles/profileAssociations/:id/details', { childSnapshotWrappers: [{ contentType: 'MAPPING_PROFILE' }] }); - await findProfiles.whenLoaded(); - await findProfiles.actionProfileButton.click(); - }); - - describe('when select a several profiles', () => { - beforeEach(async () => { - await findProfiles.modal.instances(3).selectLine(); - await findProfiles.modal.instances(5).selectLine(); - }); - - describe('and click on the "Save" button', () => { - beforeEach(async () => { - await findProfiles.modal.save.click(); - }); - - it('then confirmation modal appears', () => { - return expect(findProfiles.modal.confirmationModal.isPresent).to.be.true; - }); - - describe('when click on "Cancel" button', () => { - beforeEach(async () => { - await findProfiles.modal.confirmationModal.cancelButton.click(); - }); - - it('then close the confirmation modal', () => { - return expect(findProfiles.modal.confirmationModal.isPresent).to.be.false; - }); - - it('and return to the profile component search', () => { - return expect(findProfiles.modal.isPresent).to.be.true; - }); - }); - - describe('when click on "Relink" button', () => { - beforeEach(async () => { - await findProfiles.modal.confirmationModal.confirmButton.click(); - }); - - it('then close the confirmation modal', () => { - return expect(findProfiles.modal.confirmationModal.isPresent).to.be.false; - }); - - it('and close the profile component search', () => { - return expect(findProfiles.modal.isPresent).to.be.false; - }); - }); - }); - }); - }); - }); - - describe('For job profiles', () => { - describe('In single select mode', () => { - appInit({ - isSingleSelect: true, - scenarios: ['fetch-job-profiles-success', 'fetch-users', 'fetch-tags', 'tags-enabled'], - }); - - beforeEach(async function () { - this.visit('/dummy'); - this.server.get('/data-import-profiles/profileAssociations/:id/details', { childSnapshotWrappers: [{ contentType: 'MAPPING_PROFILE' }] }); - await findProfiles.whenLoaded(); - await findProfiles.jobProfileButton.click(); - }); - - describe('when select a line (click on it)', () => { - beforeEach(async () => { - await findProfiles.modal.instances(1).click(); - }); - - it('then confirmation modal does not appears', () => { - return expect(findProfiles.modal.confirmationModal.isPresent).to.be.false; - }); - }); - }); - - describe('In multi select mode', () => { - appInit({ scenarios: ['fetch-job-profiles-success', 'fetch-users', 'fetch-tags', 'tags-enabled'] }); - - beforeEach(async function () { - this.visit('/dummy'); - this.server.get('/data-import-profiles/profileAssociations/:id/details', { childSnapshotWrappers: [{ contentType: 'MAPPING_PROFILE' }] }); - await findProfiles.whenLoaded(); - await findProfiles.jobProfileButton.click(); - }); - - describe('when select a several profiles', () => { - beforeEach(async () => { - await findProfiles.modal.instances(1).selectLine(); - await findProfiles.modal.instances(2).selectLine(); - }); - - describe('and click on the "Save" button', () => { - beforeEach(async () => { - await findProfiles.modal.save.click(); - }); - - it('then confirmation modal does not appears', () => { - return expect(findProfiles.modal.confirmationModal.isPresent).to.be.false; - }); - }); - }); - }); - }); - - describe('For match profiles', () => { - describe('In single select mode', () => { - appInit({ - isSingleSelect: true, - scenarios: ['fetch-match-profiles-success', 'fetch-users', 'fetch-tags', 'tags-enabled'], - }); - - beforeEach(async function () { - this.visit('/dummy'); - this.server.get('/data-import-profiles/profileAssociations/:id/masters', { childSnapshotWrappers: [{ contentType: 'JOB_PROFILE' }] }); - await findProfiles.whenLoaded(); - await findProfiles.matchProfileButton.click(); - }); - - describe('when select a line (click on it)', () => { - beforeEach(async () => { - await findProfiles.modal.instances(1).click(); - }); - - it('then confirmation modal appears', () => { - return expect(findProfiles.modal.confirmationModal.isPresent).to.be.true; - }); - - describe('when click on "Cancel" button', () => { - beforeEach(async () => { - await findProfiles.modal.confirmationModal.cancelButton.click(); - }); - - it('then close the confirmation modal', () => { - return expect(findProfiles.modal.confirmationModal.isPresent).to.be.false; - }); - - it('and return to the profile component search', () => { - return expect(findProfiles.modal.isPresent).to.be.true; - }); - }); - - describe('when click on "Relink" button', () => { - beforeEach(async () => { - await findProfiles.modal.confirmationModal.confirmButton.click(); - }); - - it('then close the confirmation modal', () => { - return expect(findProfiles.modal.confirmationModal.isPresent).to.be.false; - }); - - it('and close the profile component search', () => { - return expect(findProfiles.modal.isPresent).to.be.false; - }); - }); - }); - }); - - describe('In multi select mode', () => { - appInit({ scenarios: ['fetch-match-profiles-success', 'fetch-users', 'fetch-tags', 'tags-enabled'] }); - - beforeEach(async function () { - this.visit('/dummy'); - this.server.get('/data-import-profiles/profileAssociations/:id/masters', { childSnapshotWrappers: [{ contentType: 'JOB_PROFILE' }] }); - await findProfiles.whenLoaded(); - await findProfiles.matchProfileButton.click(); - }); - - describe('when select a several profiles', () => { - beforeEach(async () => { - await findProfiles.modal.instances(1).selectLine(); - await findProfiles.modal.instances(2).selectLine(); - }); - - describe('and click on the "Save" button', () => { - beforeEach(async () => { - await findProfiles.modal.save.click(); - }); - - it('then confirmation modal appears', () => { - return expect(findProfiles.modal.confirmationModal.isPresent).to.be.true; - }); - - describe('when click on "Cancel" button', () => { - beforeEach(async () => { - await findProfiles.modal.confirmationModal.cancelButton.click(); - }); - - it('then close the confirmation modal', () => { - return expect(findProfiles.modal.confirmationModal.isPresent).to.be.false; - }); - - it('and return to the profile component search', () => { - return expect(findProfiles.modal.isPresent).to.be.true; - }); - }); - - describe('when click on "Relink" button', () => { - beforeEach(async () => { - await findProfiles.modal.confirmationModal.confirmButton.click(); - }); - - it('then close the confirmation modal', () => { - return expect(findProfiles.modal.confirmationModal.isPresent).to.be.false; - }); - - it('and close the profile component search', () => { - return expect(findProfiles.modal.isPresent).to.be.false; - }); - }); - }); - }); - }); - }); - - describe('For mapping profiles', () => { - describe('In single select mode', () => { - appInit({ - isSingleSelect: true, - scenarios: ['fetch-mapping-profiles-success', 'fetch-users', 'fetch-tags', 'tags-enabled'], - }); - - beforeEach(async function () { - this.visit('/dummy'); - this.server.get('/data-import-profiles/profileAssociations/:id/masters', { childSnapshotWrappers: [{ contentType: 'ACTION_PROFILE' }] }); - await findProfiles.whenLoaded(); - await findProfiles.mappingProfileButton.click(); - }); - - describe('when select a line (click on it)', () => { - beforeEach(async () => { - await findProfiles.modal.instances(0).click(); - }); - - it('then confirmation modal appears', () => { - return expect(findProfiles.modal.confirmationModal.isPresent).to.be.true; - }); - - describe('when click on "Cancel" button', () => { - beforeEach(async () => { - await findProfiles.modal.confirmationModal.cancelButton.click(); - }); - - it('then close the confirmation modal', () => { - return expect(findProfiles.modal.confirmationModal.isPresent).to.be.false; - }); - - it('and return to the profile component search', () => { - return expect(findProfiles.modal.isPresent).to.be.true; - }); - }); - - describe('when click on "Relink" button', () => { - beforeEach(async () => { - await findProfiles.modal.confirmationModal.confirmButton.click(); - }); - - it('then close the confirmation modal', () => { - return expect(findProfiles.modal.confirmationModal.isPresent).to.be.false; - }); - - it('and close the profile component search', () => { - return expect(findProfiles.modal.isPresent).to.be.false; - }); - }); - }); - }); - - describe('In multi select mode', () => { - appInit({ scenarios: ['fetch-mapping-profiles-success', 'fetch-users', 'fetch-tags', 'tags-enabled'] }); - - beforeEach(async function () { - this.visit('/dummy'); - this.server.get('/data-import-profiles/profileAssociations/:id/masters', { childSnapshotWrappers: [{ contentType: 'ACTION_PROFILE' }] }); - await findProfiles.whenLoaded(); - await findProfiles.mappingProfileButton.click(); - }); - - describe('when select a several profiles', () => { - beforeEach(async () => { - await findProfiles.modal.instances(2).selectLine(); - await findProfiles.modal.instances(0).selectLine(); - }); - - describe('and click on the "Save" button', () => { - beforeEach(async () => { - await findProfiles.modal.save.click(); - }); - - it('then confirmation modal appears', () => { - return expect(findProfiles.modal.confirmationModal.isPresent).to.be.true; - }); - - describe('when click on "Cancel" button', () => { - beforeEach(async () => { - await findProfiles.modal.confirmationModal.cancelButton.click(); - }); - - it('then close the confirmation modal', () => { - return expect(findProfiles.modal.confirmationModal.isPresent).to.be.false; - }); - - it('and return to the profile component search', () => { - return expect(findProfiles.modal.isPresent).to.be.true; - }); - }); - - describe('when click on "Relink" button', () => { - beforeEach(async () => { - await findProfiles.modal.confirmationModal.confirmButton.click(); - }); - - it('then close the confirmation modal', () => { - return expect(findProfiles.modal.confirmationModal.isPresent).to.be.false; - }); - - it('and close the profile component search', () => { - return expect(findProfiles.modal.isPresent).to.be.false; - }); - }); - }); - }); - }); - }); -});