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
Feature("Audio Controls");
 
const config = `
<View>
  <Header value="Select regions:"></Header>
  <Labels name="label" toName="audio" choice="multiple">
    <Label value="Beat" background="yellow"></Label>
    <Label value="Voice" background="red"></Label>
    <Label value="Guitar" background="blue"></Label>
    <Label value="Other"></Label>
  </Labels>
  <Header value="Select genre:"></Header>
  <Choices name="choice" toName="audio" choice="multiple">
    <Choice value="Lo-Fi" />
    <Choice value="Rock" />
    <Choice value="Pop" />
  </Choices>
  <Header value="Listen the audio:"></Header>
  <Audio name="audio" value="$url"></Audio>
</View>
`;
 
const data = {
  url: "/public/files/barradeen-emotional.mp3",
};
 
const annotations = [
  {
    from_name: "choice",
    id: "hIj6zg57SY",
    to_name: "audio",
    type: "choices",
    origin: "manual",
    value: {
      choices: ["Lo-Fi"],
    },
  },
  {
    from_name: "label",
    id: "JhxupEJWlW",
    to_name: "audio",
    original_length: 98.719925,
    type: "labels",
    origin: "manual",
    value: {
      channel: 1,
      end: 59.39854733358493,
      labels: ["Other"],
      start: 55.747572792986325,
    },
  },
];
 
const params = { annotations: [{ id: "test", result: annotations }], config, data };
 
Scenario("Check the audio controls work", async ({ I, LabelStudio, AtAudioView, AtOutliner }) => {
  async function doNotSeeErrors() {
    await I.wait(2);
    // The potential errors should be caught by `errorsCollector` plugin
  }
 
  LabelStudio.setFeatureFlags({
    ff_front_dev_2715_audio_3_280722_short: true,
  });
  I.amOnPage("/");
 
  LabelStudio.init(params);
 
  await AtAudioView.waitForAudio();
  await AtAudioView.lookForStage();
 
  AtOutliner.seeRegions(1);
 
  I.say("Check the volume updates");
 
  await AtAudioView.seeVolume(100);
 
  AtAudioView.setVolumeInput(50);
 
  await AtAudioView.seeVolume(50);
 
  I.say("Check can be muted");
 
  AtAudioView.clickMuteButton();
 
  await AtAudioView.seeVolume(0);
 
  I.say("Check the playback speed updates");
 
  await AtAudioView.seePlaybackSpeed(1);
 
  AtAudioView.setPlaybackSpeedInput(2);
 
  await AtAudioView.seePlaybackSpeed(2);
 
  I.say("Check the amplitude updates");
 
  await AtAudioView.seeAmplitude(1);
 
  AtAudioView.setAmplitudeInput(2);
 
  await AtAudioView.seeAmplitude(2);
 
  I.say("Check can be played");
 
  await AtAudioView.seeIsPlaying(false);
 
  AtAudioView.clickPlayButton();
 
  await AtAudioView.seeIsPlaying(true);
 
  I.say("Check can be paused");
 
  AtAudioView.clickPauseButton();
 
  await AtAudioView.seeIsPlaying(false);
 
  I.say("Check the waveform can be zoomed without error");
 
  await AtAudioView.zoomToPoint(-120);
 
  await doNotSeeErrors();
});