Skip to content

Commit 27cc39e

Browse files
committed
fix(cypress): remove TS syntax from .js files and fix git credentials
- Remove TypeScript type annotations from .cy.js files (Babel doesn't support them) - Use git server credentials (testuser/user123) for cy.createPush() calls instead of app user credentials which don't exist on the git server
1 parent 5313cb9 commit 27cc39e

21 files changed

Lines changed: 24 additions & 17 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,3 +276,4 @@ website/.docusaurus
276276

277277
# Generated from testing
278278
/test/fixtures/test-package/package-lock.json
279+
cypress/screenshots/

cypress/e2e/push-details.cy.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ describe('Push Details — Tabs & Content Rendering', () => {
2020
password: 'testuser123',
2121
email: 'pushdetails_testuser@example.com',
2222
gitAccount: 'pushdetails_testuser',
23+
// Git credentials must match a user on the git server for cy.createPush() to work
24+
gitUsername: 'testuser',
25+
gitPassword: 'user123',
2326
};
2427

2528
const approverUser = {
@@ -61,7 +64,7 @@ describe('Push Details — Tabs & Content Rendering', () => {
6164
// --- 1.1 Pending push shows Pending status ---
6265
it('1.1 — Pending push shows Pending status with action buttons', function () {
6366
const suffix = `pending-${Date.now()}`;
64-
cy.createPush(testUser.username, testUser.password, testUser.email, suffix).as('pushId');
67+
cy.createPush(testUser.gitUsername, testUser.gitPassword, testUser.email, suffix).as('pushId');
6568

6669
cy.login('admin', 'admin');
6770
cy.visit(`/dashboard/push/${this.pushId}`);
@@ -78,7 +81,7 @@ describe('Push Details — Tabs & Content Rendering', () => {
7881
// --- 1.2 Card body renders info fields with correct links ---
7982
it('1.2 — Card body renders Timestamp, Remote Head, Commit SHA, Repository, Branch', function () {
8083
const suffix = `info-${Date.now()}`;
81-
cy.createPush(testUser.username, testUser.password, testUser.email, suffix).as('pushId');
84+
cy.createPush(testUser.gitUsername, testUser.gitPassword, testUser.email, suffix).as('pushId');
8285

8386
cy.login('admin', 'admin');
8487
cy.visit(`/dashboard/push/${this.pushId}`);
@@ -99,7 +102,7 @@ describe('Push Details — Tabs & Content Rendering', () => {
99102
// --- 1.3 Commits tab renders commit data table ---
100103
it('1.3 — Commits tab renders commit data table with correct columns', function () {
101104
const suffix = `commits-${Date.now()}`;
102-
cy.createPush(testUser.username, testUser.password, testUser.email, suffix).as('pushId');
105+
cy.createPush(testUser.gitUsername, testUser.gitPassword, testUser.email, suffix).as('pushId');
103106

104107
cy.login('admin', 'admin');
105108
cy.visit(`/dashboard/push/${this.pushId}`);
@@ -117,7 +120,7 @@ describe('Push Details — Tabs & Content Rendering', () => {
117120
// --- 1.4 Changes tab renders diff content ---
118121
it('1.4 — Changes tab renders diff content via diff2html', function () {
119122
const suffix = `changes-${Date.now()}`;
120-
cy.createPush(testUser.username, testUser.password, testUser.email, suffix).as('pushId');
123+
cy.createPush(testUser.gitUsername, testUser.gitPassword, testUser.email, suffix).as('pushId');
121124

122125
cy.login('admin', 'admin');
123126
cy.visit(`/dashboard/push/${this.pushId}`);
@@ -133,7 +136,7 @@ describe('Push Details — Tabs & Content Rendering', () => {
133136
// --- 1.5 Steps tab renders steps timeline with summary ---
134137
it('1.5 — Steps tab renders steps timeline with summary chips', function () {
135138
const suffix = `steps-${Date.now()}`;
136-
cy.createPush(testUser.username, testUser.password, testUser.email, suffix).as('pushId');
139+
cy.createPush(testUser.gitUsername, testUser.gitPassword, testUser.email, suffix).as('pushId');
137140

138141
cy.login('admin', 'admin');
139142
cy.visit(`/dashboard/push/${this.pushId}`);
@@ -155,7 +158,7 @@ describe('Push Details — Tabs & Content Rendering', () => {
155158
// --- 1.6 Steps accordions expand and show content/logs ---
156159
it('1.6 — Steps accordions expand and show content/logs', function () {
157160
const suffix = `accordion-${Date.now()}`;
158-
cy.createPush(testUser.username, testUser.password, testUser.email, suffix).as('pushId');
161+
cy.createPush(testUser.gitUsername, testUser.gitPassword, testUser.email, suffix).as('pushId');
159162

160163
cy.login('admin', 'admin');
161164
cy.visit(`/dashboard/push/${this.pushId}`);
@@ -179,7 +182,7 @@ describe('Push Details — Tabs & Content Rendering', () => {
179182
// --- 1.7 Rejected push shows rejection info with reason ---
180183
it('1.7 — Rejected push shows rejection info with reason', function () {
181184
const suffix = `reject-${Date.now()}`;
182-
cy.createPush(testUser.username, testUser.password, testUser.email, suffix).as('pushId');
185+
cy.createPush(testUser.gitUsername, testUser.gitPassword, testUser.email, suffix).as('pushId');
183186

184187
cy.login(approverUser.username, approverUser.password);
185188
cy.visit(`/dashboard/push/${this.pushId}`);
@@ -211,7 +214,7 @@ describe('Push Details — Tabs & Content Rendering', () => {
211214
// --- 1.8 Approved push shows attestation info ---
212215
it('1.8 — Approved push shows attestation info', function () {
213216
const suffix = `approve-${Date.now()}`;
214-
cy.createPush(testUser.username, testUser.password, testUser.email, suffix).as('pushId');
217+
cy.createPush(testUser.gitUsername, testUser.gitPassword, testUser.email, suffix).as('pushId');
215218

216219
cy.login(approverUser.username, approverUser.password);
217220
cy.visit(`/dashboard/push/${this.pushId}`);
@@ -263,7 +266,7 @@ describe('Push Details — Tabs & Content Rendering', () => {
263266
// --- 1.10 Canceled push shows Canceled status ---
264267
it('1.10 — Canceled push shows Canceled status', function () {
265268
const suffix = `cancel-${Date.now()}`;
266-
cy.createPush(testUser.username, testUser.password, testUser.email, suffix).as('pushId');
269+
cy.createPush(testUser.gitUsername, testUser.gitPassword, testUser.email, suffix).as('pushId');
267270

268271
cy.login(testUser.username, testUser.password);
269272
cy.visit(`/dashboard/push/${this.pushId}`);
@@ -286,7 +289,7 @@ describe('Push Details — Tabs & Content Rendering', () => {
286289
// --- 1.11 Push details page navigates back to push list after action ---
287290
it('1.11 — Action buttons navigate back to push list after completing action', function () {
288291
const suffix = `nav-${Date.now()}`;
289-
cy.createPush(testUser.username, testUser.password, testUser.email, suffix).as('pushId');
292+
cy.createPush(testUser.gitUsername, testUser.gitPassword, testUser.email, suffix).as('pushId');
290293

291294
cy.login(testUser.username, testUser.password);
292295
cy.visit(`/dashboard/push/${this.pushId}`);

cypress/e2e/push-requests.cy.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ describe('Push Requests — Tab Filtering', () => {
2626
password: 'testuser123',
2727
email: 'pushreq_testuser@example.com',
2828
gitAccount: 'pushreq_testuser',
29+
// Git credentials must match a user on the git server for cy.createPush() to work
30+
gitUsername: 'testuser',
31+
gitPassword: 'user123',
2932
};
3033

3134
const approverUser = {
@@ -36,7 +39,7 @@ describe('Push Requests — Tab Filtering', () => {
3639
};
3740

3841
// Shared push IDs for the test suite
39-
const pushIds: { pending: string; approved: string; rejected: string; canceled: string } = {
42+
const pushIds = {
4043
pending: '',
4144
approved: '',
4245
rejected: '',
@@ -57,12 +60,12 @@ describe('Push Requests — Tab Filtering', () => {
5760
cy.logout();
5861

5962
// Create pending push
60-
cy.createPush(testUser.username, testUser.password, testUser.email, `pushreq-pending-${Date.now()}`).then(
63+
cy.createPush(testUser.gitUsername, testUser.gitPassword, testUser.email, `pushreq-pending-${Date.now()}`).then(
6164
(id) => { pushIds.pending = id; }
6265
);
6366

6467
// Create and approve a push
65-
cy.createPush(testUser.username, testUser.password, testUser.email, `pushreq-approved-${Date.now()}`).then(
68+
cy.createPush(testUser.gitUsername, testUser.gitPassword, testUser.email, `pushreq-approved-${Date.now()}`).then(
6669
(id) => {
6770
pushIds.approved = id;
6871
// Login as approver and approve
@@ -81,7 +84,7 @@ describe('Push Requests — Tab Filtering', () => {
8184
);
8285

8386
// Create and reject a push
84-
cy.createPush(testUser.username, testUser.password, testUser.email, `pushreq-rejected-${Date.now()}`).then(
87+
cy.createPush(testUser.gitUsername, testUser.gitPassword, testUser.email, `pushreq-rejected-${Date.now()}`).then(
8588
(id) => {
8689
pushIds.rejected = id;
8790
// Login as approver and reject
@@ -95,7 +98,7 @@ describe('Push Requests — Tab Filtering', () => {
9598
);
9699

97100
// Create and cancel a push
98-
cy.createPush(testUser.username, testUser.password, testUser.email, `pushreq-canceled-${Date.now()}`).then(
101+
cy.createPush(testUser.gitUsername, testUser.gitPassword, testUser.email, `pushreq-canceled-${Date.now()}`).then(
99102
(id) => {
100103
pushIds.canceled = id;
101104
// Login as test user and cancel

cypress/e2e/repo-details.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('Repo Details — User Management', () => {
4040
gitAccount: 'repo_detail_regular',
4141
};
4242

43-
let testRepoId: string | null = null;
43+
let testRepoId = null;
4444

4545
function getApiBaseUrl() {
4646
return Cypress.env('API_BASE_URL') || Cypress.config('baseUrl');

cypress/e2e/repo-list.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* Pagination tested here only. Search/filter use client-side logic.
2121
*/
2222
describe('Repo List — Search, Filter, Pagination', () => {
23-
const createdRepoIds: string[] = [];
23+
const createdRepoIds = [];
2424

2525
function getApiBaseUrl() {
2626
return Cypress.env('API_BASE_URL') || Cypress.config('baseUrl');
224 KB
Loading
259 KB
Loading
253 KB
Loading
243 KB
Loading
252 KB
Loading

0 commit comments

Comments
 (0)