Skip to content

Commit d32163f

Browse files
[ui-qe] Adding data-testid attribute to the Hue page HTML elements (#3652)
* Adding data-testid attribute to the Hue page HTML elements * Changing names of the data-testIds based on reviews * Run js lint * Removed the first data-testId * Changing to some meaningful dataTestIds names * Changes based on Johan's review-2 * 4th query * Snapshot testing-1st query * snapshot testing for 12th query * passing dataTestId as a prperty in knockout js file * changing names for query number 14 * Fix tests * Fixing based on the PR reviews by Johan * Reverting the change for the job-browswer.mako file * Save as button * Snapshot testing npm run dev-test * ko.dropDown.js adding as an attribute again based on review * Continuing the above commit * Fixing the issues after the PR Review * Fixes after review * Query number 15 adding at one more place * Changing names for better consistency * Naming consistency-2 * Naming Consistency-3 * Correction for the SaveAs button in the editor * Fixing the editorExecuteButton earlier QueryRunButton-4th * Adding the 5th to 4 new places * adding more files for refreshButton-10th query * Corrections based on Johan's PR review * rename save as to save * Fixing for query number 11 as per Johan PR review * Fixing the query 7th based on Johan PR review
1 parent 4a157d8 commit d32163f

File tree

16 files changed

+53
-31
lines changed

16 files changed

+53
-31
lines changed

desktop/core/src/desktop/js/components/sidebar/AccordionItem.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
>
3030
<button
3131
class="sidebar-base-btn sidebar-sidebar-item"
32+
:data-testid="`sidebar--${item.displayName.replace(/\s/g, '-').toLowerCase()}--button`"
3233
:aria-label="item.displayName"
3334
:class="{ 'sidebar-active': isActive, 'sidebar-accordion-item-btn-open': tooltip }"
3435
@click="toggleOpen"

desktop/core/src/desktop/js/ko/components/__snapshots__/ko.dropDown.test.js.snap

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`ko.dropDown.js should render component 1`] = `
4-
"<div data-bind=\\"descendantsComplete: descendantsComplete, component: { name: &quot;hue-drop-down&quot;, params: params }\\"><a class=\\"inactive-action hue-drop-down-active\\" href=\\"javascript:void(0)\\" data-bind=\\"toggle: dropDownVisible, css: { 'blue': dropDownVisible }\\">
4+
"<div data-bind=\\"descendantsComplete: descendantsComplete, component: { name: &quot;hue-drop-down&quot;, params: params }\\"><a class=\\"inactive-action hue-drop-down-active\\" href=\\"javascript:void(0)\\" data-bind=\\"
5+
attr: {
6+
'data-testid': dataTestId
7+
},
8+
toggle: dropDownVisible,
9+
css: { 'blue': dropDownVisible }\\">
510
<!-- ko if: icon --><!-- /ko -->
611
<!-- ko if: !noLabel && value --><!-- /ko -->
712
<i class=\\"fa fa-caret-down\\"></i>

desktop/core/src/desktop/js/ko/components/__snapshots__/ko.fieldSamples.test.js.snap

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ exports[`ko.fieldSamples.js should render component 1`] = `
3232
</div>
3333
<!-- ko if: showOperations -->
3434
<div class=\\"context-popover-sample-controls\\">
35-
<div class=\\"margin-left-10 inline-block\\" data-bind=\\"component: { name: 'hue-drop-down', params: { value: operation, entries: operations } }\\"><a class=\\"inactive-action hue-drop-down-active\\" href=\\"javascript:void(0)\\" data-bind=\\"toggle: dropDownVisible, css: { 'blue': dropDownVisible }\\">
35+
<div class=\\"margin-left-10 inline-block\\" data-bind=\\"component: { name: 'hue-drop-down', params: { value: operation, entries: operations } }\\"><a class=\\"inactive-action hue-drop-down-active\\" href=\\"javascript:void(0)\\" data-bind=\\"
36+
attr: {
37+
'data-testid': dataTestId
38+
},
39+
toggle: dropDownVisible,
40+
css: { 'blue': dropDownVisible }\\">
3641
<!-- ko if: icon --><!-- /ko -->
3742
<!-- ko if: !noLabel && value -->
3843
<span class=\\"hue-drop-down-selected\\" data-bind=\\"text: value() &amp;&amp; typeof value()[labelAttribute] !== 'undefined' ? value()[labelAttribute] : value(), visible: ! dropDownVisible() || !searchable, attr: { 'title': titleTooltip }\\" title=\\"default\\">default</span>

desktop/core/src/desktop/js/ko/components/assist/ko.assistDbPanel.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,22 +292,22 @@ const TEMPLATE =
292292
<!-- ko if: selectedSource().selectedNamespace() -->
293293
<!-- ko if: selectedSource().selectedNamespace().selectedDatabase() -->
294294
<a data-bind="click: back, appAwareTemplateContextMenu: { template: 'sql-context-items', viewModel: selectedSource().selectedNamespace().selectedDatabase() }">
295-
<i class="fa fa-chevron-left assist-breadcrumb-back" ></i>
295+
<i class="fa fa-chevron-left assist-breadcrumb-back" data-testid="assist-sql--tables-breadcrumb-back--button"></i>
296296
<i class="fa assist-breadcrumb-text" data-bind="css: { 'fa-server': nonSqlType, 'fa-database': !nonSqlType }"></i>
297297
<span class="assist-breadcrumb-text" data-bind="text: breadcrumb, attr: {'title': breadcrumbTitle }"></span>
298298
</a>
299299
<!-- /ko -->
300300
<!-- ko ifnot: selectedSource().selectedNamespace().selectedDatabase() -->
301301
<!-- ko if: window.HAS_MULTI_CLUSTER-->
302302
<a data-bind="click: back">
303-
<i class="fa fa-chevron-left assist-breadcrumb-back"></i>
303+
<i class="fa fa-chevron-left assist-breadcrumb-back" data-testid="assist-sql--databases-breadcrumb-back--button"></i>
304304
<i class="fa fa-snowflake-o assist-breadcrumb-text"></i>
305305
<span class="assist-breadcrumb-text" data-bind="text: breadcrumb, attr: {'title': breadcrumbTitle }"></span>
306306
</a>
307307
<!-- /ko -->
308308
<!-- ko ifnot: window.HAS_MULTI_CLUSTER -->
309309
<a data-bind="click: back">
310-
<i class="fa fa-chevron-left assist-breadcrumb-back"></i>
310+
<i class="fa fa-chevron-left assist-breadcrumb-back" data-testid="assist-sql--databases-breadcrumb-back--button"></i>
311311
<i class="fa fa-server assist-breadcrumb-text"></i>
312312
<span class="assist-breadcrumb-text" data-bind="text: breadcrumb"></span>
313313
</a>
@@ -316,7 +316,7 @@ const TEMPLATE =
316316
<!-- /ko -->
317317
<!-- ko ifnot: selectedSource().selectedNamespace() -->
318318
<a data-bind="click: back">
319-
<i class="fa fa-chevron-left assist-breadcrumb-back"></i>
319+
<i class="fa fa-chevron-left assist-breadcrumb-back" data-testid="assist-sql--namespaces-breadcrumb-back--button"></i>
320320
<i class="fa fa-server assist-breadcrumb-text"></i>
321321
<span class="assist-breadcrumb-text" data-bind="text: breadcrumb"></span>
322322
</a>

desktop/core/src/desktop/js/ko/components/assist/ko.assistDocumentsPanel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ const TEMPLATE = `
163163
</li>
164164
</ul>
165165
</span>
166-
<a class="inactive-action" href="javascript:void(0)" data-bind="click: function () { huePubSub.publish('${ REFRESH_DOC_ASSIST_EVENT }'); }"><i class="pointer fa fa-refresh" data-bind="css: { 'fa-spin blue' : loading }" title="${I18n(
166+
<a class="inactive-action" href="javascript:void(0)" data-bind="click: function () { huePubSub.publish('${ REFRESH_DOC_ASSIST_EVENT }'); }"><i class="pointer fa fa-refresh" data-testid="assist-sql--refresh--button" data-bind="css: { 'fa-spin blue' : loading }" title="${I18n(
167167
'Manual refresh'
168168
)}"></i></a>
169169
</div>
@@ -189,7 +189,7 @@ const TEMPLATE = `
189189
<div class="assist-flex-search">
190190
<div class="assist-filter">
191191
<form autocomplete="off">
192-
<input class="clearable" type="text" ${ window.PREVENT_AUTOFILL_INPUT_ATTRS } placeholder="${I18n(
192+
<input class="clearable" data-testid="assist-documents--filter--input" type="text" ${ window.PREVENT_AUTOFILL_INPUT_ATTRS } placeholder="${I18n(
193193
'Filter...'
194194
)}" data-bind="clearable: filter, value: filter, valueUpdate: 'afterkeydown'"/>
195195
</form>

desktop/core/src/desktop/js/ko/components/assist/ko.assistFunctionsPanel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const TEMPLATE = `
6767
<div class="assist-flex-search">
6868
<div class="assist-filter">
6969
<form autocomplete="off">
70-
<input class="clearable" type="text" ${ window.PREVENT_AUTOFILL_INPUT_ATTRS } placeholder="Filter..." data-bind="clearable: query, value: query, valueUpdate: 'afterkeydown'">
70+
<input class="clearable" data-testid="assist-udfs--filter--input" type="text" ${ window.PREVENT_AUTOFILL_INPUT_ATTRS } placeholder="Filter..." data-bind="clearable: query, value: query, valueUpdate: 'afterkeydown'">
7171
</form>
7272
</div>
7373
</div>

desktop/core/src/desktop/js/ko/components/assist/ko.assistGitPanel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const TEMPLATE = `
2929
3030
<script type="text/html" id="assist-git-header-actions">
3131
<div class="assist-db-header-actions">
32-
<a class="inactive-action" href="javascript:void(0)" data-bind="click: function () { huePubSub.publish('assist.git.refresh'); }"><i class="pointer fa fa-refresh" data-bind="css: { 'fa-spin blue' : loading }" title="${I18n(
32+
<a class="inactive-action" href="javascript:void(0)" data-bind="click: function () { huePubSub.publish('assist.git.refresh'); }"><i class="pointer fa fa-refresh" data-testid="assist-sql--refresh--button" data-bind="css: { 'fa-spin blue' : loading }" title="${I18n(
3333
'Manual refresh'
3434
)}"></i></a>
3535
</div>

desktop/core/src/desktop/js/ko/components/assist/ko.assistHBasePanel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const TEMPLATE = `
3838
3939
<script type="text/html" id="assist-hbase-header-actions">
4040
<div class="assist-db-header-actions">
41-
<a class="inactive-action" href="javascript:void(0)" data-bind="click: function () { huePubSub.publish('assist.hbase.refresh'); }"><i class="pointer fa fa-refresh" data-bind="css: { 'fa-spin blue' : loading }" title="${I18n(
41+
<a class="inactive-action" href="javascript:void(0)" data-bind="click: function () { huePubSub.publish('assist.hbase.refresh'); }"><i class="pointer fa fa-refresh" data-testid="assist-sql--refresh--button" data-bind="css: { 'fa-spin blue' : loading }" title="${I18n(
4242
'Manual refresh'
4343
)}"></i></a>
4444
</div>

desktop/core/src/desktop/js/ko/components/assist/ko.assistLangRefPanel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const TEMPLATE = `
5757
<div class="assist-flex-search">
5858
<div class="assist-filter">
5959
<form autocomplete="off">
60-
<input class="clearable" type="text" ${ window.PREVENT_AUTOFILL_INPUT_ATTRS } placeholder="Filter..." data-bind="clearable: query, value: query, valueUpdate: 'afterkeydown'">
60+
<input class="clearable" data-testid="assist-langref--filter--input" type="text" ${ window.PREVENT_AUTOFILL_INPUT_ATTRS } placeholder="Filter..." data-bind="clearable: query, value: query, valueUpdate: 'afterkeydown'">
6161
</form>
6262
</div>
6363
</div>

desktop/core/src/desktop/js/ko/components/assist/ko.assistPanel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const TEMPLATE = `
4545
<!-- ko if: availablePanels().length > 1 -->
4646
<div class="assist-panel-switches">
4747
<!-- ko foreach: availablePanels -->
48-
<div class="inactive-action assist-type-switch" data-bind="click: function () { $parent.visiblePanel($data); }, css: { 'blue': $parent.visiblePanel() === $data }, style: { 'float': rightAlignIcon ? 'right' : 'left' }, attr: { 'title': name }">
48+
<div class="inactive-action assist-type-switch" data-bind="click: function () { $parent.visiblePanel($data); }, css: { 'blue': $parent.visiblePanel() === $data }, style: { 'float': rightAlignIcon ? 'right' : 'left' }, attr: { 'title': name, 'data-testid': 'assist--' + type + '--button' }">
4949
<!-- ko if: iconSvg --><span style="font-size:22px;"><svg class="hi"><use data-bind="attr: {'href': iconSvg }" href=''></use></svg></span><!-- /ko -->
5050
<!-- ko if: !iconSvg --><i class="fa fa-fw valign-middle" data-bind="css: icon"></i><!-- /ko -->
5151
</div>

0 commit comments

Comments
 (0)