Skip to content

Commit 4af80d0

Browse files
authored
Update dsp.test.js
1 parent fe591c4 commit 4af80d0

File tree

1 file changed

+27
-73
lines changed

1 file changed

+27
-73
lines changed

tests/e2e/dsp.test.js

Lines changed: 27 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -5,78 +5,32 @@ test('Launch Electron app, add clocking source, navigate to DSP block, configure
55
const app = await electron.launch({ args: ['main.js'] });
66
const window = await app.firstWindow();
77

8-
// Selecting the device (MPW1 Gemini)
9-
const deviceDropdown = await window.waitForSelector('#deviceId');
10-
await deviceDropdown.selectOption('MPW1');
11-
12-
// Selecting Clocking block
13-
const clockingBlockSelector = '#app > div > div.top-row-container > div.main-table-container.main-border > div.top-l2 > div.top-l2-col2 > div.top-l2-col2-elem > div > div:nth-child(2) > div:nth-child(1) > div';
14-
const clockingBlock = await window.waitForSelector(clockingBlockSelector);
15-
await clockingBlock.click();
16-
17-
// Clicking on Add button for Clocking
18-
const addButtonSelector = '#app > div > div.table-container.main-border > div > div.power-and-table-wrapper > div.table-wrapper > button';
19-
const addButton = await window.waitForSelector(addButtonSelector);
20-
await addButton.click();
21-
22-
// Ensure modal is visible before interacting
23-
const modalSelector = 'body > div:nth-child(3) > div > div.ant-modal-wrap > div';
24-
await window.waitForSelector(modalSelector, { state: 'visible' });
25-
26-
// Typing description as 'test'
27-
const descriptionSelector = 'body > div:nth-child(3) > div > div.ant-modal-wrap > div > div:nth-child(1) > div > div.ant-modal-body > div > form > div:nth-child(2) > input[type=text]';
28-
const descriptionInput = await window.waitForSelector(descriptionSelector);
29-
await descriptionInput.fill('test');
30-
31-
// Typing Port/Signal name as 'test'
32-
const portSignalSelector = 'body > div:nth-child(3) > div > div.ant-modal-wrap > div > div:nth-child(1) > div > div.ant-modal-body > div > form > div:nth-child(3) > input[type=text]';
33-
const portSignalInput = await window.waitForSelector(portSignalSelector);
34-
await portSignalInput.fill('test');
35-
36-
// Clicking OK to submit the clocking form
37-
const okButtonSelector = 'body > div:nth-child(3) > div > div.ant-modal-wrap > div > div:nth-child(1) > div > div.ant-modal-footer > button.ant-btn.css-dev-only-do-not-override-49qm.ant-btn-primary.ant-btn-color-primary.ant-btn-variant-solid > span';
38-
const okButton = await window.waitForSelector(okButtonSelector);
39-
await okButton.click();
40-
41-
// Navigate to the DSP block
42-
const dspBlockSelector = '#app > div > div.top-row-container > div.main-table-container.main-border > div.top-l2 > div.top-l2-col2 > div.top-l2-col2-elem > div > div:nth-child(3) > div:nth-child(2) > div';
43-
const dspBlock = await window.waitForSelector(dspBlockSelector);
44-
await dspBlock.click();
45-
46-
// Clicking on Add button for DSP
47-
const addDSPButton = await window.waitForSelector(addButtonSelector); // Reusing the same addButtonSelector
48-
await addDSPButton.click();
49-
50-
// Typing Name/Hierarchy as 'test'
51-
const nameHierarchySelector = 'body > div:nth-child(3) > div > div.ant-modal-wrap > div > div:nth-child(1) > div > div.ant-modal-body > div > form > div:nth-child(1) > input[type=text]';
52-
const nameHierarchyInput = await window.waitForSelector(nameHierarchySelector);
53-
await nameHierarchyInput.fill('test');
54-
55-
// Typing XX as 32
56-
const xxSelector = 'body > div:nth-child(3) > div > div.ant-modal-wrap > div > div:nth-child(1) > div > div.ant-modal-body > div > form > div:nth-child(2) > input[type=number]';
57-
const xxInput = await window.waitForSelector(xxSelector);
58-
await xxInput.fill('32');
59-
60-
// Typing A-input width as 64
61-
const aInputWidthSelector = 'body > div:nth-child(3) > div > div.ant-modal-wrap > div > div:nth-child(1) > div > div.ant-modal-body > div > form > div:nth-child(4) > input[type=number]';
62-
const aInputWidthInput = await window.waitForSelector(aInputWidthSelector);
63-
await aInputWidthInput.fill('64');
64-
65-
// Typing B-input width as 64
66-
const bInputWidthSelector = 'body > div:nth-child(3) > div > div.ant-modal-wrap > div > div:nth-child(1) > div > div.ant-modal-body > div > form > div:nth-child(5) > input[type=number]';
67-
const bInputWidthInput = await window.waitForSelector(bInputWidthSelector);
68-
await bInputWidthInput.fill('64');
69-
70-
// Typing toggle rate as 50
71-
const toggleRateSelector = 'body > div:nth-child(3) > div > div.ant-modal-wrap > div > div:nth-child(1) > div > div.ant-modal-body > div > form > div:nth-child(8) > input[type=number]';
72-
const toggleRateInput = await window.waitForSelector(toggleRateSelector);
73-
await toggleRateInput.fill('50');
74-
75-
// Clicking OK to submit the DSP form
76-
const dspOkButtonSelector = 'body > div:nth-child(3) > div > div.ant-modal-wrap > div > div:nth-child(1) > div > div.ant-modal-footer > button.ant-btn.css-dev-only-do-not-override-49qm.ant-btn-primary.ant-btn-color-primary.ant-btn-variant-solid';
77-
const dspOkButton = await window.waitForSelector(dspOkButtonSelector);
78-
await dspOkButton.click();
79-
80-
// Closing the test
8+
// Select the device (MPW1 Gemini)
9+
await window.selectOption('#deviceId', 'MPW1');
10+
11+
// Select Clocking block and click Add
12+
await window.click('#app > div > div.top-row-container > div.main-table-container.main-border > div.top-l2 > div.top-l2-col2 > div.top-l2-col2-elem > div > div:nth-child(2) > div:nth-child(1) > div');
13+
await window.click('#app > div > div.table-container.main-border > div > div.power-and-table-wrapper > div.table-wrapper > button');
14+
15+
// Fill and submit Clocking form
16+
await window.fill('body > div:nth-child(3) > div > div.ant-modal-wrap > div > div:nth-child(1) > div > div.ant-modal-body > div > form > div:nth-child(2) > input[type=text]', 'test');
17+
await window.fill('body > div:nth-child(3) > div > div.ant-modal-wrap > div > div:nth-child(1) > div > div.ant-modal-body > div > form > div:nth-child(3) > input[type=text]', 'test');
18+
await window.click('body > div:nth-child(3) > div > div.ant-modal-wrap > div > div:nth-child(1) > div > div.ant-modal-footer > button.ant-btn-primary');
19+
20+
// Navigate to DSP block and click Add
21+
await window.click('#app > div > div.top-row-container > div.main-table-container.main-border > div.top-l2 > div.top-l2-col2 > div.top-l2-col2-elem > div > div:nth-child(3) > div:nth-child(2) > div');
22+
await window.click('#app > div > div.table-container.main-border > div > div.power-and-table-wrapper > div.table-wrapper > button');
23+
24+
// Fill and submit DSP form
25+
await Promise.all([
26+
window.fill('body > div:nth-child(3) > div > div.ant-modal-wrap > div > div:nth-child(1) > div > div.ant-modal-body > div > form > div:nth-child(1) > input[type=text]', 'test'),
27+
window.fill('body > div:nth-child(3) > div > div.ant-modal-wrap > div > div:nth-child(1) > div > div.ant-modal-body > div > form > div:nth-child(2) > input[type=number]', '32'),
28+
window.fill('body > div:nth-child(3) > div > div.ant-modal-wrap > div > div:nth-child(1) > div > div.ant-modal-body > div > form > div:nth-child(4) > input[type=number]', '64'),
29+
window.fill('body > div:nth-child(3) > div > div.ant-modal-wrap > div > div:nth-child(1) > div > div.ant-modal-body > div > form > div:nth-child(5) > input[type=number]', '64'),
30+
window.fill('body > div:nth-child(3) > div > div.ant-modal-wrap > div > div:nth-child(1) > div > div.ant-modal-body > div > form > div:nth-child(8) > input[type=number]', '50')
31+
]);
32+
await window.click('body > div:nth-child(3) > div > div.ant-modal-wrap > div > div:nth-child(1) > div > div.ant-modal-footer > button.ant-btn-primary');
33+
34+
// Close the test
8135
await app.close();
8236
});

0 commit comments

Comments
 (0)