This is an automated email from the ASF dual-hosted git repository. github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-8465-53052c482b974b2f8f6a377231fd57af2f5de3d7 in repository https://gitbox.apache.org/repos/asf/texera.git
commit 93e2982a7405c7adf5b832d2c18a2d3a0b28dacf Author: Xinyuan Lin <[email protected]> AuthorDate: Fri Sep 25 04:10:56 2026 +0000 chore(frontend): remove two commented-out test blocks from the workflow editor spec (#8465) ### What changes were proposed in this PR? Deletes two large commented-out test blocks from `workflow-editor.component.spec.ts`. Neither can be re-enabled as written, and both have live replacement coverage. Pure deletion, no behaviour change: **−225 lines**. ### History | | | | --- | --- | | **Block 708-822** (copy/cut/paste) | Commented out when written, by #1619 (2022-09-13, "Copy and Paste Operators with System Clipboard") — its header says the new clipboard path "would not pass this unit test, since write access to the system clipboard is needed". **Superseded**: the live `describe("clipboard")` block in this same file covers all three cases (copy, cut, paste), and the paste-offset property is covered in `operator-menu.service.spec.ts` against the real `findNonOverlappingPosition` logic | | **Block 531-638** (`xdescribe("when executionStatus is enabled")`) | Commented out on 2020-08-01 (`a9c404764a`) — about six years. **Cannot be revived**: it spies on `changeOperatorStates` / `OperatorStates` (plural) while the live code has `changeOperatorState` / `OperatorState` (singular), and it calls `TestBed.get`, an API Angular has since removed | Neither block is executable: re-parsing the file with the repo's own TypeScript finds zero live tokens in either range, so neither registers with Vitest and neither can appear in `junit.xml` or any skipped-test count. > Reviewer note: the ranges were deleted **bottom-up** (708-823 first, then 531-639), each including its one trailing blank line. Line 707 and line 530 are already blank, so deleting only the comment ranges would leave doubled blank lines and fail `yarn format:ci` — confirmed empirically with `prettier --check` on both variants. The live `describe("clipboard")` block and the standing note about clipboard cases needing a real browser are kept. ### Any related issues, documentation, discussions? Closes #8461 ### How was this PR tested? Existing tests only — this PR removes commented text that runs nothing. From `frontend/`: - `npx ng test --watch=false --include='**/workflow-editor.component.spec.ts'` — 106 tests pass, unchanged from before. - `yarn --cwd frontend format:ci` — clean (this is the gate the blank-line handling protects). Verification, re-runnable by a reviewer: ``` grep -c "xdescribe\|the new method of copying" frontend/src/app/workspace/component/workflow-editor/workflow-editor.component.spec.ts # 0 ``` ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 5) --- .../workflow-editor.component.spec.ts | 225 --------------------- 1 file changed, 225 deletions(-) diff --git a/frontend/src/app/workspace/component/workflow-editor/workflow-editor.component.spec.ts b/frontend/src/app/workspace/component/workflow-editor/workflow-editor.component.spec.ts index 02688a3116..3b419e683a 100644 --- a/frontend/src/app/workspace/component/workflow-editor/workflow-editor.component.spec.ts +++ b/frontend/src/app/workspace/component/workflow-editor/workflow-editor.component.spec.ts @@ -691,115 +691,6 @@ describe("WorkflowEditorComponent", () => { }) ); - // // TODO: this test case related to websocket is not stable, find out why and fix it - // xdescribe('when executionStatus is enabled', () => { - // beforeAll(() => { - // environment.executionStatusEnabled = true; - // workflowStatusService = TestBed.get(WorkflowStatusService); - // }); - - // afterAll(() => { - // environment.executionStatusEnabled = false; - // }); - - // it('should display/hide operator status tooltip when cursor hovers/leaves an operator', () => { - // // install a spy on the highlight operator function and pass the call through - // const showTooltipFunctionSpy = vi.spyOn(jointUIService, 'showOperatorStatusToolTip'); - // const hideTooltipFunctionSpy = vi.spyOn(jointUIService, 'hideOperatorStatusToolTip'); - - // workflowActionService.addOperator(mockScanPredicate, mockPoint); - // // find the joint Cell View object of the operator element - // const jointCellView = component.getJointPaper().findViewByModel(mockScanPredicate.operatorID); - // const tooltipView = component.getJointPaper().findViewByModel( - // JointUIService.getOperatorStatusTooltipElementID(mockScanPredicate.operatorID)); - - // // workflow has not started yet - // // trigger a mouseenter on the cell view using its jQuery element - // jointCellView.$el.trigger('mouseenter'); - // fixture.detectChanges(); - // // assert the function is not called yet - // expect(showTooltipFunctionSpy).not.toHaveBeenCalled(); - // expect(tooltipView.model.attr('polygon')['display']).toBe('none'); - - // // mock start the workflow - // component['operatorStatusTooltipDisplayEnabled'] = true; - // // trigger event mouse enter - // jointCellView.$el.trigger('mouseenter'); - // fixture.detectChanges(); - // // assert the function is called - // expect(showTooltipFunctionSpy).toHaveBeenCalled(); - // expect(tooltipView.model.attr('polygon')['display']).toBeUndefined(); - - // // trigger event mouse leave - // jointCellView.$el.trigger('mouseleave'); - // // assert the function is called - // expect(hideTooltipFunctionSpy).toHaveBeenCalled(); - // expect(tooltipView.model.attr('polygon')['display']).toBe('none'); - // }); - - // it('should update operator status tooltip content when workflow-status.service emits processState', () => { - // // spy on key function, create simple workflow - // const changeOperatorTooltipInfoSpy = vi.spyOn(jointUIService, 'changeOperatorStatusTooltipInfo'); - // workflowActionService.addOperator(mockScanPredicateForStatus, mockPoint); - // const tooltipView = component.getJointPaper().findViewByModel( - // JointUIService.getOperatorStatusTooltipElementID(mockScanPredicateForStatus.operatorID)); - - // // workflowStatusService emits a mock status - // workflowStatusService['status'].next(mockStatus1 as ProcessStatus); - // fixture.detectChanges(); - // // function should be called and content should be updated properly - // expect(component['operatorStatusTooltipDisplayEnabled']).toBeTruthy(); - // expect(changeOperatorTooltipInfoSpy).toHaveBeenCalledTimes(1); - // expect(tooltipView.model.attr('#operatorCount/text')) - // .toBe('Output:' + (mockStatus1 as ProcessStatus).operatorStatistics[mockScanOperatorID].outputCount + ' tuples'); - // expect(tooltipView.model.attr('#operatorSpeed/text')) - // .toBe('Speed:' + (mockStatus1 as ProcessStatus).operatorStatistics[mockScanOperatorID].speed + ' tuples/ms'); - - // // workflowStatusService emits another mock status - // workflowStatusService['status'].next(mockStatus2 as ProcessStatus); - // fixture.detectChanges(); - // // function should be called again and content should be updated properly - // expect(changeOperatorTooltipInfoSpy).toHaveBeenCalledTimes(2); - // expect(tooltipView.model.attr('#operatorCount/text')) - // .toBe('Output:' + (mockStatus2 as ProcessStatus).operatorStatistics[mockScanOperatorID].outputCount + ' tuples'); - // expect(tooltipView.model.attr('#operatorSpeed/text')) - // .toBe('Speed:' + (mockStatus2 as ProcessStatus).operatorStatistics[mockScanOperatorID].speed + ' tuples/ms'); - // }); - - // it('should change operator state when workflow-status.service emits processState', () => { - // // spy on key function, create simple workflow - // const changeOperatorStatesSpy = vi.spyOn(jointUIService, 'changeOperatorStates'); - // workflowActionService.addOperator(mockScanPredicateForStatus, mockPoint); - // const jointCellView = component.getJointPaper().findViewByModel(mockScanPredicateForStatus.operatorID); - - // // workflowStatusService emits a mock status - // workflowStatusService['status'].next(mockStatus1 as ProcessStatus); - // fixture.detectChanges(); - // // function should be called and state name should be updated properly - // expect(changeOperatorStatesSpy).toHaveBeenCalledTimes(1); - // expect(jointCellView.model.attr('#operatorStates')['text']) - // .toEqual(OperatorStates[(mockStatus1 as ProcessStatus).operatorStates[mockScanOperatorID]]); - - // // workflowStatusService emits another mock status - // workflowStatusService['status'].next(mockStatus2 as ProcessStatus); - // fixture.detectChanges(); - // // function should be called again and state name should be updated properly - // expect(changeOperatorStatesSpy).toHaveBeenCalledTimes(2); - // expect(jointCellView.model.attr('#operatorStates')['text']) - // .toEqual(OperatorStates[OperatorStates.Completed]); - // }); - - // it('should throw error when processState contains non-existing operatorID', () => { - // // workflowStatusService emits a processStatus with info for a scan operator - // // however there is no scan operator on the joinGraph/texeraGraph - // // an error should be thrown - // workflowStatusService['status'].next(mockStatus1 as ProcessStatus); - // fixture.detectChanges(); - // expect(component['handleOperatorStatisticsUpdate']).toThrowError(); - // expect(component['handleOperatorStatesChange']).toThrowError(); - // }); - // }); - it("should delete the highlighted operator when user presses the backspace key", () => { const texeraGraph = workflowActionService.getTexeraGraph(); const jointGraphWrapper = workflowActionService.getJointGraphWrapper(); @@ -868,122 +759,6 @@ describe("WorkflowEditorComponent", () => { expect(texeraGraph.hasOperator(mockResultPredicate.operatorID)).toBeFalsy(); }); - // the new method of copying and pasting would not pass this unit test, since the permisssion - // to write access to system clipboard is needed, and in the unit test, there is no way of turning - // on the permission as far as I am concerned - // it(`should create and highlight a new operator with the same metadata when user - // copies and pastes the highlighted operator`, () => { - // const jointGraphWrapper = workflowActionService.getJointGraphWrapper(); - // const texeraGraph = workflowActionService.getTexeraGraph(); - - // workflowActionService.addOperator(mockScanPredicate, mockPoint); - // jointGraphWrapper.highlightOperators(mockScanPredicate.operatorID); - - // // dispatch clipboard events for copy and paste - // const copyEvent = new ClipboardEvent("copy"); - - // (document.activeElement as HTMLElement)?.blur(); - // document.dispatchEvent(copyEvent); - // const pasteEvent = new ClipboardEvent("paste"); - - // (document.activeElement as HTMLElement)?.blur(); - // document.dispatchEvent(pasteEvent); - - // // the pasted operator should be highlighted - // const pastedOperatorID = jointGraphWrapper.getCurrentHighlightedOperatorIDs()[0]; - // expect(pastedOperatorID).toBeDefined(); - - // // get the pasted operator - // let pastedOperator = null; - // if (pastedOperatorID) { - // pastedOperator = texeraGraph.getOperator(pastedOperatorID); - // } - // expect(pastedOperator).toBeDefined(); - - // // two operators should have same metadata - // expect(pastedOperatorID).not.toEqual(mockScanPredicate.operatorID); - // if (pastedOperator) { - // expect(pastedOperator.operatorType).toEqual(mockScanPredicate.operatorType); - // expect(pastedOperator.operatorProperties).toEqual(mockScanPredicate.operatorProperties); - // expect(pastedOperator.inputPorts).toEqual(mockScanPredicate.inputPorts); - // expect(pastedOperator.outputPorts).toEqual(mockScanPredicate.outputPorts); - // expect(pastedOperator.showAdvanced).toEqual(mockScanPredicate.showAdvanced); - // } - // }); - - // the new method won't pass the unit test because as far as I am concerned, there's no way - // to grant the permission to the system clipboard in the Karma framework - // it(`should delete the highlighted operator, create and highlight a new operator with the same metadata - // when user cuts and pastes the highlighted operator`, () => { - // const jointGraphWrapper = workflowActionService.getJointGraphWrapper(); - // const texeraGraph = workflowActionService.getTexeraGraph(); - - // workflowActionService.addOperator(mockScanPredicate, mockPoint); - // jointGraphWrapper.highlightOperators(mockScanPredicate.operatorID); - - // // dispatch clipboard events for cut and paste - // const cutEvent = new ClipboardEvent("cut"); - - // (document.activeElement as HTMLElement)?.blur(); - // document.dispatchEvent(cutEvent); - // const pasteEvent = new ClipboardEvent("paste"); - - // (document.activeElement as HTMLElement)?.blur(); - // document.dispatchEvent(pasteEvent); - - // // the copied operator should be deleted - // expect(() => { - // texeraGraph.getOperator(mockScanPredicate.operatorID); - // }).toThrowError(new RegExp("does not exist")); - - // // the pasted operator should be highlighted - // const pastedOperatorID = jointGraphWrapper.getCurrentHighlightedOperatorIDs()[0]; - // expect(pastedOperatorID).toBeDefined(); - - // // get the pasted operator - // let pastedOperator = null; - // if (pastedOperatorID) { - // pastedOperator = texeraGraph.getOperator(pastedOperatorID); - // } - // expect(pastedOperator).toBeDefined(); - - // // two operators should have same metadata - // expect(pastedOperatorID).not.toEqual(mockScanPredicate.operatorID); - // if (pastedOperator) { - // expect(pastedOperator.operatorType).toEqual(mockScanPredicate.operatorType); - // expect(pastedOperator.operatorProperties).toEqual(mockScanPredicate.operatorProperties); - // expect(pastedOperator.inputPorts).toEqual(mockScanPredicate.inputPorts); - // expect(pastedOperator.outputPorts).toEqual(mockScanPredicate.outputPorts); - // expect(pastedOperator.showAdvanced).toEqual(mockScanPredicate.showAdvanced); - // } - // }); - - // TODO: this test is unstable, find out why and fix it - // same reason as above: can't grant clipboard access when pasting during unit-testing - // it("should place the pasted operator in a non-overlapping position", () => { - // const jointGraphWrapper = workflowActionService.getJointGraphWrapper(); - - // workflowActionService.addOperator(mockScanPredicate, mockPoint); - // jointGraphWrapper.highlightOperators(mockScanPredicate.operatorID); - - // // dispatch clipboard events for copy and paste - // const copyEvent = new ClipboardEvent("copy"); - - // (document.activeElement as HTMLElement)?.blur(); - // document.dispatchEvent(copyEvent); - // const pasteEvent = new ClipboardEvent("paste"); - - // (document.activeElement as HTMLElement)?.blur(); - // document.dispatchEvent(pasteEvent); - // fixture.detectChanges(); - // // get the pasted operator - // const pastedOperatorID = jointGraphWrapper.getCurrentHighlightedOperatorIDs()[0]; - // if (pastedOperatorID) { - // const pastedOperatorPosition = jointGraphWrapper.getElementPosition(pastedOperatorID); - // expect(pastedOperatorPosition).not.toEqual(mockPoint); - // } - // }); - it("should highlight all operators when user presses command + A", () => { const jointGraphWrapper = workflowActionService.getJointGraphWrapper();
