Skip to content

Commit

Permalink
fix(editor): Fix workflow execution list scrolling after filter change (
Browse files Browse the repository at this point in the history
  • Loading branch information
cstuncsik authored and despairblue committed Jul 31, 2024
1 parent 70aa8fd commit c2e37cb
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
44 changes: 44 additions & 0 deletions cypress/e2e/20-workflow-executions.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,50 @@ describe('Current Workflow Executions', () => {
.invoke('attr', 'title')
.should('eq', newWorkflowName);
});

it('should load items and auto scroll after filter change', () => {
createMockExecutions();
createMockExecutions();
cy.intercept('GET', '/rest/executions?filter=*').as('getExecutions');

executionsTab.actions.switchToExecutionsTab();

cy.wait(['@getExecutions']);

executionsTab.getters.executionsList().scrollTo(0, 500).wait(0);

executionsTab.getters.executionListItems().eq(10).click();

cy.getByTestId('executions-filter-button').click();
cy.getByTestId('executions-filter-status-select').should('be.visible').click();
getVisibleSelect().find('li:contains("Error")').click();

executionsTab.getters.executionListItems().should('have.length', 5);
executionsTab.getters.successfulExecutionListItems().should('have.length', 1);
executionsTab.getters.failedExecutionListItems().should('have.length', 4);

cy.getByTestId('executions-filter-button').click();
cy.getByTestId('executions-filter-status-select').should('be.visible').click();
getVisibleSelect().find('li:contains("Success")').click();

// check if the list is scrolled
executionsTab.getters.executionListItems().eq(10).should('be.visible');
executionsTab.getters.executionsList().then(($el) => {
const { scrollTop, scrollHeight, clientHeight } = $el[0];
expect(scrollTop).to.be.greaterThan(0);
expect(scrollTop + clientHeight).to.be.lessThan(scrollHeight);

// scroll to the bottom
$el[0].scrollTo(0, scrollHeight);
executionsTab.getters.executionListItems().should('have.length', 18);
executionsTab.getters.successfulExecutionListItems().should('have.length', 18);
executionsTab.getters.failedExecutionListItems().should('have.length', 0);
});

cy.getByTestId('executions-filter-button').click();
cy.getByTestId('executions-filter-reset-button').should('be.visible').click();
executionsTab.getters.executionListItems().eq(11).should('be.visible');
});
});

const createMockExecutions = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ export default defineComponent({
this.$emit('refresh');
},
onFilterChanged(filter: ExecutionFilterType) {
this.autoScrollDeps.activeExecutionSet = false;
this.autoScrollDeps.scroll = true;
this.mountedItems = [];
this.$emit('filterUpdated', filter);
},
reloadExecutions(): void {
Expand Down

0 comments on commit c2e37cb

Please sign in to comment.