Skip to content

Commit 5febd0c

Browse files
authored
Merge pull request #642 from Real-Dev-Squad/develop
Dev to main Sync
2 parents e347e36 + 4cee8ac commit 5febd0c

File tree

5 files changed

+480
-4
lines changed

5 files changed

+480
-4
lines changed

__tests__/taskRequests/taskRequestDetails.test.js

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,84 @@ describe('Task request details page', () => {
9696
expect(rejectButton).toBeTruthy();
9797
});
9898
});
99+
100+
describe('Task request details page with status creation', () => {
101+
let browser;
102+
let page;
103+
jest.setTimeout(60000);
104+
105+
beforeAll(async () => {
106+
browser = await puppeteer.launch({
107+
headless: 'new',
108+
ignoreHTTPSErrors: true,
109+
args: ['--incognito', '--disable-web-security'],
110+
devtools: false,
111+
});
112+
page = await browser.newPage();
113+
await page.setRequestInterception(true);
114+
page.on('request', (interceptedRequest) => {
115+
const url = interceptedRequest.url();
116+
if (urlMappings.hasOwnProperty(url)) {
117+
interceptedRequest.respond({
118+
...defaultMockResponseHeaders,
119+
body: JSON.stringify(urlMappings[url]),
120+
});
121+
} else {
122+
interceptedRequest.continue();
123+
}
124+
});
125+
await page.goto(
126+
'http://localhost:8000/taskRequests/details/?id=uC0IUpkFMx393XjnKx4w',
127+
);
128+
});
129+
130+
afterAll(async () => {
131+
await browser.close();
132+
});
133+
134+
it('Should render github issue', async () => {
135+
await page.waitForNetworkIdle();
136+
137+
const issue = await page.$('#task-details');
138+
const testId = await issue.evaluate((el) => el.innerHTML);
139+
140+
expect(testId).toContain(
141+
'When super_user try to update skills of new users the data of',
142+
);
143+
});
144+
it('Should render title of the issue', async () => {
145+
await page.waitForNetworkIdle();
146+
const issueTitle = await page.$('#issue_title');
147+
const title = await issueTitle.evaluate((el) => el.innerHTML);
148+
149+
expect(title).toBe(
150+
'Fix: user data is not showing up in memberSkillsUpdateModal',
151+
);
152+
});
153+
it('Should render author and time of the issue', async () => {
154+
await page.waitForNetworkIdle();
155+
const issueTimeAndAuthor = await page.$('#issue_time_author');
156+
const timeAndAuthor = await issueTimeAndAuthor.evaluate(
157+
(el) => el.innerHTML,
158+
);
159+
160+
expect(timeAndAuthor).toContain('Wed Sep 06 2023');
161+
expect(timeAndAuthor).toContain('anishpawaskar');
162+
});
163+
it('Should render assignee of the issue', async () => {
164+
await page.waitForNetworkIdle();
165+
const issueAssignee = await page.$('#issue_assignee');
166+
const assignee = await issueAssignee.evaluate((el) => el.innerHTML);
167+
168+
expect(assignee).toContain('anishpawaskar');
169+
});
170+
it('Should render link of the issue', async () => {
171+
await page.waitForNetworkIdle();
172+
const issueLink = await page.$('#issue_link');
173+
const link = await issueLink.evaluate((el) => el.innerHTML);
174+
175+
expect(link).toContain(
176+
'https://github.com/Real-Dev-Squad/members-site/issues/92',
177+
);
178+
});
179+
});

mock-data/taskRequests/index.js

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,175 @@ const individualTaskReqDetail = {
6464
},
6565
};
6666

67+
const taskDetailCreation = {
68+
message: 'Task request returned successfully',
69+
data: {
70+
createdAt: 1698090070313,
71+
lastModifiedAt: 1698090070313,
72+
requestType: 'CREATION',
73+
createdBy: 'ajeyak',
74+
requestors: ['eChYAP0kUwLo4wQ1gqMV'],
75+
lastModifiedBy: 'ajeyak',
76+
taskTitle: 'Fix: user data is not showing up in memberSkillsUpdateModal',
77+
externalIssueUrl:
78+
'https://api.github.com/repos/Real-Dev-Squad/members-site/issues/92',
79+
users: [
80+
{
81+
proposedStartDate: 1698089500541,
82+
proposedDeadline: 1698089500541,
83+
description: ' ',
84+
userId: 'eChYAP0kUwLo4wQ1gqMV',
85+
status: 'PENDING',
86+
},
87+
],
88+
status: 'PENDING',
89+
usersCount: 1,
90+
id: 'uC0IUpkFMx393XjnKx4w',
91+
url: 'https://realdevsquad.com/taskRequests/uC0IUpkFMx393XjnKx4w',
92+
},
93+
};
94+
95+
const githubIssue = {
96+
url: 'https://api.github.com/repos/Real-Dev-Squad/members-site/issues/92',
97+
repository_url: 'https://api.github.com/repos/Real-Dev-Squad/members-site',
98+
labels_url:
99+
'https://api.github.com/repos/Real-Dev-Squad/members-site/issues/92/labels{/name}',
100+
comments_url:
101+
'https://api.github.com/repos/Real-Dev-Squad/members-site/issues/92/comments',
102+
events_url:
103+
'https://api.github.com/repos/Real-Dev-Squad/members-site/issues/92/events',
104+
html_url: 'https://github.com/Real-Dev-Squad/members-site/issues/92',
105+
id: 1883898994,
106+
node_id: 'I_kwDOIe8XEs5wSgRy',
107+
number: 92,
108+
title: 'Fix: user data is not showing up in memberSkillsUpdateModal',
109+
user: {
110+
login: 'anishpawaskar',
111+
id: 22213872,
112+
node_id: 'MDQ6VXNlcjIyMjEzODcy',
113+
avatar_url: 'https://avatars.githubusercontent.com/u/22213872?v=4',
114+
gravatar_id: '',
115+
url: 'https://api.github.com/users/anishpawaskar',
116+
html_url: 'https://github.com/anishpawaskar',
117+
followers_url: 'https://api.github.com/users/anishpawaskar/followers',
118+
following_url:
119+
'https://api.github.com/users/anishpawaskar/following{/other_user}',
120+
gists_url: 'https://api.github.com/users/anishpawaskar/gists{/gist_id}',
121+
starred_url:
122+
'https://api.github.com/users/anishpawaskar/starred{/owner}{/repo}',
123+
subscriptions_url:
124+
'https://api.github.com/users/anishpawaskar/subscriptions',
125+
organizations_url: 'https://api.github.com/users/anishpawaskar/orgs',
126+
repos_url: 'https://api.github.com/users/anishpawaskar/repos',
127+
events_url: 'https://api.github.com/users/anishpawaskar/events{/privacy}',
128+
received_events_url:
129+
'https://api.github.com/users/anishpawaskar/received_events',
130+
type: 'User',
131+
site_admin: false,
132+
},
133+
labels: [],
134+
state: 'closed',
135+
locked: false,
136+
assignee: {
137+
login: 'anishpawaskar',
138+
id: 22213872,
139+
node_id: 'MDQ6VXNlcjIyMjEzODcy',
140+
avatar_url: 'https://avatars.githubusercontent.com/u/22213872?v=4',
141+
gravatar_id: '',
142+
url: 'https://api.github.com/users/anishpawaskar',
143+
html_url: 'https://github.com/anishpawaskar',
144+
followers_url: 'https://api.github.com/users/anishpawaskar/followers',
145+
following_url:
146+
'https://api.github.com/users/anishpawaskar/following{/other_user}',
147+
gists_url: 'https://api.github.com/users/anishpawaskar/gists{/gist_id}',
148+
starred_url:
149+
'https://api.github.com/users/anishpawaskar/starred{/owner}{/repo}',
150+
subscriptions_url:
151+
'https://api.github.com/users/anishpawaskar/subscriptions',
152+
organizations_url: 'https://api.github.com/users/anishpawaskar/orgs',
153+
repos_url: 'https://api.github.com/users/anishpawaskar/repos',
154+
events_url: 'https://api.github.com/users/anishpawaskar/events{/privacy}',
155+
received_events_url:
156+
'https://api.github.com/users/anishpawaskar/received_events',
157+
type: 'User',
158+
site_admin: false,
159+
},
160+
assignees: [
161+
{
162+
login: 'anishpawaskar',
163+
id: 22213872,
164+
node_id: 'MDQ6VXNlcjIyMjEzODcy',
165+
avatar_url: 'https://avatars.githubusercontent.com/u/22213872?v=4',
166+
gravatar_id: '',
167+
url: 'https://api.github.com/users/anishpawaskar',
168+
html_url: 'https://github.com/anishpawaskar',
169+
followers_url: 'https://api.github.com/users/anishpawaskar/followers',
170+
following_url:
171+
'https://api.github.com/users/anishpawaskar/following{/other_user}',
172+
gists_url: 'https://api.github.com/users/anishpawaskar/gists{/gist_id}',
173+
starred_url:
174+
'https://api.github.com/users/anishpawaskar/starred{/owner}{/repo}',
175+
subscriptions_url:
176+
'https://api.github.com/users/anishpawaskar/subscriptions',
177+
organizations_url: 'https://api.github.com/users/anishpawaskar/orgs',
178+
repos_url: 'https://api.github.com/users/anishpawaskar/repos',
179+
events_url: 'https://api.github.com/users/anishpawaskar/events{/privacy}',
180+
received_events_url:
181+
'https://api.github.com/users/anishpawaskar/received_events',
182+
type: 'User',
183+
site_admin: false,
184+
},
185+
],
186+
milestone: null,
187+
comments: 0,
188+
created_at: '2023-09-06T12:21:37Z',
189+
updated_at: '2023-11-08T19:02:33Z',
190+
closed_at: '2023-11-08T19:02:33Z',
191+
author_association: 'CONTRIBUTOR',
192+
active_lock_reason: null,
193+
body: "- When super_user try to update skills of new users the data of user is not being passed that's why in memberSkillsUpdateModal it is showing undefined and undefined instead of showing firstname and lastname of user.\r\n\r\n![Real Dev Squad - Google Chrome 06-09-2023 17_47_05](https://github.com/Real-Dev-Squad/members-site/assets/22213872/2f89448e-94e4-4290-8ba3-45bc147f31cc)\r\n",
194+
closed_by: {
195+
login: 'anishpawaskar',
196+
id: 22213872,
197+
node_id: 'MDQ6VXNlcjIyMjEzODcy',
198+
avatar_url: 'https://avatars.githubusercontent.com/u/22213872?v=4',
199+
gravatar_id: '',
200+
url: 'https://api.github.com/users/anishpawaskar',
201+
html_url: 'https://github.com/anishpawaskar',
202+
followers_url: 'https://api.github.com/users/anishpawaskar/followers',
203+
following_url:
204+
'https://api.github.com/users/anishpawaskar/following{/other_user}',
205+
gists_url: 'https://api.github.com/users/anishpawaskar/gists{/gist_id}',
206+
starred_url:
207+
'https://api.github.com/users/anishpawaskar/starred{/owner}{/repo}',
208+
subscriptions_url:
209+
'https://api.github.com/users/anishpawaskar/subscriptions',
210+
organizations_url: 'https://api.github.com/users/anishpawaskar/orgs',
211+
repos_url: 'https://api.github.com/users/anishpawaskar/repos',
212+
events_url: 'https://api.github.com/users/anishpawaskar/events{/privacy}',
213+
received_events_url:
214+
'https://api.github.com/users/anishpawaskar/received_events',
215+
type: 'User',
216+
site_admin: false,
217+
},
218+
reactions: {
219+
url: 'https://api.github.com/repos/Real-Dev-Squad/members-site/issues/92/reactions',
220+
total_count: 0,
221+
'+1': 0,
222+
'-1': 0,
223+
laugh: 0,
224+
hooray: 0,
225+
confused: 0,
226+
heart: 0,
227+
rocket: 0,
228+
eyes: 0,
229+
},
230+
timeline_url:
231+
'https://api.github.com/repos/Real-Dev-Squad/members-site/issues/92/timeline',
232+
performed_via_github_app: null,
233+
state_reason: 'completed',
234+
};
235+
67236
const individualTaskDetail = {
68237
message: 'task returned successfully',
69238
taskData: {
@@ -80,6 +249,35 @@ const individualTaskDetail = {
80249
dependsOn: [],
81250
},
82251
};
252+
const userInformationTaskCreation = {
253+
message: 'User returned successfully!',
254+
user: {
255+
id: 'eChYAP0kUwLo4wQ1gqMV',
256+
incompleteUserDetails: false,
257+
website: 'www.',
258+
discordId: '1095941231403597854',
259+
last_name: 'asdfasdfsd',
260+
linkedin_id: 'afds',
261+
created_at: 1697215478406,
262+
yoe: 100,
263+
instagram_id: 'sdaf',
264+
github_created_at: 1694358348000,
265+
github_display_name: null,
266+
github_id: 'Aryex82',
267+
company: 'Rebel base',
268+
designation: 'adsf',
269+
twitter_id: 'ajeya900',
270+
first_name: 'ajeya',
271+
username: 'ajeyak',
272+
updated_at: 1701555788092,
273+
roles: {
274+
archived: false,
275+
in_discord: true,
276+
member: false,
277+
super_user: true,
278+
},
279+
},
280+
};
83281

84282
const userInformation = {
85283
message: 'User returned successfully!',
@@ -145,6 +343,12 @@ const urlMappings = {
145343
fetchedTaskRequests,
146344
'https://api.realdevsquad.com/taskRequests?action=reject':
147345
fetchedTaskRequests,
346+
'https://staging-api.realdevsquad.com/users/userId/eChYAP0kUwLo4wQ1gqMV':
347+
userInformationTaskCreation,
348+
'https://staging-api.realdevsquad.com/taskRequests/uC0IUpkFMx393XjnKx4w':
349+
taskDetailCreation,
350+
'https://api.github.com/repos/Real-Dev-Squad/members-site/issues/92':
351+
githubIssue,
148352
};
149353

150354
module.exports = {

taskRequests/details/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
<script src="/taskRequests/constants.js"></script>
2020
<script src="/utils/time/index.js"></script>
2121
<script src="/taskRequests/details/script.js" defer></script>
22+
<script
23+
src="https://cdnjs.cloudflare.com/ajax/libs/showdown/2.1.0/showdown.min.js"
24+
integrity="sha512-LhccdVNGe2QMEfI3x4DVV3ckMRe36TfydKss6mJpdHjNFiV07dFpS2xzeZedptKZrwxfICJpez09iNioiSZ3hA=="
25+
crossorigin="anonymous"
26+
referrerpolicy="no-referrer"
27+
></script>
2228
</head>
2329
<body>
2430
<div class="header">

0 commit comments

Comments
 (0)