Skip to content

Commit a4a36b8

Browse files
authored
Merge branch 'Real-Dev-Squad:develop' into develop
2 parents 4269bfb + 8ee1b7f commit a4a36b8

File tree

23 files changed

+585
-25
lines changed

23 files changed

+585
-25
lines changed

__tests__/applications/applications.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('Applications page', () => {
6060
'Access-Control-Allow-Headers': 'Content-Type, Authorization',
6161
},
6262
});
63-
} else if (url === `${STAGING_API_URL}/users/self`) {
63+
} else if (url === `${STAGING_API_URL}/users?profile=true`) {
6464
interceptedRequest.respond({
6565
status: 200,
6666
contentType: 'application/json',

__tests__/groups/group.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe('Discord Groups Page', () => {
5151
},
5252
body: JSON.stringify(allUsersData),
5353
});
54-
} else if (url === `${STAGING_API_URL}/users/self`) {
54+
} else if (url === `${STAGING_API_URL}/users?profile=true`) {
5555
interceptedRequest.respond({
5656
status: 200,
5757
contentType: 'application/json',

__tests__/home/home.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('Home Page', () => {
2121
await page.setRequestInterception(true);
2222
page.on('request', (interceptedRequest) => {
2323
const url = interceptedRequest.url();
24-
if (url === `${STAGING_API_URL}/users/self`) {
24+
if (url === `${STAGING_API_URL}/users?profile=true`) {
2525
interceptedRequest.respond({
2626
status: 200,
2727
contentType: 'application/json',

__tests__/task-requests/task-requestDetails.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('Request container for non-super users', () => {
2525
await page.setRequestInterception(true);
2626
page.on('request', (interceptedRequest) => {
2727
const url = interceptedRequest.url();
28-
if (url == `${STAGING_API_URL}/users/self`) {
28+
if (url == `${STAGING_API_URL}/users?profile=true`) {
2929
interceptedRequest.respond({
3030
...defaultMockResponseHeaders,
3131
body: JSON.stringify(user),

__tests__/tasks/task-dependency.test.js

Lines changed: 95 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ const puppeteer = require('puppeteer');
22
const { tags } = require('../../mock-data/tags');
33
const { levels } = require('../../mock-data/levels');
44
const { users } = require('../../mock-data/users');
5-
const { STAGING_API_URL } = require('../../mock-data/constants');
5+
const {
6+
STAGING_API_URL,
7+
SKILL_TREE_BACKEND_BASE_URL,
8+
} = require('../../mock-data/constants');
9+
const { skills } = require('../../mock-data/skills');
610

7-
describe('Input box', () => {
11+
describe('Task Form', () => {
812
let browser;
913
let page;
1014
jest.setTimeout(60000);
@@ -27,6 +31,7 @@ describe('Input box', () => {
2731
[`${STAGING_API_URL}/levels`]: levels,
2832
[`${STAGING_API_URL}/users`]: users,
2933
[`${STAGING_API_URL}/tags`]: tags,
34+
[`${SKILL_TREE_BACKEND_BASE_URL}/skills`]: skills,
3035
};
3136

3237
if (mockResponses[url]) {
@@ -136,7 +141,7 @@ describe('Input box', () => {
136141

137142
// Dev Mode Tests
138143
describe('Dev Mode Behavior', () => {
139-
beforeAll(async () => {
144+
beforeEach(async () => {
140145
await page.goto('http://localhost:8000/task?dev=true');
141146
await page.waitForNetworkIdle();
142147
});
@@ -172,5 +177,92 @@ describe('Input box', () => {
172177
const dependsOnField = await page.$('[data-testid="dependsOn"]');
173178
expect(dependsOnField).toBeTruthy();
174179
});
180+
181+
it('should show skills multi-select component', async () => {
182+
const skillsComponent = await page.$eval(
183+
'[data-testid="skills"] .multi-select-container',
184+
(el) =>
185+
window.getComputedStyle(el.closest('[data-testid="skills"]')).display,
186+
);
187+
expect(skillsComponent).not.toBe('none');
188+
});
189+
190+
it('should initialize skills multi-select with options', async () => {
191+
await page.waitForSelector('[data-testid="skills-multi-select"]');
192+
193+
// Click to open dropdown
194+
await page.click('[data-testid="skills-select-button"]');
195+
196+
// Check if options are loaded
197+
const options = await page.$$eval(
198+
'[data-testid="option-label"]',
199+
(elements) => elements.map((el) => el.textContent.trim()),
200+
);
201+
202+
expect(options).toContain('(Select All)');
203+
expect(options).toContain('JavaScript');
204+
expect(options).toContain('React');
205+
expect(options).toContain('Node.js');
206+
});
207+
208+
it('should allow selecting and deselecting skills', async () => {
209+
await page.waitForSelector('[data-testid="skills-multi-select"]');
210+
211+
// Open dropdown
212+
await page.click('[data-testid="skills-select-button"]');
213+
214+
// Select JavaScript skill
215+
await page.click('[data-value="1"]');
216+
217+
// Check if badge is created
218+
const badge = await page.$eval(
219+
'[data-testid="selected-items"] .badge .text',
220+
(el) => el.textContent,
221+
);
222+
expect(badge).toBe('JavaScript');
223+
224+
// Remove skill
225+
await page.click('.badge .remove');
226+
227+
// Check if badge is removed
228+
const badges = await page.$$('.badge');
229+
expect(badges.length).toBe(0);
230+
});
231+
232+
it('should allow selecting all skills with (Select All)', async () => {
233+
await page.waitForSelector('[data-testid="skills-multi-select"]');
234+
235+
// Open dropdown
236+
await page.click('[data-testid="skills-select-button"]');
237+
238+
// Click (Select All)
239+
await page.click('[data-testid="option"][data-value="select-all"]');
240+
241+
// Check if all skills are selected as badges
242+
const badges = await page.$$eval(
243+
'[data-testid="selected-items"] .badge .text',
244+
(elements) => elements.map((el) => el.textContent.trim()),
245+
);
246+
expect(badges).toEqual(['JavaScript', 'React', 'Node.js']);
247+
});
248+
249+
it('should allow navigating and selecting options using the keyboard', async () => {
250+
await page.waitForSelector('[data-testid="skills-multi-select"]');
251+
252+
// Open dropdown
253+
await page.click('[data-testid="skills-select-button"]');
254+
255+
// Navigate and select an option
256+
await page.keyboard.press('ArrowDown');
257+
await page.keyboard.press('ArrowDown');
258+
await page.keyboard.press('Enter');
259+
260+
// Verify badge is created
261+
const badges = await page.$$eval(
262+
'[data-testid="selected-items"] .badge .text',
263+
(elements) => elements.map((el) => el.textContent.trim()),
264+
);
265+
expect(badges).toContain('JavaScript');
266+
});
175267
});
176268
});

__tests__/user-details/task-duedate-hover.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe('Tasks On User Management Page', () => {
4545
body: JSON.stringify(userDetails),
4646
});
4747
} else if (
48-
url === `${STAGING_API_URL}/users/self` ||
48+
url === `${STAGING_API_URL}/users?profile=true` ||
4949
url === `${STAGING_API_URL}/users/ankush`
5050
) {
5151
interceptedRequest.respond({

__tests__/users/onboarding-31-days-multiple-selections.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('Tests the "Onboarding > 31 Days" Filter', () => {
3333
},
3434
body: JSON.stringify(userDetailsApi),
3535
});
36-
} else if (url === `${STAGING_API_URL}/users/self`) {
36+
} else if (url === `${STAGING_API_URL}/users?profile=true`) {
3737
// When we encounter the respective api call we respond with the below response
3838
interceptedRequest.respond({
3939
status: 200,

__tests__/users/onboarding31days.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('Tests the "Onboarding > 31 Days" Filter', () => {
3434
},
3535
body: JSON.stringify(userDetailsApi),
3636
});
37-
} else if (url === `${STAGING_API_URL}/users/self`) {
37+
} else if (url === `${STAGING_API_URL}/users?profile=true`) {
3838
// When we encounter the respective api call we respond with the below response
3939
interceptedRequest.respond({
4040
status: 200,

admin-panel/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const loading = document.getElementById('loading');
55
const selectElement = document.getElementById('select-tags');
66
(async function setAuth() {
77
try {
8-
const res = await fetch(`${API_BASE_URL}/users/self`, {
8+
const res = await fetch(`${API_BASE_URL}/users?profile=true`, {
99
method: 'GET',
1010
credentials: 'include',
1111
headers: {

applications/style.css

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,8 @@ body {
298298
.application-card .user-info {
299299
display: flex;
300300
flex-direction: column;
301-
gap: 5px;
301+
align-items: flex-start;
302+
gap: 8px;
302303
}
303304

304305
.application-card .user-info * {
@@ -309,7 +310,6 @@ body {
309310
color: var(--black-color);
310311
font-size: 20px;
311312
font-style: normal;
312-
313313
font-weight: 700;
314314
line-height: normal;
315315
padding-bottom: 8px;
@@ -320,13 +320,15 @@ body {
320320
font-size: 14px;
321321
font-weight: 600;
322322
line-height: normal;
323+
max-width: 750px;
323324
}
324325

325326
.application-card .user-info .skills {
326327
color: var(--color-gray);
327328
font-size: 13px;
328329
font-weight: 600;
329330
line-height: normal;
331+
max-width: 750px;
330332
}
331333

332334
.hide-overflow {
@@ -350,6 +352,7 @@ body {
350352
font-size: 16px;
351353
padding: 6px 16px;
352354
margin-left: auto;
355+
margin-top: 5%;
353356
font-weight: 700;
354357
line-height: normal;
355358
cursor: pointer;
@@ -383,6 +386,7 @@ body {
383386
height: 90vh;
384387
max-width: 600px;
385388
overflow-y: hidden;
389+
z-index: 1;
386390
display: flex;
387391
flex-direction: column;
388392
position: fixed;
@@ -666,4 +670,12 @@ body {
666670
.application-card {
667671
width: 90%;
668672
}
673+
674+
.application-card .user-info .skills {
675+
max-width: 100%;
676+
}
677+
678+
.application-card .user-info .company-name {
679+
max-width: 100%;
680+
}
669681
}

0 commit comments

Comments
 (0)