fix: Improve stability of NDV hover test (no-changelog) (#14679)

This commit is contained in:
shortstacked
2025-04-17 08:26:10 +01:00
committed by GitHub
parent ad386cde31
commit 8b70fbcb5f
2 changed files with 45 additions and 17 deletions

View File

@@ -29,7 +29,7 @@ export function getParameterInputByName(name: string) {
} }
export function getInputPanel() { export function getInputPanel() {
return cy.getByTestId('input-panel'); return cy.getByTestId('ndv-input-panel');
} }
export function getMainPanel() { export function getMainPanel() {
@@ -52,6 +52,10 @@ export function getResourceLocatorInput(paramName: string) {
return getResourceLocator(paramName).find('[data-test-id="rlc-input-container"]'); return getResourceLocator(paramName).find('[data-test-id="rlc-input-container"]');
} }
export function getInputPanelDataContainer() {
return getInputPanel().getByTestId('ndv-data-container');
}
export function getOutputPanelDataContainer() { export function getOutputPanelDataContainer() {
return getOutputPanel().getByTestId('ndv-data-container'); return getOutputPanel().getByTestId('ndv-data-container');
} }
@@ -272,3 +276,25 @@ export function populateFixedCollection<T extends readonly string[]>(
export function assertInlineExpressionValid() { export function assertInlineExpressionValid() {
cy.getByTestId('inline-expression-editor-input').find('.cm-valid-resolvable').should('exist'); cy.getByTestId('inline-expression-editor-input').find('.cm-valid-resolvable').should('exist');
} }
export function hoverInputItemByText(text: string) {
return getInputPanelDataContainer().contains(text).trigger('mouseover', { force: true });
}
export function verifyInputHoverState(expectedText: string) {
getInputPanelDataContainer()
.find('[data-test-id="hovering-item"]')
.should('be.visible')
.should('have.text', expectedText);
}
export function verifyOutputHoverState(expectedText: string) {
getOutputPanelDataContainer()
.find('[data-test-id="hovering-item"]')
.should('be.visible')
.should('have.text', expectedText);
}
export function resetHoverState() {
getBackToCanvasButton().trigger('mouseover');
}

View File

@@ -1,3 +1,4 @@
import * as ndvComposables from '../composables/ndv';
import { WorkflowPage, NDV } from '../pages'; import { WorkflowPage, NDV } from '../pages';
const workflowPage = new WorkflowPage(); const workflowPage = new WorkflowPage();
@@ -71,39 +72,40 @@ describe('NDV', () => {
ndv.getters ndv.getters
.outputRunSelector() .outputRunSelector()
.find('input') .find('input')
.should('exist') .should('be.visible')
.should('have.value', '2 of 2 (6 items)'); .should('have.value', '2 of 2 (6 items)');
ndv.actions.switchInputMode('Table'); ndv.actions.switchInputMode('Table');
ndv.actions.switchOutputMode('Table'); ndv.actions.switchOutputMode('Table');
ndv.getters.backToCanvas().realMouseMove(10, 1); // reset to default hover // Default hover state should have first item from input node highlighted
ndv.getters.outputHoveringItem().should('not.exist'); ndvComposables.resetHoverState();
ndvComposables.verifyInputHoverState('1111');
ndv.getters.parameterExpressionPreview('value').should('include.text', '1111'); ndv.getters.parameterExpressionPreview('value').should('include.text', '1111');
// Select different input node and check that the hover state is updated
ndv.actions.selectInputNode('Set1'); ndv.actions.selectInputNode('Set1');
ndv.getters.backToCanvas().realMouseMove(10, 1); // reset to default hover ndvComposables.verifyInputHoverState('1000');
ndv.getters.inputTableRow(1).should('have.text', '1000');
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.actions.dragMainPanelToRight(); ndv.actions.dragMainPanelToRight();
ndv.getters.inputTbodyCell(1, 0).realMouseMove(10, 1);
ndv.getters.outputHoveringItem().should('have.text', '1000'); ndvComposables.resetHoverState();
ndv.getters.parameterExpressionPreview('value').should('include.text', '1000'); ndvComposables.verifyOutputHoverState('1000');
// BUG(ADO-3469): Expression preview is not updated when input node is changed it uses the old value
// ndv.getters.parameterExpressionPreview('value').should('include.text', '1000');
ndv.actions.selectInputNode('Sort'); ndv.actions.selectInputNode('Sort');
ndv.actions.dragMainPanelToLeft(); ndv.actions.dragMainPanelToLeft();
ndv.actions.changeOutputRunSelector('1 of 2 (6 items)'); ndv.actions.changeOutputRunSelector('1 of 2 (6 items)');
ndv.getters.backToCanvas().realMouseMove(10, 1); // reset to default hover
ndv.getters.inputTableRow(1).should('have.text', '1111'); ndvComposables.resetHoverState();
ndvComposables.verifyInputHoverState('1111');
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.actions.dragMainPanelToRight(); ndv.actions.dragMainPanelToRight();
ndv.getters.inputTbodyCell(1, 0).realMouseMove(10, 1);
ndv.getters.outputHoveringItem().should('have.text', '1111'); ndvComposables.resetHoverState();
ndvComposables.verifyOutputHoverState('1111');
ndv.getters.parameterExpressionPreview('value').should('include.text', '1111'); ndv.getters.parameterExpressionPreview('value').should('include.text', '1111');
}); });