node-red-contrib-event-calc 2.0.3 → 3.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -2
- package/examples/change-detection-example.json +448 -0
- package/nodes/event-cache.js +18 -2
- package/nodes/event-calc.js +70 -10
- package/nodes/event-flatten.html +53 -0
- package/nodes/event-flatten.js +25 -0
- package/nodes/event-preview.html +264 -0
- package/nodes/event-preview.js +125 -0
- package/nodes/event-simulator.js +1 -1
- package/package.json +3 -2
- package/nodes/event-json.html +0 -64
- package/nodes/event-json.js +0 -69
- package/playwright.config.js +0 -22
- package/tests/external-trigger.spec.js +0 -141
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
const { test, expect } = require('@playwright/test');
|
|
3
|
-
|
|
4
|
-
test.describe('Event Calc - External Trigger Feature', () => {
|
|
5
|
-
test.beforeEach(async ({ page }) => {
|
|
6
|
-
// Navigate to Node-RED editor
|
|
7
|
-
await page.goto('/');
|
|
8
|
-
// Wait for Node-RED to load
|
|
9
|
-
await page.waitForSelector('#red-ui-palette', { timeout: 30000 });
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
test('should show External Trigger checkbox in event-calc node configuration', async ({ page }) => {
|
|
13
|
-
// Search for the event-calc node in the palette
|
|
14
|
-
const paletteSearch = page.locator('#red-ui-palette-search input');
|
|
15
|
-
await paletteSearch.fill('event calc');
|
|
16
|
-
|
|
17
|
-
// Wait for search results
|
|
18
|
-
await page.waitForTimeout(500);
|
|
19
|
-
|
|
20
|
-
// Find the event-calc node in the palette
|
|
21
|
-
const eventCalcNode = page.locator('.red-ui-palette-node[data-palette-type="event-calc"]');
|
|
22
|
-
await expect(eventCalcNode).toBeVisible();
|
|
23
|
-
|
|
24
|
-
// Drag the node to the workspace
|
|
25
|
-
const workspace = page.locator('#red-ui-workspace-chart');
|
|
26
|
-
await eventCalcNode.dragTo(workspace);
|
|
27
|
-
|
|
28
|
-
// Double-click on the newly created node to open the editor
|
|
29
|
-
// First find the node in the workspace
|
|
30
|
-
const nodeInWorkspace = page.locator('.red-ui-flow-node-group').last();
|
|
31
|
-
await nodeInWorkspace.dblclick();
|
|
32
|
-
|
|
33
|
-
// Wait for the edit dialog to open
|
|
34
|
-
await page.waitForSelector('.red-ui-editor', { timeout: 5000 });
|
|
35
|
-
|
|
36
|
-
// Verify the External Trigger checkbox exists
|
|
37
|
-
const externalTriggerCheckbox = page.locator('#node-input-externalTrigger');
|
|
38
|
-
await expect(externalTriggerCheckbox).toBeVisible();
|
|
39
|
-
|
|
40
|
-
// Verify it's unchecked by default
|
|
41
|
-
await expect(externalTriggerCheckbox).not.toBeChecked();
|
|
42
|
-
|
|
43
|
-
// Check the checkbox
|
|
44
|
-
await externalTriggerCheckbox.check();
|
|
45
|
-
await expect(externalTriggerCheckbox).toBeChecked();
|
|
46
|
-
|
|
47
|
-
// Verify the label is correct
|
|
48
|
-
const label = page.locator('label[for="node-input-externalTrigger"]');
|
|
49
|
-
await expect(label).toContainText('External Trigger');
|
|
50
|
-
await expect(label).toContainText('calculate on any input message');
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
test('should toggle External Trigger checkbox', async ({ page }) => {
|
|
54
|
-
// Search for the event-calc node
|
|
55
|
-
const paletteSearch = page.locator('#red-ui-palette-search input');
|
|
56
|
-
await paletteSearch.fill('event calc');
|
|
57
|
-
await page.waitForTimeout(500);
|
|
58
|
-
|
|
59
|
-
// Find and drag the node
|
|
60
|
-
const eventCalcNode = page.locator('.red-ui-palette-node[data-palette-type="event-calc"]');
|
|
61
|
-
const workspace = page.locator('#red-ui-workspace-chart');
|
|
62
|
-
await eventCalcNode.dragTo(workspace);
|
|
63
|
-
|
|
64
|
-
// Open the node editor
|
|
65
|
-
const nodeInWorkspace = page.locator('.red-ui-flow-node-group').last();
|
|
66
|
-
await nodeInWorkspace.dblclick();
|
|
67
|
-
await page.waitForSelector('.red-ui-editor', { timeout: 5000 });
|
|
68
|
-
|
|
69
|
-
const externalTriggerCheckbox = page.locator('#node-input-externalTrigger');
|
|
70
|
-
|
|
71
|
-
// Toggle on
|
|
72
|
-
await externalTriggerCheckbox.check();
|
|
73
|
-
await expect(externalTriggerCheckbox).toBeChecked();
|
|
74
|
-
|
|
75
|
-
// Toggle off
|
|
76
|
-
await externalTriggerCheckbox.uncheck();
|
|
77
|
-
await expect(externalTriggerCheckbox).not.toBeChecked();
|
|
78
|
-
|
|
79
|
-
// Toggle on again
|
|
80
|
-
await externalTriggerCheckbox.check();
|
|
81
|
-
await expect(externalTriggerCheckbox).toBeChecked();
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
test('should persist External Trigger setting after save', async ({ page }) => {
|
|
85
|
-
// Search for event-cache node first (required config)
|
|
86
|
-
const paletteSearch = page.locator('#red-ui-palette-search input');
|
|
87
|
-
await paletteSearch.fill('event cache');
|
|
88
|
-
await page.waitForTimeout(500);
|
|
89
|
-
|
|
90
|
-
// Add event-cache config node if needed
|
|
91
|
-
const eventCacheNode = page.locator('.red-ui-palette-node[data-palette-type="event-cache"]');
|
|
92
|
-
if (await eventCacheNode.isVisible()) {
|
|
93
|
-
const workspace = page.locator('#red-ui-workspace-chart');
|
|
94
|
-
await eventCacheNode.dragTo(workspace);
|
|
95
|
-
|
|
96
|
-
// Configure the cache node
|
|
97
|
-
const cacheNodeInWorkspace = page.locator('.red-ui-flow-node-group').last();
|
|
98
|
-
await cacheNodeInWorkspace.dblclick();
|
|
99
|
-
await page.waitForSelector('.red-ui-editor', { timeout: 5000 });
|
|
100
|
-
|
|
101
|
-
// Set a name for the cache
|
|
102
|
-
const nameInput = page.locator('#node-input-name');
|
|
103
|
-
await nameInput.fill('Test Cache');
|
|
104
|
-
|
|
105
|
-
// Save the cache node
|
|
106
|
-
const doneButton = page.locator('.red-ui-tray-footer button').filter({ hasText: 'Done' });
|
|
107
|
-
await doneButton.click();
|
|
108
|
-
await page.waitForTimeout(500);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Now add the event-calc node
|
|
112
|
-
await paletteSearch.clear();
|
|
113
|
-
await paletteSearch.fill('event calc');
|
|
114
|
-
await page.waitForTimeout(500);
|
|
115
|
-
|
|
116
|
-
const eventCalcNode = page.locator('.red-ui-palette-node[data-palette-type="event-calc"]');
|
|
117
|
-
const workspace = page.locator('#red-ui-workspace-chart');
|
|
118
|
-
await eventCalcNode.dragTo(workspace);
|
|
119
|
-
|
|
120
|
-
// Open the node editor
|
|
121
|
-
const calcNodeInWorkspace = page.locator('.red-ui-flow-node-group').last();
|
|
122
|
-
await calcNodeInWorkspace.dblclick();
|
|
123
|
-
await page.waitForSelector('.red-ui-editor', { timeout: 5000 });
|
|
124
|
-
|
|
125
|
-
// Check the External Trigger checkbox
|
|
126
|
-
const externalTriggerCheckbox = page.locator('#node-input-externalTrigger');
|
|
127
|
-
await externalTriggerCheckbox.check();
|
|
128
|
-
|
|
129
|
-
// Save the node configuration
|
|
130
|
-
const doneButton = page.locator('.red-ui-tray-footer button').filter({ hasText: 'Done' });
|
|
131
|
-
await doneButton.click();
|
|
132
|
-
await page.waitForTimeout(500);
|
|
133
|
-
|
|
134
|
-
// Reopen the node editor
|
|
135
|
-
await calcNodeInWorkspace.dblclick();
|
|
136
|
-
await page.waitForSelector('.red-ui-editor', { timeout: 5000 });
|
|
137
|
-
|
|
138
|
-
// Verify the checkbox is still checked
|
|
139
|
-
await expect(externalTriggerCheckbox).toBeChecked();
|
|
140
|
-
});
|
|
141
|
-
});
|