-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path01-midi-connection-display.cy.ts
More file actions
90 lines (73 loc) · 3.31 KB
/
Copy path01-midi-connection-display.cy.ts
File metadata and controls
90 lines (73 loc) · 3.31 KB
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
/// <reference types="cypress" />
describe("MIDI Connection and Basic Display", () => {
const DELUGE_MIDI_PORT_NAME = "Deluge Port 1"; // As per user update
beforeEach(() => {
// Visit the application. MIDI access should be available based on browser/environment config.
cy.visit("/");
cy.clearLocalStorage();
});
it("1. Initial Load and MIDI Device Selection: handles initial load and MIDI device visibility", () => {
cy.getBySel("midi-input-select").should("be.visible");
cy.getBySel("midi-output-select").should("be.visible");
});
it("2. Manual MIDI Device Selection: allows manual selection and indicates connection", () => {
// Attempt to select the Deluge ports.
// This will fail if the device is not present or named differently.
cy.getBySel("midi-input-select").select(DELUGE_MIDI_PORT_NAME);
cy.getBySel("midi-output-select").select(DELUGE_MIDI_PORT_NAME);
// Check for visual indication of successful connection in DEx's UI
// The exact data-testid and text will depend on the application's implementation.
cy.wait(1000);
cy.getBySel("main-display").toMatchImageSnapshot({
imageConfig: {
threshold: 0.001,
},
});
// Test plan: "The 'Auto (Connect + Display)' checkbox should reflect the connection status..."
cy.getBySel("auto-connect-toggle").should("be.checked"); // or other appropriate assertion
});
it("3. Auto-Connect Functionality: auto-connects on refresh if enabled", () => {
// First, ensure "Auto-connect toggle" is checked.
// cy.getBySel("auto-connect-toggle").check();
// Manually connect once to allow the app to "remember" the choice for auto-connect.
cy.getBySel("midi-input-select").select(DELUGE_MIDI_PORT_NAME);
cy.getBySel("midi-output-select").select(DELUGE_MIDI_PORT_NAME);
// Wait for connection to establish and be potentially saved by the app
cy.reload(); // Refresh the page
// After reload, DEx should attempt to auto-connect to the "remembered" device.
// Wait for MIDI selects to be visible again after reload
cy.getBySel("midi-input-select").should("be.visible");
cy.getBySel("midi-output-select").should("be.visible");
cy.wait(1000);
cy.getBySel("main-display").toMatchImageSnapshot({
imageConfig: {
threshold: 0.001,
},
});
});
it("4. OLED Display Mirroring: mirrors OLED display changes", () => {
// Connect to MIDI devices
cy.getBySel("midi-input-select").select(DELUGE_MIDI_PORT_NAME);
cy.getBySel("midi-output-select").select(DELUGE_MIDI_PORT_NAME);
// Ensure "Toggle display type" is set to "OLED"
cy.getBySel("display-type-switch").click(); // Assuming specific element for OLED
cy.wait(1000);
cy.getBySel("main-display").toMatchImageSnapshot({
imageConfig: {
threshold: 0.001,
},
});
});
it("5. 7-Segment Display Mirroring: mirrors 7-segment display changes", () => {
cy.getBySel("midi-input-select").select(DELUGE_MIDI_PORT_NAME);
cy.getBySel("midi-output-select").select(DELUGE_MIDI_PORT_NAME);
// Set "Toggle display type" to "7SEG"
cy.getBySel("display-type-switch").click(); // Assuming specific element for 7SEG
cy.wait(1000);
cy.getBySel("main-display").toMatchImageSnapshot({
imageConfig: {
threshold: 0.001,
},
});
});
});