Bin
2025-12-16 9e0b2ba2c317b1a86212f24cbae3195ad1f3dbfa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
import { LabelStudio, AudioView, VideoView, Paragraphs } from "@humansignal/frontend-test/helpers/LSF";
import { useSyncGroup } from "@humansignal/frontend-test/helpers/utils/media/SyncGroup";
import { Network } from "@humansignal/frontend-test/helpers/utils/Network";
import {
  videoAudioParagraphsConfig,
  videoAudioParagraphsData,
  videoAudioParagraphsAnnotations,
} from "../../../data/sync/video-audio-paragraphs";
import { TWO_FRAMES_TIMEOUT } from "../../utils/constants";
 
const suiteConfig = {
  retries: {
    runMode: 2,
    openMode: 0,
  },
  defaultCommandTimeout: 30000,
};
 
describe("Sync Buffering: Seek Buffering Tests", suiteConfig, () => {
  beforeEach(() => {
    LabelStudio.addFeatureFlagsOnPageLoad({
      fflag_fix_front_fit_31_synced_media_buffering: true,
      fflag_feat_front_lsdv_e_278_contextual_scrolling_short: true,
    });
    Network.disableBrowserCache();
    cy.reload(true);
    cy.on("uncaught:exception", () => false);
  });
 
  afterEach(() => {
    Network.clearAllThrottles();
    Network.enableBrowserCache();
  });
 
  describe("Video + Audio + Paragraphs Seek Buffering", () => {
    const SyncGroup = useSyncGroup([AudioView, VideoView, Paragraphs]);
 
    it("should handle seek buffering from audio timeline", () => {
      LabelStudio.params()
        .config(videoAudioParagraphsConfig)
        .data(videoAudioParagraphsData)
        .withResult(videoAudioParagraphsAnnotations)
        .init();
 
      LabelStudio.waitForObjectsReady();
      AudioView.isReady();
      Paragraphs.mediaElement.should("exist");
 
      // Setup network delay
      const delayedNetwork = Network.createControlledDelay("/public/files/opossum_intro.webm", "seekBuffering");
 
      // Perform seek operation
      cy.log("Performing seek operation with slow network");
      AudioView.clickAtRelative(0.3, 0.5);
      cy.wait(TWO_FRAMES_TIMEOUT);
      // Start playback
      AudioView.playButton.click();
 
      cy.log("Verifying buffering appears");
      AudioView.hasBuffering();
      VideoView.hasBuffering();
      Paragraphs.hasBuffering();
 
      cy.log("Verifyin media is paused during buffering");
      AudioView.hasMediaPaused();
      VideoView.hasMediaPaused();
      Paragraphs.hasMediaPaused();
 
      AudioView.hasBuffering();
 
      // Release network delay
      cy.log("Releasing network delay to simulate recovery");
      delayedNetwork.releaseRequest();
 
      // Wait for buffering to complete
      AudioView.hasNoBuffering();
      VideoView.hasNoBuffering();
      Paragraphs.hasNoBuffering();
 
      // Verify both audio elements are synchronized
      SyncGroup.checkSynchronization();
 
      // Verify playback resumes
      AudioView.hasMediaPlaying();
      VideoView.hasMediaPlaying();
      Paragraphs.hasMediaPlaying();
    });
 
    it.skip("should handle seek buffering from video timeline", () => {
      LabelStudio.params()
        .config(videoAudioParagraphsConfig)
        .data(videoAudioParagraphsData)
        .withResult(videoAudioParagraphsAnnotations)
        .init();
 
      LabelStudio.waitForObjectsReady();
      AudioView.isReady();
 
      // Setup network delay
      const delayedNetwork = Network.createControlledDelay("/public/files/opossum_intro.webm", "audioSeek");
 
      // Perform seek operation
      cy.log("Performing seek operation with slow network");
      VideoView.clickAtTimelineRelative(0.3);
 
      VideoView.playButton.click();
 
      AudioView.hasBuffering();
      VideoView.hasBuffering();
      Paragraphs.hasBuffering();
 
      AudioView.hasMediaPaused();
      VideoView.hasMediaPaused();
      Paragraphs.hasMediaPaused();
 
      AudioView.hasBuffering();
 
      // Release network delay
      cy.log("Releasing network delay to simulate recovery");
      delayedNetwork.releaseRequest();
 
      // Wait for buffering to complete
      AudioView.hasNoBuffering();
      VideoView.hasNoBuffering();
      Paragraphs.hasNoBuffering();
 
      // Verify both audio elements are synchronized
      SyncGroup.checkSynchronization();
 
      // Verify playback resumes
      AudioView.hasMediaPlaying();
      VideoView.hasMediaPlaying();
      Paragraphs.hasMediaPlaying();
    });
  });
 
  describe("Button State Consistency During Seek Buffering", () => {
    const SyncGroup = useSyncGroup([AudioView, VideoView, Paragraphs]);
 
    it("should maintain consistent button states across all media controls during buffering", () => {
      LabelStudio.params()
        .config(videoAudioParagraphsConfig)
        .data(videoAudioParagraphsData)
        .withResult(videoAudioParagraphsAnnotations)
        .init();
 
      LabelStudio.waitForObjectsReady();
      AudioView.isReady();
 
      // Setup network delay
      const delayedNetwork = Network.createControlledDelay("/public/files/opossum_intro.webm", "buttonStateSeek");
 
      // Perform seek during playback
      AudioView.clickAtRelative(0.5);
      // Start playback first
      AudioView.playButton.click();
 
      AudioView.hasBuffering();
      VideoView.hasBuffering();
      Paragraphs.hasBuffering();
 
      AudioView.pauseButton.should("exist");
      VideoView.pauseButton.should("exist");
 
      // Release network
      delayedNetwork.releaseRequest();
 
      AudioView.pauseButton.should("exist");
      VideoView.pauseButton.should("exist");
 
      SyncGroup.checkSynchronization();
    });
  });
});