Skip to content

Commit c307a6e

Browse files
committed
Merge branch 'main' of github.com:os-fpga/rapid_power_estimator into user-guide-ToC
2 parents bcefdf5 + f5dd78a commit c307a6e

File tree

3 files changed

+64
-27
lines changed

3 files changed

+64
-27
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/fle.test.js

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
1-
// const { _electron: electron } = require('playwright');
2-
// const { test, expect } = require('@playwright/test');
1+
const { _electron: electron } = require('playwright');
2+
const { test, expect } = require('@playwright/test');
33

4-
// test('Launch Electron app and click on FLE block', async () => {
5-
// const app = await electron.launch({ args: ['main.js'] });
4+
test('Launch Electron app and click on FLE block', async () => {
5+
const app = await electron.launch({ args: ['main.js'] });
66

7-
// const window = await app.firstWindow();
7+
const window = await app.firstWindow();
88

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));
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));
1313

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();
14+
// Clicking on the FLE block
15+
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');
16+
await fleBlock.click();
1617

17-
// const flePowerVisible = await window.isVisible('div.title-comp-total-text');
18-
// expect(flePowerVisible).toBeTruthy();
18+
const flePowerVisible = await window.isVisible('div.title-comp-total-text');
19+
expect(flePowerVisible).toBeTruthy();
1920

20-
// console.log('FLE block clicked and verified.');
21+
console.log('FLE block clicked and verified.');
2122

22-
// await new Promise((resolve) => setTimeout(resolve, 5000));
23+
await new Promise((resolve) => setTimeout(resolve, 5000));
2324

24-
// await app.close();
25-
// });
25+
await app.close();
26+
});

0 commit comments

Comments
 (0)