Skip to content

Commit 0e2bcb0

Browse files
authored
Merge pull request #690 from Real-Dev-Squad/develop
Dev to main Sync
2 parents e809740 + 2274bb4 commit 0e2bcb0

File tree

23 files changed

+97
-97
lines changed

23 files changed

+97
-97
lines changed

__tests__/extension-requests/extension-requests.test.js

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ describe('Tests the Extension Requests Screen', () => {
305305
});
306306
} else if (
307307
url ===
308-
'https://api.realdevsquad.com/logs/extensionRequests/?meta.extensionRequestId=fuQs71a0Y7BX3n4rc5Ii&dev=true'
308+
'https://api.realdevsquad.com/logs/extensionRequests/?meta.extensionRequestId=fuQs71a0Y7BX3n4rc5Ii'
309309
) {
310310
interceptedRequest.respond({
311311
status: 200,
@@ -319,7 +319,7 @@ describe('Tests the Extension Requests Screen', () => {
319319
});
320320
} else if (
321321
url ===
322-
'https://api.realdevsquad.com/extension-requests/fuQs71a0Y7BX3n4rc5Ii?dev=true'
322+
'https://api.realdevsquad.com/extension-requests/fuQs71a0Y7BX3n4rc5Ii'
323323
) {
324324
interceptedRequest.respond({
325325
status: 200,
@@ -332,7 +332,7 @@ describe('Tests the Extension Requests Screen', () => {
332332
});
333333
} else if (
334334
url ===
335-
'https://api.realdevsquad.com/logs/extensionRequests/?meta.extensionRequestId=lw7dRB0I3a6ivsFR5Izs&dev=true'
335+
'https://api.realdevsquad.com/logs/extensionRequests/?meta.extensionRequestId=lw7dRB0I3a6ivsFR5Izs'
336336
) {
337337
interceptedRequest.respond({
338338
status: 200,
@@ -771,54 +771,37 @@ describe('Tests the Extension Requests Screen', () => {
771771
expect(isTooltipVisible).toBe(true);
772772
});
773773
it('Validating audit logs for extension request', async () => {
774-
// Visit extension request under dev flag
775-
await page.goto('http://localhost:8000/extension-requests/?dev=true');
774+
await page.goto('http://localhost:8000/extension-requests');
776775
const extensionRequestIds = [
777776
'log-container-fuQs71a0Y7BX3n4rc5Ii',
778777
'log-container-lw7dRB0I3a6ivsFR5Izs',
779778
];
780779

781-
// Select all types of status of extension requests
782780
await page.click('#filter-button');
783781
await page.click('input[value="APPROVED"]');
784782
await page.click('input[value="DENIED"]');
785783
await page.click('#apply-filter-button');
786784
await page.waitForNetworkIdle();
787785

788-
// Checking if both the extension request cards are renedered or not
789786
const cardsList = await page.$$('.extension-card');
790787
expect(cardsList.length).toBe(2);
791788

792789
const accordionButton = await page.$$('.accordion');
793-
// Validate first extension card which is based on updated logs
794790
accordionButton[0].click();
795791
await page.waitForNetworkIdle();
796792
let extensionLogsForFirstER = await page.$(`#${extensionRequestIds[0]}`);
797793
let logs = await extensionLogsForFirstER.$$('.log-div');
798794
expect(Array.from(logs).length).toBe(6);
799-
// Array.from(logs).forEach(async (log) => {
800-
// const innerText = await log.evaluate((element) => element.innerText);
801-
// expect(extensionRequestLogsInSentence[extensionRequestIds[0]]).toContain(
802-
// innerText,
803-
// );
804-
// });
805-
806-
// Validating if it is backward compatible or not
795+
807796
accordionButton[1].click();
808797
await page.waitForNetworkIdle();
809798
extensionLogsForFirstER = await page.$(`#${extensionRequestIds[1]}`);
810799
logs = await extensionLogsForFirstER.$$('.log-div');
811800
expect(Array.from(logs).length).toBe(1);
812-
// Array.from(logs).forEach(async (log) => {
813-
// const innerText = await log.evaluate((element) => element.innerText);
814-
// expect(extensionRequestLogsInSentence[extensionRequestIds[1]]).toContain(
815-
// innerText,
816-
// );
817-
// });
818801
});
819802

820803
test('Checks the Request Number and request value element on Extension requests listing page', async () => {
821-
const url = 'http://localhost:8000/extension-requests/?dev=true'; // Include the dev parameter in the URL
804+
const url = 'http://localhost:8000/extension-requests';
822805
await page.goto(url);
823806

824807
const extensionRequestNumberContainer = await page.$$(
@@ -834,7 +817,7 @@ describe('Tests the Extension Requests Screen', () => {
834817
});
835818

836819
test('Default Request Number to 1 if requestNumber field is missing in API Response', async () => {
837-
const url = 'http://localhost:8000/extension-requests/?dev=true'; // Include the dev parameter in the URL
820+
const url = 'http://localhost:8000/extension-requests';
838821
await page.goto(url);
839822

840823
const extensionRequestNumberContainer = await page.$$(
@@ -851,38 +834,32 @@ describe('Tests the Extension Requests Screen', () => {
851834
});
852835

853836
it('Validating if audit logs are being generated in realtime', async () => {
854-
// Visit extension request under dev flag
855-
await page.goto('http://localhost:8000/extension-requests/?dev=true');
837+
await page.goto('http://localhost:8000/extension-requests');
856838
const extensionRequestIds = [
857839
'log-container-fuQs71a0Y7BX3n4rc5Ii',
858840
'log-container-lw7dRB0I3a6ivsFR5Izs',
859841
];
860842

861-
// Select all types of status of extension requests
862843
await page.click('#filter-button');
863844
await page.click('input[value="APPROVED"]');
864845
await page.click('input[value="DENIED"]');
865846
await page.click('#apply-filter-button');
866847
await page.waitForNetworkIdle();
867848

868-
// Checking if both the extension request cards are renedered or not
869849
const cardsList = await page.$$('.extension-card');
870850
expect(cardsList.length).toBe(2);
871851

872852
const accordionButton = await page.$$('.accordion');
873-
// Validate first extension card which is based on updated logs
874853
accordionButton[0].click();
875854
await page.waitForNetworkIdle();
876855
let extensionLogsForFirstER = await page.$(`#${extensionRequestIds[0]}`);
877856
let logs = await extensionLogsForFirstER.$$('.log-div');
878857

879-
// Click the first element with class '.edit-button'
880858
await page.$$eval('.edit-button', (buttons) => buttons[0].click());
881859
const newTitle = 'This is a new title test case';
882860
const newDate = '2024-09-19';
883861
const newReason = 'This is the new reason';
884862

885-
// Updating all the input fields
886863
await page.$$eval(
887864
'.title-text-input',
888865
(inputFields, newTitle) => (inputFields[0].value = newTitle),

__tests__/home/home.test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,22 @@ describe('Home Page', () => {
494494
expect(latestSyncStatusText).not.toBe(`Last Sync: In progress`);
495495
});
496496

497+
it('should display Applications button', async () => {
498+
const applicationButton = await page.$('#application-button');
499+
expect(applicationButton).toBeTruthy();
500+
const applicationButtonHref = await page.evaluate(
501+
(el) => el.getAttribute('href'),
502+
applicationButton,
503+
);
504+
expect(applicationButtonHref).toBe('/applications');
505+
const applicationButtonText = await page.evaluate(
506+
(el) => el.innerText,
507+
applicationButton,
508+
);
509+
const trimmedApplicationButtonText = applicationButtonText.trim();
510+
expect(trimmedApplicationButtonText).toBe('Applications');
511+
});
512+
497513
it('should close hamburger menu on clicking anywhere on the screen except the menu', async () => {
498514
await page.setViewport({ width: 970, height: 1800 });
499515
await page.goto('http://localhost:8000/index.html');

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ const puppeteer = require('puppeteer');
33
const { fetchedTaskRequests } = require('../../mock-data/taskRequests');
44

55
const SITE_URL = 'http://localhost:8000';
6-
// helper/loadEnv.js file causes API_BASE_URL to be stagin-api on local env url in taskRequest/index.html
7-
const API_BASE_URL = 'https://staging-api.realdevsquad.com';
6+
const API_BASE_URL = 'https://api.realdevsquad.com';
87

98
describe('Task Requests', () => {
109
let browser;

__tests__/tasks/profile-picture.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const puppeteer = require('puppeteer');
2-
const API_BASE_URL = 'https://staging-api.realdevsquad.com';
32
const { allUsersData } = require('../../mock-data/users');
3+
const API_BASE_URL = 'https://api.realdevsquad.com';
44

55
describe('Task Page - Assignee Profile Pic', () => {
66
let browser;

__tests__/users/App.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const puppeteer = require('puppeteer');
2-
const { API_BASE_URL } = require('../../constants');
32
const { filteredUsersData } = require('../../mock-data/users');
3+
const API_BASE_URL = 'https://staging-api.realdevsquad.com';
44

55
describe('App Component', () => {
66
let browser;

applications/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ <h1>RDS Join Applications</h1>
2020

2121
<img
2222
class="funnel-icon"
23-
src="/taskRequests/assets/funnel.svg"
23+
src="/task-requests/assets/funnel.svg"
2424
alt="funnel icon"
2525
/>
2626
</button>

applications/script.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ function openApplicationDetails(application) {
8484
username: application.biodata.firstName,
8585
id: application.id,
8686
applicationDetails: [
87+
{
88+
title: 'Status',
89+
description: application.status,
90+
},
8791
{
8892
title: 'Introduction',
8993
description: application.intro.introduction,

applications/utils.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
const BASE_URL = window.API_BASE_URL;
1+
const BASE_URL =
2+
window.location.hostname === 'localhost'
3+
? 'https://staging-api.realdevsquad.com'
4+
: window.API_BASE_URL;
25
const toast = document.getElementById('toast');
36

47
function createElement({ type, attributes = {}, innerText }) {

constants.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
const API_BASE_URL = 'https://api.realdevsquad.com';
1+
const API_BASE_URL = window.API_BASE_URL || 'https://api.realdevsquad.com';
2+
('https://staging-sync.staging-realdevsquad-com.workers.dev');
23
const REPO_SYNC_API_URL =
34
'https://staging-sync.staging-realdevsquad-com.workers.dev';
45
const USER_MANAGEMENT_LINK = 'user-management-link';

extension-requests/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ <h2>Status</h2>
4343
<div class="extension-requests"></div>
4444
<div class="virtual"></div>
4545
</div>
46+
<script src="/helpers/loadENV.js"></script>
4647
<script src="/constants.js"></script>
4748
<script src="/extension-requests/constants.js"></script>
4849
<script src="/utils.js"></script>

0 commit comments

Comments
 (0)