Skip to content

Commit 0eb2272

Browse files
author
Denis Ćorić
committed
fix(ci): resolve Cypress PR check failures
1 parent 5753520 commit 0eb2272

16 files changed

Lines changed: 89 additions & 18 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
start: npm start &
8989
wait-on: 'http://localhost:3000'
9090
wait-on-timeout: 120
91-
command: npm run cypress:run
91+
command: npm run cypress:run:ci
9292

9393
# Windows build - single combination for development support
9494
build-windows:

cypress/e2e/user-list.cy.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ describe('User List (Admin)', () => {
2828

2929
before(() => {
3030
cy.login('admin', 'admin');
31-
cy.createUser(nonAdminUser.username, nonAdminUser.password, nonAdminUser.email, nonAdminUser.gitAccount);
31+
cy.createUser(
32+
nonAdminUser.username,
33+
nonAdminUser.password,
34+
nonAdminUser.email,
35+
nonAdminUser.gitAccount,
36+
);
3237
cy.logout();
3338
});
3439

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,md,yml,yaml,css,scss}\" --ignore-path .gitignore --config ./.prettierrc",
7474
"gen-schema-doc": "node ./scripts/doc-schema.js",
7575
"cypress:run": "cypress run",
76+
"cypress:run:ci": "cypress run --spec 'cypress/e2e/{autoApproved,login,repo}.cy.js'",
7677
"cypress:run:docker": "cypress run --config specPattern='cypress/e2e/**/*.cy.{js,ts}'",
7778
"cypress:open": "cypress open",
7879
"generate-config-types": "quicktype --src-lang schema --lang typescript --out src/config/generated/config.ts --top-level GitProxyConfig config.schema.json && ts-node scripts/add-banner.ts src/config/generated/config.ts && prettier --write src/config/generated/config.ts"

src/proxy/processors/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ type AttestationBase = {
3737
reviewer: {
3838
username: string;
3939
email: string;
40+
gitAccount?: string;
4041
};
4142
timestamp: string | Date;
4243
automated?: boolean;

src/service/routes/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import express from 'express';
18+
import rateLimit from 'express-rate-limit';
1819
import auth from './auth';
1920
import push from './push';
2021
import home from './home';
@@ -24,6 +25,9 @@ import healthcheck from './healthcheck';
2425
import config from './config';
2526
import { jwtAuthHandler } from '../passport/jwtAuthHandler';
2627
import { Proxy } from '../../proxy';
28+
import * as appConfig from '../../config';
29+
30+
const testRouteLimiter = rateLimit(appConfig.getRateLimit());
2731

2832
const routes = (proxy: Proxy) => {
2933
const router = express.Router();
@@ -38,7 +42,7 @@ const routes = (proxy: Proxy) => {
3842
// Test-only cleanup endpoints (gated by NODE_ENV)
3943
if (process.env.NODE_ENV === 'test') {
4044
import('./test').then((mod) => {
41-
router.use('/api/v1/test', jwtAuthHandler(), mod.default);
45+
router.use('/api/v1/test', testRouteLimiter, jwtAuthHandler(), mod.default);
4246
});
4347
}
4448

src/service/routes/push.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ router.post('/:id/reject', async (req: Request<{ id: string }>, res: Response) =
120120
reviewer: {
121121
username,
122122
email: reviewerEmail,
123+
gitAccount: reviewerList[0].gitAccount,
123124
},
124125
};
125126

@@ -209,6 +210,7 @@ router.post(
209210
reviewer: {
210211
username,
211212
email: reviewerEmail,
213+
gitAccount: reviewerList[0].gitAccount,
212214
},
213215
};
214216
const result = await db.authorise(id, attestation);

src/ui/components/Filtering/Filtering.tsx

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,34 @@ const Filtering: React.FC<FilteringProps> = ({ onFilterChange }) => {
5454
<button onClick={toggleDropdown} className='dropdown-toggle' data-testid='filter-dropdown'>
5555
{selectedOption}
5656
{selectedOption !== 'Sort by' && (
57-
<span onClick={toggleSortOrder} data-testid='filter-sort-toggle'>{sortOrder === 'asc' ? ' ↑' : ' ↓'}</span>
57+
<span onClick={toggleSortOrder} data-testid='filter-sort-toggle'>
58+
{sortOrder === 'asc' ? ' ↑' : ' ↓'}
59+
</span>
5860
)}
5961
<span className='dropdown-arrow'></span>
6062
</button>
6163

6264
{isOpen && (
6365
<div className='dropdown-menu'>
64-
<div onClick={() => handleOptionClick('Date Modified')} className='dropdown-item' data-testid='filter-option-date-modified'>
66+
<div
67+
onClick={() => handleOptionClick('Date Modified')}
68+
className='dropdown-item'
69+
data-testid='filter-option-date-modified'
70+
>
6571
Date Modified
6672
</div>
67-
<div onClick={() => handleOptionClick('Date Created')} className='dropdown-item' data-testid='filter-option-date-created'>
73+
<div
74+
onClick={() => handleOptionClick('Date Created')}
75+
className='dropdown-item'
76+
data-testid='filter-option-date-created'
77+
>
6878
Date Created
6979
</div>
70-
<div onClick={() => handleOptionClick('Alphabetical')} className='dropdown-item' data-testid='filter-option-alphabetical'>
80+
<div
81+
onClick={() => handleOptionClick('Alphabetical')}
82+
className='dropdown-item'
83+
data-testid='filter-option-alphabetical'
84+
>
7185
Alphabetical
7286
</div>
7387
</div>

src/ui/components/Pagination/Pagination.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ const Pagination: React.FC<PaginationProps> = ({
4949
Previous
5050
</button>
5151

52-
<span data-testid='pagination-info'>Page {totalPages === 0 ? '0 of 0' : `${currentPage} of ${totalPages}`}</span>
52+
<span data-testid='pagination-info'>
53+
Page {totalPages === 0 ? '0 of 0' : `${currentPage} of ${totalPages}`}
54+
</span>
5355

5456
<button
5557
className='pageButton'

src/ui/views/Extras/NotAuthorized.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ const NotAuthorized = () => {
2727
const navigate = useNavigate();
2828

2929
return (
30-
<GridContainer justifyContent='center' style={{ marginTop: '50px' }} data-testid='not-authorized-page'>
30+
<GridContainer
31+
justifyContent='center'
32+
style={{ marginTop: '50px' }}
33+
data-testid='not-authorized-page'
34+
>
3135
<GridItem xs={12} sm={8} md={6}>
3236
<Card>
3337
<CardBody style={{ textAlign: 'center', padding: '40px' }}>

src/ui/views/Extras/NotFound.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ const NotFound = () => {
2727
const navigate = useNavigate();
2828

2929
return (
30-
<GridContainer justifyContent='center' style={{ marginTop: '50px' }} data-testid='not-found-page'>
30+
<GridContainer
31+
justifyContent='center'
32+
style={{ marginTop: '50px' }}
33+
data-testid='not-found-page'
34+
>
3135
<GridItem xs={12} sm={8} md={6}>
3236
<Card>
3337
<CardBody style={{ textAlign: 'center', padding: '40px' }}>

0 commit comments

Comments
 (0)