diff --git a/app/cdap/components/DataPrep/AutoComplete/index.js b/app/cdap/components/DataPrep/AutoComplete/index.js
index e4542e3f539..33d21056027 100644
--- a/app/cdap/components/DataPrep/AutoComplete/index.js
+++ b/app/cdap/components/DataPrep/AutoComplete/index.js
@@ -26,9 +26,12 @@ import classnames from 'classnames';
import NamespaceStore from 'services/NamespaceStore';
import ee from 'event-emitter';
import globalEvents from 'services/global-events';
+import { getDataTestid } from '../../../testids/TestidsProvider';
require('./AutoComplete.scss');
+const TESTID_PREFIX = 'features.dataprep.workspace.cli.autocomplete';
+
export default class DataPrepAutoComplete extends Component {
constructor(props) {
super(props);
@@ -219,6 +222,7 @@ export default class DataPrepAutoComplete extends Component {
className={classnames('dataprep-auto-complete-container', {
'has-error': this.props.hasError,
})}
+ data-testid={getDataTestid(`${TESTID_PREFIX}.container`)}
>
{this.state.activeResults.map((row, index) => {
return (
@@ -228,14 +232,26 @@ export default class DataPrepAutoComplete extends Component {
})}
key={row.uniqueId}
onClick={this.handleRowClick.bind(this, row)}
+ data-testid={getDataTestid(`${TESTID_PREFIX}.directive.name`, row.item.directive)}
>
-
+
{row.item.directive}
-
{row.item.description}
+
+ {row.item.description}
+
{this.state.matchedmatched || this.state.activeResults.length === 1 ? (
-
+
diff --git a/app/cdap/components/DataPrep/ColumnActionsDropdown/index.js b/app/cdap/components/DataPrep/ColumnActionsDropdown/index.js
index 04cf85e8b80..1186b080d18 100644
--- a/app/cdap/components/DataPrep/ColumnActionsDropdown/index.js
+++ b/app/cdap/components/DataPrep/ColumnActionsDropdown/index.js
@@ -27,6 +27,7 @@ import isEqual from 'lodash/isEqual';
import DataPrepStore from 'components/DataPrep/store';
import ScrollableList from 'components/shared/ScrollableList';
import { Theme } from 'services/ThemeHelper';
+import { getDataTestid } from '../../../testids/TestidsProvider';
// Directives List
import ParseDirective from 'components/DataPrep/Directives/Parse';
@@ -57,6 +58,7 @@ import MapToTargetDirective from 'components/DataPrep/Directives/MapToTarget';
import ee from 'event-emitter';
require('./ColumnActionsDropdown.scss');
+const TESTID_PREFIX = 'features.dataprep.workspace.dataTable.head.directivesDropdown';
export default class ColumnActionsDropdown extends Component {
constructor(props) {
@@ -86,6 +88,7 @@ export default class ColumnActionsDropdown extends Component {
id: uuidV4(),
tag: ParseDirective,
requiredColCount: 1,
+ testid: 'parse-directive',
},
{
tag: 'divider',
@@ -97,6 +100,7 @@ export default class ColumnActionsDropdown extends Component {
id: uuidV4(),
tag: MapToTargetDirective,
requiredColCount: 1,
+ testid: 'map-to-target-directive',
},
{
tag: 'divider',
@@ -108,11 +112,13 @@ export default class ColumnActionsDropdown extends Component {
id: uuidV4(),
tag: SetCharacterEncoding,
requiredColCount: 1,
+ testid: 'set-character-encoding-directive',
},
{
id: uuidV4(),
tag: ChangeDataTypeDirective,
requiredColCount: 1,
+ testid: 'change-data-type-directive',
},
{
tag: 'divider',
@@ -121,16 +127,19 @@ export default class ColumnActionsDropdown extends Component {
id: uuidV4(),
tag: Format,
requiredColCount: 1,
+ testid: 'format-directive',
},
{
id: uuidV4(),
tag: Calculate,
requiredColCount: 0,
+ testid: 'calculate-directive',
},
{
id: uuidV4(),
tag: CustomTransform,
requiredColCount: 1,
+ testid: 'custom-transform-directive',
},
{
tag: 'divider',
@@ -139,21 +148,25 @@ export default class ColumnActionsDropdown extends Component {
id: uuidV4(),
tag: FilterDirective,
requiredColCount: 1,
+ testid: 'filter-directive',
},
{
id: uuidV4(),
tag: MarkAsError,
requiredColCount: 1,
+ testid: 'mark-as-error-directive',
},
{
id: uuidV4(),
tag: FindAndReplaceDirective,
requiredColCount: 1,
+ testid: 'find-and-replace-directive',
},
{
id: uuidV4(),
tag: FillNullOrEmpty,
requiredColCount: 1,
+ testid: 'fill-null-or-empty-directive',
},
{
tag: 'divider',
@@ -162,26 +175,31 @@ export default class ColumnActionsDropdown extends Component {
id: uuidV4(),
tag: CopyColumnDirective,
requiredColCount: 1,
+ testid: 'copy-column-directive',
},
{
id: uuidV4(),
tag: DropColumnDirective,
requiredColCount: 0,
+ testid: 'drop-column-directive',
},
{
id: uuidV4(),
tag: KeepColumnDirective,
requiredColCount: 0,
+ testid: 'keep-column-directive',
},
{
id: uuidV4(),
tag: MergeColumnsDirective,
requiredColCount: 2,
+ testid: 'merge-column-directive',
},
{
id: uuidV4(),
tag: SwapColumnsDirective,
requiredColCount: 2,
+ testid: 'swap-column-directive',
},
{
tag: 'divider',
@@ -190,21 +208,25 @@ export default class ColumnActionsDropdown extends Component {
id: uuidV4(),
tag: ExtractFields,
requiredColCount: 1,
+ testid: 'extract-fields-directive',
},
{
id: uuidV4(),
tag: Explode,
requiredColCount: 0,
+ testid: 'explode-directive',
},
{
id: uuidV4(),
tag: DefineVariableDirective,
requiredColCount: 1,
+ testid: 'define-variable-directive',
},
{
id: uuidV4(),
tag: SetCounterDirective,
requiredColCount: 1,
+ testid: 'set-counter-directive',
},
{
tag: 'divider',
@@ -213,21 +235,25 @@ export default class ColumnActionsDropdown extends Component {
id: uuidV4(),
tag: MaskData,
requiredColCount: 1,
+ testid: 'mask-data-directive',
},
{
id: uuidV4(),
tag: EncodeDecode,
requiredColCount: 1,
+ testid: 'encode-decode-directive',
},
{
id: uuidV4(),
tag: Decode,
requiredColCount: 1,
+ testid: 'decode-directive',
},
{
id: uuidV4(),
tag: Hash,
requiredColCount: 1,
+ testid: 'hash-directive',
}
);
this.eventEmitter = ee(ee);
@@ -391,6 +417,7 @@ export default class ColumnActionsDropdown extends Component {
key={directive.id}
onClick={!disabled ? this.directiveClick.bind(this, directive.id) : undefined}
className={classnames({ disabled: disabled })}
+ data-testid={getDataTestid(`${TESTID_PREFIX}.menu`, directive.testid)}
>
(this.directiveRef = ref)}
onPaste={this.handlePaste}
disabled={this.props.disabled}
+ data-testid={getDataTestid(`${TESTID_PREFIX}.input`)}
/>
diff --git a/app/cdap/components/DataPrep/DataPrepContentWrapper/index.js b/app/cdap/components/DataPrep/DataPrepContentWrapper/index.js
index 62b3dc32d9e..3333f60ceb0 100644
--- a/app/cdap/components/DataPrep/DataPrepContentWrapper/index.js
+++ b/app/cdap/components/DataPrep/DataPrepContentWrapper/index.js
@@ -29,6 +29,7 @@ import LoadingSVGCentered from 'components/shared/LoadingSVGCentered';
import DataPrepSidePanel from 'components/DataPrep/DataPrepSidePanel';
import classnames from 'classnames';
import T from 'i18n-react';
+import { getDataTestid } from '../../../testids/TestidsProvider';
require('./DataPrepContentWrapper.scss');
const DataPrepVisualization = Loadable({
@@ -39,6 +40,7 @@ const DataPrepVisualization = Loadable({
loading: LoadingSVGCentered,
});
const PREFIX = 'features.DataPrep.TopPanel';
+const TESTID_PREFIX = 'features.dataprep.workspace.topPanel';
const DEFAULTVIEW = 'data';
const DEFAULTSTORESTATE = { view: DEFAULTVIEW };
const view = (state = DEFAULTVIEW, action = defaultAction) => {
@@ -66,6 +68,7 @@ function ContentSwitch({ onSwitchChange, activeTab }) {
active: activeTab === 'data',
})}
onClick={onSwitchChange.bind(null, 'data')}
+ data-testid={getDataTestid(`${TESTID_PREFIX}.tabs.data`)}
>
{T.translate(`${PREFIX}.Tabs.dataprep`)}
@@ -74,6 +77,7 @@ function ContentSwitch({ onSwitchChange, activeTab }) {
active: activeTab === 'viz',
})}
onClick={onSwitchChange.bind(null, 'viz')}
+ data-testid={getDataTestid(`${TESTID_PREFIX}.tabs.viz`)}
>
{T.translate(`${PREFIX}.Tabs.dataviz`)}
diff --git a/app/cdap/components/DataPrep/DataPrepSidePanel/ColumnsTab/ColumnsTabDetail.js b/app/cdap/components/DataPrep/DataPrepSidePanel/ColumnsTab/ColumnsTabDetail.js
index 81cede0b4a3..d0d833ae433 100644
--- a/app/cdap/components/DataPrep/DataPrepSidePanel/ColumnsTab/ColumnsTabDetail.js
+++ b/app/cdap/components/DataPrep/DataPrepSidePanel/ColumnsTab/ColumnsTabDetail.js
@@ -18,8 +18,11 @@ import PropTypes from 'prop-types';
import React from 'react';
import T from 'i18n-react';
+import { getDataTestid } from '../../../../testids/TestidsProvider';
const PREFIX = 'features.DataPrep.DataPrepSidePanel.ColumnsTab.ColumnDetail';
+const TESTID_PREFIX = 'features.dataprep.workspace.columnsPanel.list.column';
+
export default function ColumnsTabDetail({ columnInfo }) {
let { types } = columnInfo;
if (!types) {
@@ -29,7 +32,10 @@ export default function ColumnsTabDetail({ columnInfo }) {
return (
-
+
{T.translate(`${PREFIX}.Header.inferredType`)} |
diff --git a/app/cdap/components/DataPrep/DataPrepSidePanel/ColumnsTab/ColumnsTabRow.js b/app/cdap/components/DataPrep/DataPrepSidePanel/ColumnsTab/ColumnsTabRow.js
index 897d61379d4..e26c84fa287 100644
--- a/app/cdap/components/DataPrep/DataPrepSidePanel/ColumnsTab/ColumnsTabRow.js
+++ b/app/cdap/components/DataPrep/DataPrepSidePanel/ColumnsTab/ColumnsTabRow.js
@@ -21,6 +21,9 @@ import { preventPropagation } from 'services/helpers';
import isEqual from 'lodash/isEqual';
import classnames from 'classnames';
import { CSSTransition } from 'react-transition-group';
+import { getDataTestid } from '../../../../testids/TestidsProvider';
+
+const TESTID_PREFIX = 'features.dataprep.workspace.columnsPanel.list.column';
class ColumnsTabRow extends Component {
constructor(props) {
@@ -78,6 +81,7 @@ class ColumnsTabRow extends Component {
})}
onClick={this.props.onShowDetails}
ref={this.props.innerRef}
+ data-testid={getDataTestid(`${TESTID_PREFIX}.listRow`, this.props.columnName)}
>
|
@@ -87,12 +91,15 @@ class ColumnsTabRow extends Component {
'fa-square-o': !this.state.selected,
'fa-check-square': this.state.selected,
})}
+ data-testid={getDataTestid(`${TESTID_PREFIX}.selectToggle`)}
/>
|
{this.props.index + 1}
|
- {this.props.columnName} |
+
+ {this.props.columnName}
+ |
{`${nonNull}%`}
|
diff --git a/app/cdap/components/DataPrep/DataPrepSidePanel/ColumnsTab/index.js b/app/cdap/components/DataPrep/DataPrepSidePanel/ColumnsTab/index.js
index 21e7617490d..33f781afa86 100644
--- a/app/cdap/components/DataPrep/DataPrepSidePanel/ColumnsTab/index.js
+++ b/app/cdap/components/DataPrep/DataPrepSidePanel/ColumnsTab/index.js
@@ -26,7 +26,10 @@ import findIndex from 'lodash/findIndex';
import T from 'i18n-react';
import ColumnActions from 'components/DataPrep/Directives/ColumnActions';
import IconSVG from 'components/shared/IconSVG';
+import { getDataTestid } from '../../../../testids/TestidsProvider';
+
const PREFIX = 'features.DataPrep.DataPrepSidePanel.ColumnsTab';
+const TESTID_PREFIX = 'features.dataprep.workspace.columnsPanel';
require('./ColumnsTab.scss');
@@ -141,14 +144,25 @@ export default class ColumnsTab extends Component {
renderDropdown() {
return (
-
+
-
+
{T.translate(`${PREFIX}.toggle.clearAll`)}
-
+
{T.translate(`${PREFIX}.toggle.selectAll`)}
@@ -300,12 +314,17 @@ export default class ColumnsTab extends Component {
value={this.state.searchText}
onChange={this.handleChangeSearch}
ref={(ref) => (this.searchBox = ref)}
+ data-testid={getDataTestid(`${TESTID_PREFIX}.search.input`)}
/>
{this.state.searchText.length === 0 ? (
) : (
-
+
)}
diff --git a/app/cdap/components/DataPrep/DataPrepSidePanel/DirectivesTab/index.js b/app/cdap/components/DataPrep/DataPrepSidePanel/DirectivesTab/index.js
index 31cd2f7dfa8..a89b8fac0f2 100644
--- a/app/cdap/components/DataPrep/DataPrepSidePanel/DirectivesTab/index.js
+++ b/app/cdap/components/DataPrep/DataPrepSidePanel/DirectivesTab/index.js
@@ -21,8 +21,12 @@ import DirectivesTabRow from 'components/DataPrep/DataPrepSidePanel/DirectivesTa
import fileDownload from 'js-file-download';
import { execute } from 'components/DataPrep/store/DataPrepActionCreator';
import T from 'i18n-react';
+import { getDataTestid } from '../../../../testids/TestidsProvider';
require('./DirectivesTab.scss');
+
+const TESTID_PREFIX = 'features.dataprep.workspace.transformationsPanel';
+
export default class DirectivesTab extends Component {
constructor(props) {
super(props);
@@ -101,7 +105,11 @@ export default class DirectivesTab extends Component {
#
{T.translate('features.DataPrep.DataPrepSidePanel.DirectivesTab.label')}
-
diff --git a/app/cdap/components/DataPrep/DataPrepSidePanel/index.js b/app/cdap/components/DataPrep/DataPrepSidePanel/index.js
index bb17ae7430a..47a5e71f77a 100644
--- a/app/cdap/components/DataPrep/DataPrepSidePanel/index.js
+++ b/app/cdap/components/DataPrep/DataPrepSidePanel/index.js
@@ -23,9 +23,11 @@ import TargetTab from 'components/DataPrep/DataPrepSidePanel/TargetTab';
import DirectivesTab from 'components/DataPrep/DataPrepSidePanel/DirectivesTab';
import T from 'i18n-react';
import If from 'components/shared/If';
+import { getDataTestid } from '../../../testids/TestidsProvider';
require('./DataPrepSidePanel.scss');
const PREFIX = 'features.DataPrep.DataPrepSidePanel';
+const TESTID_PREFIX = 'features.dataprep.workspace.rightSidePanel';
export default class DataPrepSidePanel extends Component {
constructor(props) {
@@ -123,6 +125,7 @@ export default class DataPrepSidePanel extends Component {
{T.translate(`${PREFIX}.columnsTabLabel`, {
columnsCount: this.state.headers.length,
@@ -131,6 +134,7 @@ export default class DataPrepSidePanel extends Component {
{T.translate(`${PREFIX}.directivesTabLabel`, {
directivesCount: this.state.directives.length,
diff --git a/app/cdap/components/DataPrep/DataPrepTable/DataType/index.js b/app/cdap/components/DataPrep/DataPrepTable/DataType/index.js
index 9a136521d9a..dc06936b6b4 100644
--- a/app/cdap/components/DataPrep/DataPrepTable/DataType/index.js
+++ b/app/cdap/components/DataPrep/DataPrepTable/DataType/index.js
@@ -20,8 +20,10 @@ import T from 'i18n-react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import DataPrepStore from 'components/DataPrep/store';
+import { getDataTestid } from '../../../../testids/TestidsProvider';
const PREFIX = 'features.DataPrep.DataPrepTable.DataType';
+const TESTID_PREFIX = 'features.dataprep.workspace.dataTable';
export default class DataType extends Component {
constructor(props) {
@@ -54,6 +56,7 @@ export default class DataType extends Component {
className={classnames('col-type', {
'data-type-updated': this.state.highlightedDataType === this.props.columnName,
})}
+ data-testid={getDataTestid(`${TESTID_PREFIX}.head.dataType`)}
>
{types[this.props.columnName] || T.translate(`${PREFIX}.unknown`)}
diff --git a/app/cdap/components/DataPrep/DataPrepTable/index.js b/app/cdap/components/DataPrep/DataPrepTable/index.js
index b0bb12dd541..f680c31175e 100644
--- a/app/cdap/components/DataPrep/DataPrepTable/index.js
+++ b/app/cdap/components/DataPrep/DataPrepTable/index.js
@@ -33,6 +33,8 @@ import DataQuality from 'components/DataPrep/DataPrepTable/DataQuality';
import DataType from 'components/DataPrep/DataPrepTable/DataType';
import Page500 from 'components/500';
import Page404 from 'components/404';
+import { getDataTestid } from '../../../testids/TestidsProvider';
+
// Lazy load polyfill in safari as InteresectionObservers are not implemented there yet.
(async function() {
typeof IntersectionObserver === 'undefined'
@@ -41,6 +43,7 @@ import Page404 from 'components/404';
})();
const PREFIX = 'features.DataPrep.DataPrepTable';
+const TESTID_PREFIX = 'features.dataprep.workspace.dataTable';
const DEFAULT_WINDOW_SIZE = 100;
export default class DataPrepTable extends Component {
static propTypes = {
@@ -287,6 +290,7 @@ export default class DataPrepTable extends Component {
dropdownOpened: this.state.columnDropdownOpen === head.name,
})}
key={head.name}
+ data-testid={getDataTestid(`${TESTID_PREFIX}.head.col`, index + 1)}
>
@@ -303,6 +307,7 @@ export default class DataPrepTable extends Component {
{head.name}
@@ -314,6 +319,7 @@ export default class DataPrepTable extends Component {
onWarning={this.showWarningMessage.bind(this, index)}
allowSpace={false}
shouldSelect={true}
+ dataTestid={getDataTestid(`${TESTID_PREFIX}.head.columnNameInput`)}
/>
{head.showDuplicateWarning || head.showInvalidWarning ? (
@@ -358,10 +365,20 @@ export default class DataPrepTable extends Component {
{data.slice(0, this.state.windowSize).map((row) => {
return (
- {row.scrollId + 1} |
+
+ {row.scrollId + 1}
+ |
{headers.map((head, i) => {
return (
-
+ |
{row[head.name]}
|
);
diff --git a/app/cdap/components/DataPrep/Directives/ColumnActions/index.js b/app/cdap/components/DataPrep/Directives/ColumnActions/index.js
index 88345b9b23c..6c69749bb13 100644
--- a/app/cdap/components/DataPrep/Directives/ColumnActions/index.js
+++ b/app/cdap/components/DataPrep/Directives/ColumnActions/index.js
@@ -24,9 +24,12 @@ import DataPrepActions from 'components/DataPrep/store/DataPrepActions';
import Bulkset from 'components/DataPrep/Directives/ColumnActions/Bulkset';
import ReplaceColumns from 'components/DataPrep/Directives/ColumnActions/ReplaceColumns';
import T from 'i18n-react';
+import { getDataTestid } from '../../../../testids/TestidsProvider';
require('./ColumnActions.scss');
const PREFIX = 'features.DataPrep.Directives.ColumnActions';
+const TESTID_PREFIX = 'features.dataprep.workspace.columnsPanel.actionsDropdown';
+
export default class ColumnActions extends Component {
constructor(props) {
super(props);
@@ -96,7 +99,7 @@ export default class ColumnActions extends Component {
return (
-
+
{T.translate('features.DataPrep.Directives.ColumnActions.label')}
@@ -107,6 +110,7 @@ export default class ColumnActions extends Component {
key={i}
title={directive.name}
onClick={this.setActiveDirective.bind(this, i)}
+ data-testid={getDataTestid(`${TESTID_PREFIX}.directive`, directive.name)}
>
{directive.label}
diff --git a/app/cdap/components/DataPrep/Directives/Parse/Modals/CSVModal.js b/app/cdap/components/DataPrep/Directives/Parse/Modals/CSVModal.js
index 2075a248155..eda683204a8 100644
--- a/app/cdap/components/DataPrep/Directives/Parse/Modals/CSVModal.js
+++ b/app/cdap/components/DataPrep/Directives/Parse/Modals/CSVModal.js
@@ -22,8 +22,10 @@ import classnames from 'classnames';
import T from 'i18n-react';
import MouseTrap from 'mousetrap';
import DeprecatedMessage from 'components/shared/DeprecatedMessage';
+import { getDataTestid } from '../../../../../testids/TestidsProvider';
const PREFIX = 'features.DataPrep.Directives.Parse';
+const TESTID_PREFIX = 'features.dataprep.directives.parse.modal.csv';
const OPTIONS_MAP = {
COMMA: ',',
@@ -97,6 +99,7 @@ export default class CSVModal extends Component {
onChange={this.handleCustomDelimiterChange}
placeholder={T.translate(`${PREFIX}.Parsers.CSV.customPlaceholder`)}
autoFocus
+ data-testid={getDataTestid(`${TESTID_PREFIX}.customDelimeterInput`)}
/>
);
@@ -117,9 +120,15 @@ export default class CSVModal extends Component {
className="dataprep-parse-modal cdap-modal"
>
- {T.translate(`${PREFIX}.modalTitle`, { parser: 'CSV' })}
-
-
+
+ {T.translate(`${PREFIX}.modalTitle`, { parser: 'CSV' })}
+
+
+
@@ -131,7 +140,11 @@ export default class CSVModal extends Component {
{options.map((option) => {
return (
-
+
-
+
-
+
{T.translate('features.DataPrep.Directives.apply')}
-
+
{T.translate('features.DataPrep.Directives.cancel')}
diff --git a/app/cdap/components/DataPrep/Directives/Parse/Modals/LogModal.js b/app/cdap/components/DataPrep/Directives/Parse/Modals/LogModal.js
index 80f55c07f6a..fdeba249d95 100644
--- a/app/cdap/components/DataPrep/Directives/Parse/Modals/LogModal.js
+++ b/app/cdap/components/DataPrep/Directives/Parse/Modals/LogModal.js
@@ -21,8 +21,10 @@ import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import classnames from 'classnames';
import T from 'i18n-react';
import MouseTrap from 'mousetrap';
+import { getDataTestid } from '../../../../../testids/TestidsProvider';
const PREFIX = 'features.DataPrep.Directives.Parse';
+const TESTID_PREFIX = 'features.dataprep.directives.parse.modal.log';
const OPTIONS_MAP = {
COMMON: 'common',
@@ -87,6 +89,7 @@ export default class LogModal extends Component {
onChange={this.handleCustomFormatChange}
placeholder={T.translate(`${PREFIX}.Parsers.LOG.customPlaceholder`)}
autoFocus
+ data-testid={getDataTestid(`${TESTID_PREFIX}.customLogFormatInput`)}
/>
);
@@ -107,9 +110,15 @@ export default class LogModal extends Component {
className="dataprep-parse-modal cdap-modal"
>
- {T.translate(`${PREFIX}.modalTitle`, { parser: 'Log' })}
-
-
+
+ {T.translate(`${PREFIX}.modalTitle`, { parser: 'Log' })}
+
+
+
@@ -121,7 +130,11 @@ export default class LogModal extends Component {
{options.map((option) => {
return (
-
+
-
+
{T.translate('features.DataPrep.Directives.apply')}
-
+
{T.translate('features.DataPrep.Directives.cancel')}
diff --git a/app/cdap/components/DataPrep/Directives/Parse/Modals/XmlToJsonModal.tsx b/app/cdap/components/DataPrep/Directives/Parse/Modals/XmlToJsonModal.tsx
index 3cce9069992..9a743cfa708 100644
--- a/app/cdap/components/DataPrep/Directives/Parse/Modals/XmlToJsonModal.tsx
+++ b/app/cdap/components/DataPrep/Directives/Parse/Modals/XmlToJsonModal.tsx
@@ -19,8 +19,10 @@ import T from 'i18n-react';
import Mousetrap from 'mousetrap';
import classnames from 'classnames';
import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
+import { getDataTestid } from '../../../../../testids/TestidsProvider';
const PREFIX = 'features.DataPrep.Directives.Parse';
+const TESTID_PREFIX = 'features.dataprep.directives.parse.modal.xmlToJson';
interface IXmlToJsonProps {
toggle(): void;
@@ -62,8 +64,14 @@ export default function XmlToJsonModal({ toggle, onApply }: IXmlToJsonProps) {
autoFocus={false}
>
- {T.translate(`${PREFIX}.modalTitle`, { parser: parserTitle })}
-
+
+ {T.translate(`${PREFIX}.modalTitle`, { parser: parserTitle })}
+
+
@@ -81,11 +89,15 @@ export default function XmlToJsonModal({ toggle, onApply }: IXmlToJsonProps) {
value={depthValue}
onChange={onDepthChange}
autoFocus
+ data-testid={getDataTestid(`${TESTID_PREFIX}.depthInput`)}
/>
-
+
-
+
{T.translate('features.DataPrep.Directives.apply')}
-
+
{T.translate('features.DataPrep.Directives.cancel')}
diff --git a/app/cdap/components/DataPrep/Directives/Parse/index.js b/app/cdap/components/DataPrep/Directives/Parse/index.js
index c5761d3306e..e9d0221bcef 100644
--- a/app/cdap/components/DataPrep/Directives/Parse/index.js
+++ b/app/cdap/components/DataPrep/Directives/Parse/index.js
@@ -31,8 +31,10 @@ import XmlToJsonModal from 'components/DataPrep/Directives/Parse/Modals/XmlToJso
import DataPrepStore from 'components/DataPrep/store';
import DataPrepActions from 'components/DataPrep/store/DataPrepActions';
import { setPopoverOffset } from 'components/DataPrep/helper';
+import { getDataTestid } from '../../../../testids/TestidsProvider';
const SUFFIX = 'features.DataPrep.Directives.Parse';
+const TESTID_PREFIX = 'features.dataprep.directives.parse';
require('./ParseDirective.scss');
@@ -252,7 +254,7 @@ export default class ParseDirective extends Component {
{this.PARSE_OPTIONS.map((option) => {
return (
-
+
{T.translate(`${SUFFIX}.Parsers.${option}.label`)}
);
@@ -271,6 +273,7 @@ export default class ParseDirective extends Component {
className={classnames('parse-directive clearfix action-item', {
active: this.props.isOpen,
})}
+ data-testid={getDataTestid(`${TESTID_PREFIX}.title`)}
>
{T.translate(`${SUFFIX}.title`)}
diff --git a/app/cdap/components/DataPrep/TopPanel/index.js b/app/cdap/components/DataPrep/TopPanel/index.js
index eba1d6187eb..2491de0ce60 100644
--- a/app/cdap/components/DataPrep/TopPanel/index.js
+++ b/app/cdap/components/DataPrep/TopPanel/index.js
@@ -30,6 +30,7 @@ import IconSVG from 'components/shared/IconSVG';
import DataPrepPlusButton from 'components/DataPrep/TopPanel/PlusButton';
import { Theme } from 'services/ThemeHelper';
import classnames from 'classnames';
+import { getDataTestid } from '../../../testids/TestidsProvider';
const SchemaModal = Loadable({
loader: () =>
@@ -58,6 +59,7 @@ const IngestDataFromDataPrep = Loadable({
require('./TopPanel.scss');
const PREFIX = 'features.DataPrep.TopPanel';
+const TESTID_PREFIX = 'features.dataprep.workspace.topPanel';
export default class DataPrepTopPanel extends Component {
constructor(props) {
@@ -179,11 +181,13 @@ export default class DataPrepTopPanel extends Component {
isNil(this.state.workspaceInfo) ||
objectQuery(this.state, 'workspaceInfo', 'properties', 'connection') === 'upload',
disabledTooltip: T.translate(`${PREFIX}.copyToCDAPDatasetBtn.disabledTooltip`),
+ dataTestid: getDataTestid(`${TESTID_PREFIX}.actionButtons.moreDropdownMenu.ingestData`),
},
{
label: T.translate(`${PREFIX}.viewSchemaBtnLabel`),
iconName: 'icon-info-circle',
onClick: this.toggleSchemaModal,
+ dataTestid: getDataTestid(`${TESTID_PREFIX}.actionButtons.moreDropdownMenu.viewSchema`),
},
];
@@ -198,15 +202,26 @@ export default class DataPrepTopPanel extends Component {
return (
-
+
{connectionInfo}
-
+
{workspaceName}
-
+
{T.translate('features.DataPrep.TopPanel.columns')}: {dataprep.headers.length} |{' '}
{T.translate('features.DataPrep.TopPanel.rows')}: {dataprep.data.length}
@@ -253,6 +268,7 @@ export default class DataPrepTopPanel extends Component {
})}
title={menuItem.label}
onClick={isDisabled ? preventPropagation : menuItem.onClick}
+ data-testid={menuItem.dataTestid}
{...props}
>
{getMenuItem(menuItem)}
@@ -272,7 +288,11 @@ export default class DataPrepTopPanel extends Component {
renderMenu() {
return (
{T.translate('features.DataPrep.TopPanel.more')}}
+ target={() => (
+
+ {T.translate('features.DataPrep.TopPanel.more')}
+
+ )}
targetDimension={{ width: '31px', height: '31px' }}
className="more-dropdown"
placement="bottom"
@@ -296,6 +316,7 @@ export default class DataPrepTopPanel extends Component {
? 'disabled'
: false
}
+ data-testid={getDataTestid(`${TESTID_PREFIX}.actionButtons.apply`)}
>
{this.state.onSubmitLoading ? : null}
{T.translate(`${PREFIX}.applyBtnLabel`)}
@@ -306,7 +327,11 @@ export default class DataPrepTopPanel extends Component {
renderUpgradeBtn() {
return (
-
+
{T.translate(`${PREFIX}.upgradeBtnLabel`)}
@@ -330,7 +355,11 @@ export default class DataPrepTopPanel extends Component {
{this.state.higherVersion ? this.renderUpgradeBtn() : null}
{this.props.mode === 'ROUTED_WORKSPACE' ? this.renderApplyBtn() : null}
{this.props.mode !== 'ROUTED_WORKSPACE' ? (
-
+
{T.translate(`${PREFIX}.addToPipelineBtnLabel`)}
) : null}
diff --git a/app/cdap/components/DataPrep/WorkspaceTabs/WorkspaceTab/index.js b/app/cdap/components/DataPrep/WorkspaceTabs/WorkspaceTab/index.js
index 75a6e915820..93b139e941b 100644
--- a/app/cdap/components/DataPrep/WorkspaceTabs/WorkspaceTab/index.js
+++ b/app/cdap/components/DataPrep/WorkspaceTabs/WorkspaceTab/index.js
@@ -20,10 +20,12 @@ import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import NamespaceStore from 'services/NamespaceStore';
import IconSVG from 'components/shared/IconSVG';
+import { getDataTestid } from '../../../../testids/TestidsProvider';
require('./WorkspaceTab.scss');
const MAX_NAME_WIDTH = 140;
+const TESTID_PREFIX = 'features.dataprep.workspaceTabs.workspaceTab';
export default class WorkspaceTab extends Component {
constructor(props) {
@@ -79,11 +81,18 @@ export default class WorkspaceTab extends Component {
className="workspace-tab active clearfix"
title={workspace.workspaceName}
>
-
+
{this.state.overflow ? this.renderOverflow() : this.renderName()}
-
+
@@ -95,13 +104,20 @@ export default class WorkspaceTab extends Component {
return (
-
+
{this.state.overflow ? this.renderOverflow() : this.renderName()}
-
+
diff --git a/app/cdap/components/Home/HomeActions/ActionCard.tsx b/app/cdap/components/Home/HomeActions/ActionCard.tsx
index 238398d39b3..cba606c26b1 100644
--- a/app/cdap/components/Home/HomeActions/ActionCard.tsx
+++ b/app/cdap/components/Home/HomeActions/ActionCard.tsx
@@ -90,6 +90,7 @@ interface IActionCardProps extends WithStyles {
description: string;
links: ILink[];
experiment?: string;
+ dataTestId?: string;
};
}
@@ -115,14 +116,24 @@ const ActionCardView: React.FC = ({ config, classes }) => {
if (isNativeLink) {
return (
-
+
{link.label}
);
} else {
url = url.slice(linkPrefix.length);
return (
-
+
{link.label}
);
diff --git a/app/cdap/components/Home/HomeActions/ActionConfig.ts b/app/cdap/components/Home/HomeActions/ActionConfig.ts
index 409df04447f..c837b78ad95 100644
--- a/app/cdap/components/Home/HomeActions/ActionConfig.ts
+++ b/app/cdap/components/Home/HomeActions/ActionConfig.ts
@@ -16,7 +16,9 @@
import T from 'i18n-react';
import { Theme } from 'services/ThemeHelper';
+import { getDataTestid } from '../../../testids/TestidsProvider';
const PREFIX = 'features.Home';
+const TESTID_PREFIX = 'features.home';
interface ILink {
label: string;
@@ -30,6 +32,7 @@ interface IAction {
links: ILink[];
experiment?: string;
featureFlag?: boolean;
+ dataTestId?: string;
}
export const ActionConfig: IAction[] = [
@@ -49,6 +52,7 @@ export const ActionConfig: IAction[] = [
img: '/cdap_assets/img/cleanse_data.svg',
title: T.translate(`${PREFIX}.Wrangler.title`).toString(),
description: T.translate(`${PREFIX}.Wrangler.description`).toString(),
+ dataTestId: getDataTestid(`${TESTID_PREFIX}.wrangler.pageLink`),
links: [
{
label: T.translate(`${PREFIX}.Wrangler.linkLabel`).toString(),
diff --git a/app/cdap/components/TextboxOnValium/index.js b/app/cdap/components/TextboxOnValium/index.js
index a8e09b5d285..4339474e59f 100644
--- a/app/cdap/components/TextboxOnValium/index.js
+++ b/app/cdap/components/TextboxOnValium/index.js
@@ -115,6 +115,7 @@ export default class TextboxOnValium extends Component {
value={this.state.textValue}
onKeyPress={this.handleKeyPress}
onKeyUp={!this.props.onKeyUp ? this.handleKeyPress : this.props.onKeyUp}
+ data-testid={this.props.dataTestid}
/>
);
}
@@ -124,6 +125,7 @@ TextboxOnValium.defaultProps = {
allowSpace: true,
validCharacterRegex: null,
disabled: false,
+ dataTestid: '',
};
TextboxOnValium.propTypes = {
@@ -138,4 +140,5 @@ TextboxOnValium.propTypes = {
shouldSelect: PropTypes.bool,
validCharacterRegex: PropTypes.object, // regex expression
disabled: PropTypes.bool,
+ dataTestid: PropTypes.string,
};
diff --git a/app/cdap/components/shared/ScrollableList/index.js b/app/cdap/components/shared/ScrollableList/index.js
index e9824613b53..11dfe787c2d 100644
--- a/app/cdap/components/shared/ScrollableList/index.js
+++ b/app/cdap/components/shared/ScrollableList/index.js
@@ -20,8 +20,10 @@ import React, { Component } from 'react';
import IconSVG from 'components/shared/IconSVG';
import findIndex from 'lodash/findIndex';
import classnames from 'classnames';
+import { getDataTestid } from '../../../testids/TestidsProvider';
require('./ScrollableList.scss');
+const TESTID_PREFIX = 'common.components.scrollableList';
export default class ScrollableList extends Component {
constructor(props) {
@@ -161,6 +163,7 @@ export default class ScrollableList extends Component {
onClick={this.scrollDown}
onMouseEnter={this.onMouseEnter.bind(this, this.scrollDown)}
onMouseOut={this.onMouseOut}
+ data-testid={getDataTestid(`${TESTID_PREFIX}.scrollDownButton`)}
>
@@ -175,6 +178,7 @@ export default class ScrollableList extends Component {
onClick={this.scrollUp}
onMouseEnter={this.onMouseEnter.bind(this, this.scrollUp)}
onMouseOut={this.onMouseOut}
+ data-testid={getDataTestid(`${TESTID_PREFIX}.scrollUpButton`)}
>
diff --git a/app/cdap/testids/testids.yaml b/app/cdap/testids/testids.yaml
index ae0727174a8..a59d11356d4 100644
--- a/app/cdap/testids/testids.yaml
+++ b/app/cdap/testids/testids.yaml
@@ -8,6 +8,11 @@
# Please do not modify this comment section at the top.
# This section is added by the testid-yaml-loader.
+common:
+ components:
+ scrollableList:
+ scrollDownButton: ~
+ scrollUpButton: ~
features:
administration:
configuration:
@@ -20,6 +25,100 @@ features:
tab: ~
tethering:
tab: ~
+ dataprep:
+ directives:
+ parse:
+ modal:
+ csv:
+ applyButton: ~
+ cancelButton: ~
+ closeButton: ~
+ customDelimeterInput: ~
+ firstRowAsHeaderToggle: ~
+ option: ~
+ title: ~
+ log:
+ applyButton: ~
+ cancelButton: ~
+ closeButton: ~
+ customLogFormatInput: ~
+ option: ~
+ title: ~
+ xmlToJson:
+ applyButton: ~
+ cancelButton: ~
+ closeButton: ~
+ depthInput: ~
+ keepStringsToggle: ~
+ title: ~
+ option: ~
+ title: ~
+ workspace:
+ cli:
+ autocomplete:
+ container: ~
+ directive:
+ description: ~
+ name: ~
+ title: ~
+ usage: ~
+ input: ~
+ columnsPanel:
+ actionsDropdown:
+ directive: ~
+ dropdownToggle: ~
+ list:
+ column:
+ details: ~
+ listRow: ~
+ name: ~
+ selectToggle: ~
+ header:
+ actionsDropdownToggle: ~
+ selectAllToggle: ~
+ unselectAllToggle: ~
+ search:
+ clearButton: ~
+ input: ~
+ dataTable:
+ body:
+ cell: ~
+ head:
+ col: ~
+ columnName: ~
+ columnNameInput: ~
+ columnSelectToggle: ~
+ dataType: ~
+ directivesDropdown:
+ menu: ~
+ toggleButton: ~
+ rightSidePanel:
+ tabs:
+ columns: ~
+ transformations: ~
+ topPanel:
+ actionButtons:
+ apply: ~
+ createPipeline: ~
+ moreDropdownButton: ~
+ moreDropdownMenu:
+ ingestData: ~
+ viewSchema: ~
+ upgradeButton: ~
+ connectionType: ~
+ rowsColumnsCount: ~
+ tabs:
+ data: ~
+ viz: ~
+ workspaceName: ~
+ transformationsPanel:
+ downloadButton: ~
+ list:
+ directive: ~
+ workspaceTabs:
+ workspaceTab:
+ closeButton: ~
+ name: ~
entityListView:
allEntities: ~
entity:
@@ -32,3 +131,6 @@ features:
truncate: ~
named: ~
justAdded: ~
+ home:
+ wrangler:
+ pageLink: ~
|