Skip to content

Commit a410293

Browse files
committed
adding playwright end to end tests folder
1 parent 2d4edfb commit a410293

File tree

5 files changed

+262
-0
lines changed

5 files changed

+262
-0
lines changed

playwright_e2e/ACPU.test.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const { _electron: electron } = require('playwright');
2+
const { test, expect } = require('@playwright/test');
3+
4+
test('Launch Electron app, select device, toggle ACPU power, and click Add slowly', async () => {
5+
const app = await electron.launch({ args: ['main.js'] });
6+
7+
const window = await app.firstWindow();
8+
9+
// selecting the device (MPW1 Gemini)
10+
const deviceDropdown = await window.waitForSelector('#deviceId');
11+
await deviceDropdown.selectOption('MPW1');
12+
await new Promise((resolve) => setTimeout(resolve, 2000)); // wait 2 seconds (not really needed, just for demo)
13+
14+
// clicking on ACPU block
15+
const acpuBlock = await window.waitForSelector('#app > div > div.top-row-container > div.main-table-container.main-border > div.top-l2 > div.top-l2-col1 > div.top-l2-col1-row1 > div:nth-child(1) > div');
16+
await acpuBlock.click();
17+
await new Promise((resolve) => setTimeout(resolve, 2000));
18+
19+
// toggling ACPU power, basically turning on the power on
20+
const acpuPowerToggle = await window.waitForSelector('#app > div > div.table-container.main-border > div > div.toggle-container > label.toggle-switch > span');
21+
await acpuPowerToggle.click();
22+
await new Promise((resolve) => setTimeout(resolve, 2000));
23+
24+
// Click on Add button
25+
const addButton = await window.waitForSelector('#app > div > div.table-container.main-border > div > div.cpu-container > div.table-wrapper > button');
26+
await addButton.click();
27+
await new Promise((resolve) => setTimeout(resolve, 2000));
28+
29+
// Click OK in the popup
30+
const okButton = await window.waitForSelector('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-ni1kz0.ant-btn-primary.ant-btn-color-primary.ant-btn-variant-solid');
31+
await okButton.click();
32+
await new Promise((resolve) => setTimeout(resolve, 2000));
33+
34+
console.log('Test case executed successfully.');
35+
36+
await app.close();
37+
});

playwright_e2e/BCPU.test.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
const { _electron: electron } = require('playwright');
2+
const { test, expect } = require('@playwright/test');
3+
4+
test('Launch Electron app, select device MPW1 Gemini, and click on BCPU block', async () => {
5+
const app = await electron.launch({ args: ['main.js'], headless: false });
6+
7+
const window = await app.firstWindow();
8+
9+
// selecting MPW1 Gemini from device dropdown
10+
const deviceDropdown = await window.waitForSelector('#deviceId');
11+
await deviceDropdown.selectOption('MPW1');
12+
await window.waitForTimeout(2000); // wait for UI update
13+
14+
// click on the BCPU block
15+
const bcpuSelector = '#app > div > div.top-row-container > div.main-table-container.main-border > div.top-l2 > div.top-l2-col1 > div.top-l2-col1-row1 > div:nth-child(2) > div';
16+
await window.waitForSelector(bcpuSelector);
17+
await window.click(bcpuSelector);
18+
19+
// click on "Add" button
20+
const addButtonSelector = '#app > div > div.table-container.main-border > div > div.cpu-container > div.table-wrapper > button';
21+
await window.waitForSelector(addButtonSelector, { state: 'visible' });
22+
await window.click(addButtonSelector);
23+
24+
// click on "OK" button
25+
const okButtonSelector = 'button.ant-btn-primary';
26+
await window.waitForSelector(okButtonSelector, { state: 'visible' });
27+
await window.click(okButtonSelector);
28+
29+
// click on Peripherals tab
30+
const peripheralsTabSelector = '#app > div > div.top-row-container > div.main-table-container.main-border > div.top-l2 > div.top-l2-col1 > div:nth-child(3) > div > div:nth-child(2) > div:nth-child(2) > div.periph-internal-font-header';
31+
await window.waitForSelector(peripheralsTabSelector, { state: 'visible' });
32+
await window.click(peripheralsTabSelector);
33+
34+
// check SPI/QSPI block
35+
const spiQspiCheckSelector = '#\\30';
36+
await window.waitForSelector(spiQspiCheckSelector, { state: 'visible' });
37+
await window.click(spiQspiCheckSelector);
38+
39+
// waiting to observe result on UI
40+
await window.waitForTimeout(5000);
41+
42+
// closing RPE
43+
await app.close();
44+
});

playwright_e2e/DSP.test.js

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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-ni1kz0.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+
// Navigate to the DSP block
50+
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';
51+
const dspBlock = await window.waitForSelector(dspBlockSelector);
52+
await dspBlock.click();
53+
await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait for 2 seconds
54+
55+
// Clicking on Add button for DSP
56+
const addDSPButton = await window.waitForSelector(addButtonSelector); // Reusing the same addButtonSelector
57+
await addDSPButton.click();
58+
await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait for 2 seconds
59+
60+
// Typing Name/Hierarchy as 'test'
61+
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]';
62+
const nameHierarchyInput = await window.waitForSelector(nameHierarchySelector);
63+
await nameHierarchyInput.click();
64+
await nameHierarchyInput.fill('test');
65+
await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second
66+
67+
// Typing XX as 32
68+
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]';
69+
const xxInput = await window.waitForSelector(xxSelector);
70+
await xxInput.click();
71+
await xxInput.fill('32');
72+
await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second
73+
74+
// Typing A-input width as 64
75+
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]';
76+
const aInputWidthInput = await window.waitForSelector(aInputWidthSelector);
77+
await aInputWidthInput.click();
78+
await aInputWidthInput.fill('64');
79+
await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second
80+
81+
// Typing B-input width as 64
82+
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]';
83+
const bInputWidthInput = await window.waitForSelector(bInputWidthSelector);
84+
await bInputWidthInput.click();
85+
await bInputWidthInput.fill('64');
86+
await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second
87+
88+
// Typing toggle rate as 50
89+
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]';
90+
const toggleRateInput = await window.waitForSelector(toggleRateSelector);
91+
await toggleRateInput.click();
92+
await toggleRateInput.fill('50');
93+
await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second
94+
95+
// 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)
96+
97+
// Clicking OK to submit the DSP form
98+
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-ni1kz0.ant-btn-primary.ant-btn-color-primary.ant-btn-variant-solid';
99+
const dspOkButton = await window.waitForSelector(dspOkButtonSelector);
100+
await dspOkButton.click();
101+
await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait for the form to submit
102+
103+
// Closing the test
104+
await app.close();
105+
});

playwright_e2e/FLE.test.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const { _electron: electron } = require('playwright');
2+
const { test, expect } = require('@playwright/test');
3+
4+
test('Launch Electron app and click on FLE block', async () => {
5+
const app = await electron.launch({ args: ['main.js'] });
6+
7+
const window = await app.firstWindow();
8+
9+
// selecting the device (MPW1 Gemini)
10+
const deviceDropdown = await window.waitForSelector('#deviceId');
11+
await deviceDropdown.selectOption('MPW1');
12+
await new Promise((resolve) => setTimeout(resolve, 2000));
13+
14+
const fleBlock = await window.waitForSelector('#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(2) > div');
15+
await fleBlock.click();
16+
17+
const flePowerVisible = await window.isVisible('div.title-comp-total-text');
18+
expect(flePowerVisible).toBeTruthy();
19+
20+
console.log('FLE block clicked and verified.');
21+
22+
await new Promise((resolve) => setTimeout(resolve, 5000));
23+
24+
await app.close();
25+
});

playwright_e2e/clocking.test.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
const { _electron: electron } = require('playwright');
2+
const { test, expect } = require('@playwright/test');
3+
4+
test('Launch Electron app, select device, toggle ACPU power, click Clocking, Add clock source, 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
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 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-ni1kz0.ant-btn-primary.ant-btn-color-primary.ant-btn-variant-solid';
45+
const okButton = await window.waitForSelector(okButtonSelector);
46+
await okButton.click();
47+
48+
// Closing the test
49+
await app.close();
50+
});
51+

0 commit comments

Comments
 (0)