audio.cy.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { AudioView, LabelStudio } from "@humansignal/frontend-test/helpers/LSF";
  2. describe("Audio", () => {
  3. it("Renders audio with merged channels by default", () => {
  4. LabelStudio.params()
  5. .config(
  6. `
  7. <View>
  8. <Audio name="audio" value="$audio" />
  9. </View>
  10. `,
  11. )
  12. .data({
  13. audio: "/public/files/barradeen-emotional.mp3",
  14. })
  15. .withResult([])
  16. .init();
  17. LabelStudio.waitForObjectsReady();
  18. AudioView.isReady();
  19. AudioView.toMatchImageSnapshot(AudioView.drawingArea, { threshold: 0.4 });
  20. });
  21. it("Renders separate audio channels with splitchannels=true", () => {
  22. LabelStudio.params()
  23. .config(
  24. `
  25. <View>
  26. <Audio name="audio" value="$audio" splitchannels="true" />
  27. </View>
  28. `,
  29. )
  30. .data({
  31. audio: "/public/files/barradeen-emotional.mp3",
  32. })
  33. .withResult([])
  34. .init();
  35. LabelStudio.waitForObjectsReady();
  36. AudioView.isReady();
  37. AudioView.toMatchImageSnapshot(AudioView.drawingArea, { threshold: 0.4 });
  38. });
  39. });