Skip to content

Commit 95233f7

Browse files
Merge branch 'main' into user-guide-ToC
2 parents e1834fd + d5a3058 commit 95233f7

File tree

5 files changed

+220
-183
lines changed

5 files changed

+220
-183
lines changed

.github/workflows/rpe_test.yml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ on:
55
tags:
66
- '*'
77
branches:
8-
- '*'
9-
- '*/**'
8+
- main
109
pull_request:
1110

1211
concurrency:
@@ -21,7 +20,7 @@ jobs:
2120
os:
2221
- ubuntu-latest
2322
- ubuntu-22.04 # This is CentOS 7 under the hood
24-
- macos-12
23+
- macos-latest
2524
- windows-latest
2625

2726
runs-on: ${{ matrix.os }}
@@ -30,6 +29,13 @@ jobs:
3029

3130
steps:
3231
- uses: actions/checkout@v4
32+
33+
- name: Bring in device.xml
34+
uses: actions/checkout@v4
35+
with:
36+
repository: os-fpga/Raptor
37+
path: Raptor
38+
sparse-checkout: 'etc'
3339

3440
- name: Setup Node.js ${{ matrix.os }}
3541
if: ${{ matrix.os != 'ubuntu-22.04' }}
@@ -86,10 +92,17 @@ jobs:
8692
- name: Unit Jtest Linux latest & windows & MacOS
8793
if: ${{ matrix.os != 'ubuntu-22.04' }}
8894
run: npm test
95+
96+
- name: E2E Playwright tests on Linux latest & MacOS
97+
if: ${{ matrix.os == 'ubuntu-latest' }}
98+
run: |
99+
cp -rf Raptor/etc backend
100+
npm run compile && xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npx playwright test
101+
102+
- name: cat RPE log
103+
if: matrix.os == 'ubuntu-latest' && always()
104+
run: find $HOME -type f -name "rpe.log" -exec cat {} +
89105

90-
# - name: E2E Playwright tests on Linux latest & MacOS
91-
# if: ${{ matrix.os == 'ubuntu-latest' }}
92-
# run: npm run compile && xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npx playwright test
93106

94107
- name: Run ESLint only on ubuntu-latest
95108
if: ${{ matrix.os == 'ubuntu-latest' }}
@@ -116,7 +129,7 @@ jobs:
116129
matrix:
117130
os:
118131
- ubuntu-22.04 # This is CentOS 7 under the hood
119-
- macos-12
132+
- macos-latest
120133
- windows-latest
121134

122135
runs-on: ${{ matrix.os }}
@@ -206,15 +219,15 @@ jobs:
206219
echo ${{ github.ref }}
207220
208221
- name: Upload Package
209-
if: ${{ github.ref == 'refs/heads/main' && matrix.os != 'windows-latest' }}
210-
uses: actions/upload-artifact@v3
222+
if: ${{ github.ref == 'refs/heads/main' && matrix.os != 'windows-latest' }}
223+
uses: actions/upload-artifact@v4.4.3
211224
with:
212225
name: rapid_power_estimator_${{ matrix.os }}
213226
path: dist/rapid_power_estimator*.tar.gz
214227

215228
- name: Upload Package
216229
if: ${{ github.ref == 'refs/heads/main' && matrix.os == 'windows-latest' }}
217-
uses: actions/upload-artifact@v3
230+
uses: actions/upload-artifact@v4.4.3
218231
with:
219232
name: rapid_power_estimator_${{ matrix.os }}
220233
path: dist/rapid_power_estimator*.exe

src/tests/Tables_tests/PowerSummaryTable.test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,27 @@ describe('PowerSummaryTable Component', () => {
7070
expect(within(noMessageRow).queryByText('Warning message')).toBeNull();
7171
expect(within(noMessageRow).queryByText('Error message')).toBeNull();
7272
});
73+
74+
test('total and percent values match sum of data', () => {
75+
render(<PowerSummaryTable title="Power Summary" data={mockData} total={60} percent={80} />);
76+
77+
const displayedTotal = screen.getByText((content) => content.includes('60.00') && content.includes('W'));
78+
expect(displayedTotal).toBeInTheDocument();
79+
80+
const progressBar = screen.getByRole('progressbar');
81+
expect(progressBar).toHaveAttribute('value', '80');
82+
expect(progressBar).toHaveAttribute('max', '100');
83+
});
84+
85+
test('renders correctly with no data entries', () => {
86+
render(<PowerSummaryTable title="Power Summary" data={[]} total={0} percent={0} />);
87+
88+
expect(screen.getByText('Power Summary')).toBeInTheDocument();
89+
90+
expect(screen.getByText('0.00 W')).toBeInTheDocument();
91+
expect(screen.getByText('0 %')).toBeInTheDocument();
92+
93+
const progressBar = screen.getByRole('progressbar');
94+
expect(progressBar).toHaveAttribute('value', '0');
95+
});
7396
});

tests/e2e/clocking.test.js

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +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-apn68.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-
// });
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-apn68.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+
});
5151

0 commit comments

Comments
 (0)