|
1 | | -const { _electron: electron } = require('playwright'); |
2 | | -const { test, expect } = require('@playwright/test'); |
3 | | - |
4 | | -test('Launch Electron app, add clocking source, navigate to DSP block, configure DSP, and submit form', async () => { |
5 | | - const app = await electron.launch({ args: ['main.js'] }); |
6 | | - const window = await app.firstWindow(); |
7 | | - |
8 | | - // Selecting the device (MPW1 Gemini) |
9 | | - const deviceDropdown = await window.waitForSelector('#deviceId'); |
10 | | - await deviceDropdown.selectOption('MPW1'); |
11 | | - await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait for 2 seconds |
12 | | - |
13 | | - // Selecting Clocking block |
14 | | - 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'; |
15 | | - const clockingBlock = await window.waitForSelector(clockingBlockSelector); |
16 | | - await clockingBlock.click(); |
17 | | - await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait for 2 seconds |
18 | | - |
19 | | - // Clicking on Add button for Clocking |
20 | | - const addButtonSelector = '#app > div > div.table-container.main-border > div > div.power-and-table-wrapper > div.table-wrapper > button'; |
21 | | - const addButton = await window.waitForSelector(addButtonSelector); |
22 | | - await addButton.click(); |
23 | | - await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait for 2 seconds |
24 | | - |
25 | | - // Ensure modal is visible before interacting |
26 | | - const modalSelector = 'body > div:nth-child(3) > div > div.ant-modal-wrap > div'; |
27 | | - await window.waitForSelector(modalSelector, { state: 'visible', timeout: 5000 }); // Wait for modal |
28 | | - |
29 | | - // Typing description as 'test' |
30 | | - 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]'; |
31 | | - const descriptionInput = await window.waitForSelector(descriptionSelector); |
32 | | - await descriptionInput.click(); |
33 | | - await descriptionInput.fill('test'); |
34 | | - await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second |
35 | | - |
36 | | - // Typing Port/Signal name as 'test' |
37 | | - 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]'; |
38 | | - const portSignalInput = await window.waitForSelector(portSignalSelector); |
39 | | - await portSignalInput.click(); |
40 | | - await portSignalInput.fill('test'); |
41 | | - await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second |
42 | | - |
43 | | - // Clicking OK to submit the clocking form |
44 | | - 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-apn68.ant-btn-primary.ant-btn-color-primary.ant-btn-variant-solid'; |
45 | | - const okButton = await window.waitForSelector(okButtonSelector); |
46 | | - await okButton.click(); |
47 | | - await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait for the form to submit |
48 | | - |
49 | | - |
50 | | - // Navigate to the DSP block |
51 | | - 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'; |
52 | | - const dspBlock = await window.waitForSelector(dspBlockSelector); |
53 | | - await dspBlock.click(); |
54 | | - await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait for 2 seconds |
55 | | - |
56 | | - // Clicking on Add button for DSP |
57 | | - const addDSPButton = await window.waitForSelector(addButtonSelector); // Reusing the same addButtonSelector |
58 | | - await addDSPButton.click(); |
59 | | - await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait for 2 seconds |
60 | | - |
61 | | - // Typing Name/Hierarchy as 'test' |
62 | | - 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]'; |
63 | | - const nameHierarchyInput = await window.waitForSelector(nameHierarchySelector); |
64 | | - await nameHierarchyInput.click(); |
65 | | - await nameHierarchyInput.fill('test'); |
66 | | - await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second |
67 | | - |
68 | | - // Typing XX as 32 |
69 | | - 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]'; |
70 | | - const xxInput = await window.waitForSelector(xxSelector); |
71 | | - await xxInput.click(); |
72 | | - await xxInput.fill('32'); |
73 | | - await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second |
74 | | - |
75 | | - // Typing A-input width as 64 |
76 | | - 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]'; |
77 | | - const aInputWidthInput = await window.waitForSelector(aInputWidthSelector); |
78 | | - await aInputWidthInput.click(); |
79 | | - await aInputWidthInput.fill('64'); |
80 | | - await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second |
81 | | - |
82 | | - // Typing B-input width as 64 |
83 | | - 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]'; |
84 | | - const bInputWidthInput = await window.waitForSelector(bInputWidthSelector); |
85 | | - await bInputWidthInput.click(); |
86 | | - await bInputWidthInput.fill('64'); |
87 | | - await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second |
88 | | - |
89 | | - // Typing toggle rate as 50 |
90 | | - 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]'; |
91 | | - const toggleRateInput = await window.waitForSelector(toggleRateSelector); |
92 | | - await toggleRateInput.click(); |
93 | | - await toggleRateInput.fill('50'); |
94 | | - await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second |
95 | | - |
96 | | - // Take note of the DSP power generated (assuming it's shown in the UI somewhere, you can add the selector for DSP power if needed) |
97 | | - |
98 | | - // Clicking OK to submit the DSP form |
99 | | - 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-apn68.ant-btn-primary.ant-btn-color-primary.ant-btn-variant-solid'; |
100 | | - const dspOkButton = await window.waitForSelector(dspOkButtonSelector); |
101 | | - await dspOkButton.click(); |
102 | | - await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait for the form to submit |
103 | | - |
104 | | - // Closing the test |
105 | | - await app.close(); |
106 | | -}); |
| 1 | +// const { _electron: electron } = require('playwright'); |
| 2 | +// const { test, expect } = require('@playwright/test'); |
| 3 | + |
| 4 | +// test('Launch Electron app, add clocking source, navigate to DSP block, configure DSP, and submit form', async () => { |
| 5 | +// const app = await electron.launch({ args: ['main.js'] }); |
| 6 | +// const window = await app.firstWindow(); |
| 7 | + |
| 8 | +// // Selecting the device (MPW1 Gemini) |
| 9 | +// const deviceDropdown = await window.waitForSelector('#deviceId'); |
| 10 | +// await deviceDropdown.selectOption('MPW1'); |
| 11 | +// await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait for 2 seconds |
| 12 | + |
| 13 | +// // Selecting Clocking block |
| 14 | +// 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'; |
| 15 | +// const clockingBlock = await window.waitForSelector(clockingBlockSelector); |
| 16 | +// await clockingBlock.click(); |
| 17 | +// await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait for 2 seconds |
| 18 | + |
| 19 | +// // Clicking on Add button for Clocking |
| 20 | +// const addButtonSelector = '#app > div > div.table-container.main-border > div > div.power-and-table-wrapper > div.table-wrapper > button'; |
| 21 | +// const addButton = await window.waitForSelector(addButtonSelector); |
| 22 | +// await addButton.click(); |
| 23 | +// await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait for 2 seconds |
| 24 | + |
| 25 | +// // Ensure modal is visible before interacting |
| 26 | +// const modalSelector = 'body > div:nth-child(3) > div > div.ant-modal-wrap > div'; |
| 27 | +// await window.waitForSelector(modalSelector, { state: 'visible', timeout: 5000 }); // Wait for modal |
| 28 | + |
| 29 | +// // Typing description as 'test' |
| 30 | +// 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]'; |
| 31 | +// const descriptionInput = await window.waitForSelector(descriptionSelector); |
| 32 | +// await descriptionInput.click(); |
| 33 | +// await descriptionInput.fill('test'); |
| 34 | +// await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second |
| 35 | + |
| 36 | +// // Typing Port/Signal name as 'test' |
| 37 | +// 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]'; |
| 38 | +// const portSignalInput = await window.waitForSelector(portSignalSelector); |
| 39 | +// await portSignalInput.click(); |
| 40 | +// await portSignalInput.fill('test'); |
| 41 | +// await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second |
| 42 | + |
| 43 | +// // Clicking OK to submit the clocking form |
| 44 | +// 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-apn68.ant-btn-primary.ant-btn-color-primary.ant-btn-variant-solid'; |
| 45 | +// const okButton = await window.waitForSelector(okButtonSelector); |
| 46 | +// await okButton.click(); |
| 47 | +// await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait for the form to submit |
| 48 | + |
| 49 | + |
| 50 | +// // Navigate to the DSP block |
| 51 | +// 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'; |
| 52 | +// const dspBlock = await window.waitForSelector(dspBlockSelector); |
| 53 | +// await dspBlock.click(); |
| 54 | +// await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait for 2 seconds |
| 55 | + |
| 56 | +// // Clicking on Add button for DSP |
| 57 | +// const addDSPButton = await window.waitForSelector(addButtonSelector); // Reusing the same addButtonSelector |
| 58 | +// await addDSPButton.click(); |
| 59 | +// await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait for 2 seconds |
| 60 | + |
| 61 | +// // Typing Name/Hierarchy as 'test' |
| 62 | +// 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]'; |
| 63 | +// const nameHierarchyInput = await window.waitForSelector(nameHierarchySelector); |
| 64 | +// await nameHierarchyInput.click(); |
| 65 | +// await nameHierarchyInput.fill('test'); |
| 66 | +// await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second |
| 67 | + |
| 68 | +// // Typing XX as 32 |
| 69 | +// 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]'; |
| 70 | +// const xxInput = await window.waitForSelector(xxSelector); |
| 71 | +// await xxInput.click(); |
| 72 | +// await xxInput.fill('32'); |
| 73 | +// await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second |
| 74 | + |
| 75 | +// // Typing A-input width as 64 |
| 76 | +// 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]'; |
| 77 | +// const aInputWidthInput = await window.waitForSelector(aInputWidthSelector); |
| 78 | +// await aInputWidthInput.click(); |
| 79 | +// await aInputWidthInput.fill('64'); |
| 80 | +// await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second |
| 81 | + |
| 82 | +// // Typing B-input width as 64 |
| 83 | +// 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]'; |
| 84 | +// const bInputWidthInput = await window.waitForSelector(bInputWidthSelector); |
| 85 | +// await bInputWidthInput.click(); |
| 86 | +// await bInputWidthInput.fill('64'); |
| 87 | +// await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second |
| 88 | + |
| 89 | +// // Typing toggle rate as 50 |
| 90 | +// 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]'; |
| 91 | +// const toggleRateInput = await window.waitForSelector(toggleRateSelector); |
| 92 | +// await toggleRateInput.click(); |
| 93 | +// await toggleRateInput.fill('50'); |
| 94 | +// await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second |
| 95 | + |
| 96 | +// // Take note of the DSP power generated (assuming it's shown in the UI somewhere, you can add the selector for DSP power if needed) |
| 97 | + |
| 98 | +// // Clicking OK to submit the DSP form |
| 99 | +// 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-apn68.ant-btn-primary.ant-btn-color-primary.ant-btn-variant-solid'; |
| 100 | +// const dspOkButton = await window.waitForSelector(dspOkButtonSelector); |
| 101 | +// await dspOkButton.click(); |
| 102 | +// await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait for the form to submit |
| 103 | + |
| 104 | +// // Closing the test |
| 105 | +// await app.close(); |
| 106 | +// }); |
0 commit comments