diff --git a/openbis_ng_ui/srcTest/js/components/tools/browser/ToolBrowserComponentFilter.test.js b/openbis_ng_ui/srcTest/js/components/tools/browser/ToolBrowserComponentFilter.test.js new file mode 100644 index 0000000000000000000000000000000000000000..5c413609eb122ed9188c5e5682d85a93feedb47a --- /dev/null +++ b/openbis_ng_ui/srcTest/js/components/tools/browser/ToolBrowserComponentFilter.test.js @@ -0,0 +1,63 @@ +import ToolBrowserComponentTest from '@srcTest/js/components/tools/browser/ToolBrowserComponentTest.js' +import ToolBrowserTestData from '@srcTest/js/components/tools/browser/ToolBrowserTestData.js' +import openbis from '@srcTest/js/services/openbis.js' + +let common = null + +beforeEach(() => { + common = new ToolBrowserComponentTest() + common.beforeEach() +}) + +describe(ToolBrowserComponentTest.SUITE, () => { + test('filter', testFilter) +}) + +async function testFilter() { + const { + testDynamicPropertyJythonPlugin, + testDynamicPropertyPredeployedPlugin, + testManagedPropertyJythonPlugin, + testEntityValidationJythonPlugin + } = ToolBrowserTestData + + openbis.mockSearchPlugins([ + testDynamicPropertyJythonPlugin, + testDynamicPropertyPredeployedPlugin, + testManagedPropertyJythonPlugin, + testEntityValidationJythonPlugin + ]) + + const browser = await common.mount() + + browser + .getFilter() + .change(testEntityValidationJythonPlugin.name.toUpperCase()) + await browser.update() + + browser.expectJSON({ + filter: { + value: testEntityValidationJythonPlugin.name.toUpperCase() + }, + nodes: [ + { level: 0, text: 'Entity Validation Plugins' }, + { level: 1, text: testEntityValidationJythonPlugin.name } + ] + }) + + browser.getFilter().getClearIcon().click() + await browser.update() + + browser.expectJSON({ + filter: { + value: null + }, + nodes: [ + { level: 0, text: 'Dynamic Property Plugins' }, + { level: 1, text: testDynamicPropertyJythonPlugin.name }, + { level: 1, text: testDynamicPropertyPredeployedPlugin.name }, + { level: 0, text: 'Entity Validation Plugins' }, + { level: 1, text: testEntityValidationJythonPlugin.name } + ] + }) +} diff --git a/openbis_ng_ui/srcTest/js/components/tools/browser/ToolBrowserComponentLoad.test.js b/openbis_ng_ui/srcTest/js/components/tools/browser/ToolBrowserComponentLoad.test.js new file mode 100644 index 0000000000000000000000000000000000000000..ada84839f76c58c060f5d2ec73f81d220ba896a6 --- /dev/null +++ b/openbis_ng_ui/srcTest/js/components/tools/browser/ToolBrowserComponentLoad.test.js @@ -0,0 +1,29 @@ +import ToolBrowserComponentTest from '@srcTest/js/components/tools/browser/ToolBrowserComponentTest.js' +import openbis from '@srcTest/js/services/openbis.js' + +let common = null + +beforeEach(() => { + common = new ToolBrowserComponentTest() + common.beforeEach() +}) + +describe(ToolBrowserComponentTest.SUITE, () => { + test('load', testLoad) +}) + +async function testLoad() { + openbis.mockSearchPlugins([]) + + const browser = await common.mount() + + browser.expectJSON({ + filter: { + value: null + }, + nodes: [ + { level: 0, text: 'Dynamic Property Plugins' }, + { level: 0, text: 'Entity Validation Plugins' } + ] + }) +} diff --git a/openbis_ng_ui/srcTest/js/components/tools/browser/ToolBrowserComponentOpenClose.test.js b/openbis_ng_ui/srcTest/js/components/tools/browser/ToolBrowserComponentOpenClose.test.js new file mode 100644 index 0000000000000000000000000000000000000000..ead4b607a7f74cfc00f856881de029b2d266151c --- /dev/null +++ b/openbis_ng_ui/srcTest/js/components/tools/browser/ToolBrowserComponentOpenClose.test.js @@ -0,0 +1,90 @@ +import ToolBrowserComponentTest from '@srcTest/js/components/tools/browser/ToolBrowserComponentTest.js' +import ToolBrowserTestData from '@srcTest/js/components/tools/browser/ToolBrowserTestData.js' +import openbis from '@srcTest/js/services/openbis.js' + +let common = null + +beforeEach(() => { + common = new ToolBrowserComponentTest() + common.beforeEach() +}) + +describe(ToolBrowserComponentTest.SUITE, () => { + test('open/close', testOpenClose) +}) + +async function testOpenClose() { + const { + testDynamicPropertyJythonPlugin, + testDynamicPropertyPredeployedPlugin, + testManagedPropertyJythonPlugin, + testEntityValidationJythonPlugin + } = ToolBrowserTestData + + openbis.mockSearchPlugins([ + testDynamicPropertyJythonPlugin, + testDynamicPropertyPredeployedPlugin, + testManagedPropertyJythonPlugin, + testEntityValidationJythonPlugin + ]) + + const browser = await common.mount() + + browser.getNodes()[0].getIcon().click() + await browser.update() + + browser.expectJSON({ + filter: { + value: null + }, + nodes: [ + { level: 0, text: 'Dynamic Property Plugins' }, + { level: 1, text: testDynamicPropertyJythonPlugin.name }, + { level: 1, text: testDynamicPropertyPredeployedPlugin.name }, + { level: 0, text: 'Entity Validation Plugins' } + ] + }) + + browser.getNodes()[3].getIcon().click() + await browser.update() + + browser.expectJSON({ + filter: { + value: null + }, + nodes: [ + { level: 0, text: 'Dynamic Property Plugins' }, + { level: 1, text: testDynamicPropertyJythonPlugin.name }, + { level: 1, text: testDynamicPropertyPredeployedPlugin.name }, + { level: 0, text: 'Entity Validation Plugins' }, + { level: 1, text: testEntityValidationJythonPlugin.name } + ] + }) + + browser.getNodes()[0].getIcon().click() + await browser.update() + + browser.expectJSON({ + filter: { + value: null + }, + nodes: [ + { level: 0, text: 'Dynamic Property Plugins' }, + { level: 0, text: 'Entity Validation Plugins' }, + { level: 1, text: testEntityValidationJythonPlugin.name } + ] + }) + + browser.getNodes()[1].getIcon().click() + await browser.update() + + browser.expectJSON({ + filter: { + value: null + }, + nodes: [ + { level: 0, text: 'Dynamic Property Plugins' }, + { level: 0, text: 'Entity Validation Plugins' } + ] + }) +} diff --git a/openbis_ng_ui/srcTest/js/components/tools/browser/ToolBrowserComponentTest.js b/openbis_ng_ui/srcTest/js/components/tools/browser/ToolBrowserComponentTest.js new file mode 100644 index 0000000000000000000000000000000000000000..9ed62735c5f2578ef31fb8032a126ce6a0d50be7 --- /dev/null +++ b/openbis_ng_ui/srcTest/js/components/tools/browser/ToolBrowserComponentTest.js @@ -0,0 +1,15 @@ +import React from 'react' +import ComponentTest from '@srcTest/js/components/common/ComponentTest.js' +import BrowserWrapper from '@srcTest/js/components/common/browser/wrapper/BrowserWrapper.js' +import ToolBrowser from '@src/js/components/tools/browser/ToolBrowser.jsx' + +export default class ToolBrowserComponentTest extends ComponentTest { + static SUITE = 'ToolBrowserComponent' + + constructor() { + super( + () => <ToolBrowser />, + wrapper => new BrowserWrapper(wrapper) + ) + } +} diff --git a/openbis_ng_ui/srcTest/js/components/tools/browser/ToolBrowserTestData.js b/openbis_ng_ui/srcTest/js/components/tools/browser/ToolBrowserTestData.js new file mode 100644 index 0000000000000000000000000000000000000000..9d477ad6d80582aba63b1c5edf75f082757db597 --- /dev/null +++ b/openbis_ng_ui/srcTest/js/components/tools/browser/ToolBrowserTestData.js @@ -0,0 +1,40 @@ +import openbis from '@srcTest/js/services/openbis.js' + +const testDynamicPropertyJythonPlugin = new openbis.Plugin() +testDynamicPropertyJythonPlugin.setName('TEST_DYNAMIC_PROPERTY_JYTHON') +testDynamicPropertyJythonPlugin.setPluginKind(openbis.PluginKind.JYTHON) +testDynamicPropertyJythonPlugin.setPluginType( + openbis.PluginType.DYNAMIC_PROPERTY +) + +const testDynamicPropertyPredeployedPlugin = new openbis.Plugin() +testDynamicPropertyPredeployedPlugin.setName( + 'TEST_DYNAMIC_PROPERTY_PREDEPLOYED' +) +testDynamicPropertyPredeployedPlugin.setPluginKind( + openbis.PluginKind.PREDEPLOYED +) +testDynamicPropertyPredeployedPlugin.setPluginType( + openbis.PluginType.DYNAMIC_PROPERTY +) + +const testManagedPropertyJythonPlugin = new openbis.Plugin() +testManagedPropertyJythonPlugin.setName('TEST_MANAGED_PROPERTY_JYTHON') +testManagedPropertyJythonPlugin.setPluginKind(openbis.PluginKind.JYTHON) +testManagedPropertyJythonPlugin.setPluginType( + openbis.PluginType.MANAGED_PROPERTY +) + +const testEntityValidationJythonPlugin = new openbis.Plugin() +testEntityValidationJythonPlugin.setName('TEST_ENTITY_VALIDATION_JYTHON') +testEntityValidationJythonPlugin.setPluginKind(openbis.PluginKind.JYTHON) +testEntityValidationJythonPlugin.setPluginType( + openbis.PluginType.ENTITY_VALIDATION +) + +export default { + testDynamicPropertyJythonPlugin, + testDynamicPropertyPredeployedPlugin, + testManagedPropertyJythonPlugin, + testEntityValidationJythonPlugin +}