Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
0c7f181
RDS new flow request changes button added and different field added f…
Dhirenderchoudhary Feb 10, 2026
5c8e641
Merge branch 'develop' of https://github.com/Dhirenderchoudhary/websi…
Dhirenderchoudhary Feb 10, 2026
31dfffa
feat: Configure environment variable loading for local development, r…
Dhirenderchoudhary Feb 10, 2026
7640cb1
chore: Configure Yarn to use node_modules linker and define packageMa…
Dhirenderchoudhary Feb 10, 2026
848d556
Consolidate application feedback into the update payload, refine API …
Dhirenderchoudhary Feb 11, 2026
e712bda
feat: Add 'changes requested' application status, migrate to Yarn 4, …
Dhirenderchoudhary Feb 11, 2026
aa71f40
feat: Update application feedback handling, refine API interactions, …
Dhirenderchoudhary Feb 11, 2026
4209c6d
chore: refactor CSS selectors
Dhirenderchoudhary Feb 12, 2026
1b6ef9f
feat: Enhance application details with status messages, hide action b…
Dhirenderchoudhary Feb 15, 2026
ed864b9
refactor: upgrade Yarn to v4 and update CSS selectors for the request…
Dhirenderchoudhary Feb 16, 2026
fa59ee9
test: Add comprehensive tests for application 'request changes' flow
Dhirenderchoudhary Feb 16, 2026
43d3ab7
feat: Add feedback display for applications and implement changes req…
Dhirenderchoudhary Feb 17, 2026
ccd2937
feat: Add application score display and last edited timestamp in deta…
Dhirenderchoudhary Feb 19, 2026
fed2c33
feat: Add application highlights, status badges, and request changes …
Dhirenderchoudhary Feb 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 158 additions & 3 deletions __tests__/applications/applications.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ describe('Applications page', () => {
body: JSON.stringify(superUserForAudiLogs),
});
} else if (
url === `${STAGING_API_URL}/applications/lavEduxsb2C5Bl4s289P`
url === `${STAGING_API_URL}/applications/lavEduxsb2C5Bl4s289P/feedback`
) {
interceptedRequest.respond({
status: 200,
contentType: 'application/json',
body: JSON.stringify({
message: 'application updated successfully!',
message: 'Application feedback submitted successfully',
}),
headers: {
'Access-Control-Allow-Origin': '*',
Expand Down Expand Up @@ -355,7 +355,7 @@ describe('Applications page', () => {
).toBe(false);
const toastMessage = await page.$('[data-testid="toast-message"]');
expect(await toastMessage.evaluate((el) => el.textContent)).toBe(
'application updated successfully!',
'Application feedback submitted successfully',
);
});

Expand All @@ -371,4 +371,159 @@ describe('Applications page', () => {
const applicationCardElements = await page.$$('.application-card');
expect(applicationCardElements.length).toBe(acceptedApplications.length);
});

it('should show success toast after requesting changes for an application', async function () {
await page.goto(
`${LOCAL_TEST_PAGE_URL}/applications?dev=true&status=pending`,
);
await page.waitForSelector('.application-card');
await page.click('.application-card');

await page.type(
'.application-textarea',
'Please update your introduction.',
);

await page.click('#application-details-request-changes');
await page.waitForSelector('[data-testid="toast-component"].show');
const toastComponent = await page.$('[data-testid="toast-component"]');
expect(
await toastComponent.evaluate((el) => el.classList.contains('show')),
).toBe(true);
expect(
await toastComponent.evaluate((el) => el.classList.contains('hide')),
).toBe(false);
expect(
await toastComponent.evaluate((el) =>
el.classList.contains('success__toast'),
),
).toBe(true);
expect(
await toastComponent.evaluate((el) =>
el.classList.contains('error__toast'),
),
).toBe(false);
const toastMessage = await page.$('[data-testid="toast-message"]');
expect(await toastMessage.evaluate((el) => el.textContent)).toBe(
'Application feedback submitted successfully',
);
});

it('should show error toast when requesting changes without providing feedback', async function () {
await page.goto(
`${LOCAL_TEST_PAGE_URL}/applications?dev=true&status=pending`,
);
await page.waitForSelector('.application-card');
await page.click('.application-card');

await page.$eval('.application-textarea', (el) => (el.value = ''));
await page.click('#application-details-request-changes');
await page.waitForSelector('[data-testid="toast-component"].show');
const toastComponent = await page.$('[data-testid="toast-component"]');
expect(
await toastComponent.evaluate((el) => el.classList.contains('show')),
).toBe(true);
expect(
await toastComponent.evaluate((el) =>
el.classList.contains('error__toast'),
),
).toBe(true);
const toastMessage = await page.$('[data-testid="toast-message"]');
expect(await toastMessage.evaluate((el) => el.textContent)).toBe(
'Please provide feedback before requesting changes.',
);
});

it('should hide action buttons after successfully requesting changes', async function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this test about? are we hiding the button if the status is request changes

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yess but i added the buttons back for admin if state is request changes they get option to accept reject and request changes added feedbacks button
Screenshot 2026-02-18 at 5 14 39 AM

await page.goto(
`${LOCAL_TEST_PAGE_URL}/applications?dev=true&status=pending`,
);
await page.waitForSelector('.application-card');
await page.click('.application-card');

await page.type(
'.application-textarea',
'Please update your introduction.',
);

await page.click('#application-details-request-changes');
await page.waitForSelector('[data-testid="toast-component"].show');

const acceptBtn = await page.$('#application-details-accept');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use data test id here also to get the buttons

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay. i did that

const rejectBtn = await page.$('#application-details-reject');
const requestChangesBtn = await page.$(
'#application-details-request-changes',
);

expect(
await acceptBtn.evaluate((el) => el.classList.contains('hidden')),
).toBe(true);
expect(
await rejectBtn.evaluate((el) => el.classList.contains('hidden')),
).toBe(true);
expect(
await requestChangesBtn.evaluate((el) => el.classList.contains('hidden')),
).toBe(true);
});

it('should display "Changes were already requested" message after successfully requesting changes', async function () {
await page.goto(
`${LOCAL_TEST_PAGE_URL}/applications?dev=true&status=pending`,
);
await page.waitForSelector('.application-card');
await page.click('.application-card');

await page.type(
'.application-textarea',
'Please update your introduction.',
);

await page.click('#application-details-request-changes');
await page.waitForSelector('[data-testid="toast-component"].show');

const statusMsg = await page.$(
'.application-details-changes-requested-msg',
);
expect(statusMsg).toBeTruthy();
expect(await statusMsg.evaluate((el) => el.textContent)).toBe(
'Changes were already requested',
);
});

it('should send correct PATCH request when requesting changes', async function () {
let feedbackRequestBody = null;
let feedbackRequestMethod = null;

await page.goto(
`${LOCAL_TEST_PAGE_URL}/applications?dev=true&status=pending`,
);
await page.waitForSelector('.application-card');

page.on('request', (request) => {
if (
request.url().includes('/applications/') &&
request.url().includes('/feedback')
) {
feedbackRequestMethod = request.method();
feedbackRequestBody = JSON.parse(request.postData());
}
});

await page.click('.application-card');

await page.$eval('.application-textarea', (el) => (el.value = ''));
await page.type(
'.application-textarea',
'Please update your introduction.',
);

await page.click('#application-details-request-changes');
await page.waitForSelector('[data-testid="toast-component"].show');

expect(feedbackRequestMethod).toBe('PATCH');
expect(feedbackRequestBody).toEqual({
status: 'changes_requested',
feedback: 'Please update your introduction.',
});
});
});
17 changes: 16 additions & 1 deletion applications/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,30 @@ <h2>Status</h2>
/>
</button>
<div class="application-details-main"></div>
<div class="application-details-actions">
<div
class="application-details-actions"
id="application-details-actions"
>
<button
class="application-details-accept"
id="application-details-accept"
data-testid="application-details-accept"
aria-label="Accept Application"
>
Accept
</button>
<button
class="application-details-request-changes"
aria-label="Request changes for this application"
id="application-details-request-changes"
data-testid="application-details-request-changes"
>
Request Changes
</button>
<button
class="application-details-reject"
id="application-details-reject"
data-testid="application-details-reject"
aria-label="Reject Application"
>
Reject
Expand Down
Loading
Loading