Copilot commented on code in PR #7435:
URL: https://github.com/apache/texera/pull/7435#discussion_r3743353873


##########
frontend/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.spec.ts:
##########
@@ -276,6 +276,228 @@ describe("DatasetDetailComponent upload queue", () => {
     });
   });
 
+  /**
+   * The explorer's toolbar and upload panel are template-only: whether a 
download is offered at all,
+   * which of the maximize/minimize pair is showing, and what an in-flight 
upload reports. The suite
+   * around this one drives component state and never asserts on what is 
rendered.
+   */
+  describe("rendered explorer", () => {
+    /**
+     * Applies some state and renders the "Versions & Files" tab. nz-tabs only 
instantiates the
+     * active tab, and the toolbar under test lives in the second one, so it 
has to be selected
+     * before anything in it exists to assert on.
+     */
+    function render(setup: (c: DatasetDetailComponent) => void = () => {}): 
HTMLElement {
+      setup(component);
+      fixture.detectChanges();
+      const host = fixture.nativeElement as HTMLElement;
+      const tabs = 
Array.from(host.querySelectorAll<HTMLElement>(".ant-tabs-tab"));
+      if (tabs.length > 1 && 
!tabs[1].classList.contains("ant-tabs-tab-active")) {
+        tabs[1].click();
+        fixture.detectChanges();
+      }

Review Comment:
   The `render()` helper selects the "Versions & Files" tab by index 
(`tabs[1]`) and clicks the `.ant-tabs-tab` container. This is brittle (tab 
order/structure changes will silently break the tests) and differs from the 
existing pattern in this spec that locates the tab by its label and clicks the 
`.ant-tabs-tab-btn`. Consider selecting the tab by text to make the tests 
resilient to future tab reordering.
   
   This issue also appears on line 411 of the same file.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to