apache / apache/texera

Agent panel tab-selection test fails intermittently in CI

Open
#7,755 1 comment 0 reactions 1 assignee Claimed by @aglinxinyuan View on GitHub
Dominant language
Scala
Stars
314
Forks
187
Avg merge
1d 21h
Merged PRs (30d)
214

Description

### Describe the bug

`agent-panel.component.spec.ts`'s tab-selection test fails intermittently in CI:

```
FAIL gui src/app/workspace/component/agent/agent-panel/agent-panel.component.spec.ts
> AgentPanelComponent > rendered template
> clicking an agent's tab header activates that agent and marks only its chat active
AssertionError: expected "vi.fn()" to be called with arguments: [ 'b' ]
Number of calls: 0
```

It has failed on both `ubuntu-latest` and `windows-latest` runners while passing locally, including a clean local run of the full 201-file suite. It is currently red on unrelated PRs, so it blocks anything touching the frontend.

The cause is a timing dependency rather than a regression: the test clicks the tab header and then calls `fixture.detectChanges()` once, but `nz-tabs` does not emit `nzSelectedIndexChange` from its click handler — it emits during its own change-detection pass. A single `detectChanges()` is therefore not guaranteed to have run `onTabSelectChange`, so `activateAgent` may not have been called yet.

Note that `fixture.whenStable()` is not a usable remedy: the panel keeps a long-lived subscription open, so awaiting stability hangs the test until its 20s timeout.

### How to reproduce?

Re-run the frontend unit-test job on any PR touching the frontend; it fails intermittently. Locally the whole suite passes, which is why this needs fixing at the test rather than by re-running CI.

### Version/Branch

main

### Task Type

- [ ] Refactor / Cleanup
- [ ] DevOps / Deployment / CI
- [x] Testing / QA
- [ ] Documentation
- [ ] Performance
- [ ] Other

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.