From 796d791ca022a78019992b467b5a71a181ba2ccf Mon Sep 17 00:00:00 2001 From: Dikshant Wavhule <122555738+Dikshantw@users.noreply.github.com> Date: Tue, 8 Oct 2024 23:48:51 +0530 Subject: [PATCH 1/4] Shows index on pending application cards (#850) * shows index on pending applications * added data test-id to applications * removed logs --- __tests__/applications/applications.test.js | 23 +++++++++ applications/script.js | 55 +++++++++++++++++---- applications/style.css | 13 +++++ 3 files changed, 82 insertions(+), 9 deletions(-) diff --git a/__tests__/applications/applications.test.js b/__tests__/applications/applications.test.js index addd1d1b..a8ead04f 100644 --- a/__tests__/applications/applications.test.js +++ b/__tests__/applications/applications.test.js @@ -103,6 +103,23 @@ describe('Applications page', () => { 'Access-Control-Allow-Headers': 'Content-Type, Authorization', }, }); + } else if ( + request.url() === + `${API_BASE_URL}/applications?size=6&status=pending&dev=true` + ) { + request.respond({ + status: 200, + contentType: 'application/json', + body: JSON.stringify({ + applications: acceptedApplications, + totalCount: acceptedApplications.length, + }), + headers: { + 'Access-Control-Allow-Origin': '*', + 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS', + 'Access-Control-Allow-Headers': 'Content-Type, Authorization', + }, + }); } else { request.continue(); } @@ -129,6 +146,12 @@ describe('Applications page', () => { expect(applicationCards.length).toBe(6); }); + it('should render the index of pending applications under dev flag === true', async function () { + await page.goto(`${SITE_URL}/applications?dev=true&status=pending`); + const indexOfApplication = await page.$$('[data-testid="user-index"]'); + expect(indexOfApplication).toBeTruthy(); + }); + it('should render the initial UI elements under dev flag === true', async function () { await page.goto(`${SITE_URL}/applications?dev=true`); const title = await page.$('.header h1'); diff --git a/applications/script.js b/applications/script.js index c483235c..e6e11ffa 100644 --- a/applications/script.js +++ b/applications/script.js @@ -8,6 +8,8 @@ import { } from './utils.js'; let nextLink; let isDataLoading = false; +let totalApplicationCount = 0; +let currentApplicationIndex = 0; const loader = document.querySelector('.loader'); const filterModal = document.querySelector('.filter-modal'); const backDrop = document.querySelector('.backdrop'); @@ -38,6 +40,7 @@ const applicationDetailsActionsContainer = document.querySelector( ); const urlParams = new URLSearchParams(window.location.search); const isDev = urlParams.get('dev') === 'true'; +let isApplicationPending = urlParams.get('status') === 'pending'; const filterButton = isDev ? document.getElementById('filter-button-new') : document.getElementById('filter-button'); @@ -100,6 +103,7 @@ function changeFilter() { } else { totalCountElement.classList.add('hidden'); status = 'all'; + totalApplicationCount = 0; } applicationContainer.innerHTML = ''; } @@ -297,7 +301,7 @@ function removeQueryParamInUrl(queryParamKey) { window.history.replaceState(window.history.state, '', updatedUrl); } -function createApplicationCard({ application, dev }) { +function createApplicationCard({ application, dev, index }) { const applicationCard = createElement({ type: 'div', attributes: { class: 'application-card' }, @@ -314,6 +318,29 @@ function createApplicationCard({ application, dev }) { innerText: application.biodata.firstName, }); + if (dev && isApplicationPending) { + const usernameTextAndIndex = createElement({ + type: 'div', + attributes: { class: 'user-text-index' }, + }); + + const userIndex = createElement({ + type: 'input', + attributes: { + type: 'number', + value: `${index}`, + readonly: '', + class: 'user-index', + 'data-testid': 'user-index', + }, + }); + usernameTextAndIndex.appendChild(usernameText); + usernameTextAndIndex.appendChild(userIndex); + userInfoContainer.appendChild(usernameTextAndIndex); + } else { + userInfoContainer.appendChild(usernameText); + } + const companyNameText = createElement({ type: 'p', attributes: { class: 'company-name hide-overflow' }, @@ -326,7 +353,6 @@ function createApplicationCard({ application, dev }) { innerText: `Skills: ${application.professional.skills}`, }); - userInfoContainer.appendChild(usernameText); userInfoContainer.appendChild(companyNameText); userInfoContainer.appendChild(skillsText); @@ -382,7 +408,10 @@ async function renderApplicationCards(next, status, isInitialRender, dev) { changeLoaderVisibility({ hide: true }); const applications = data.applications; const totalSelectedCount = data.totalCount; - + if (isInitialRender) { + totalApplicationCount = data.totalCount; + currentApplicationIndex = totalApplicationCount; + } nextLink = data.next; if (isDev && status != 'all') { showAppliedFilter(status); @@ -394,12 +423,19 @@ async function renderApplicationCards(next, status, isInitialRender, dev) { } if (!applications.length) return noApplicationFoundText.classList.remove('hidden'); - applications.forEach((application) => { + + if (isInitialRender || !next) { + applicationContainer.innerHTML = ''; + currentApplicationIndex = totalSelectedCount; + } + applications.forEach((application, index) => { const applicationCard = createApplicationCard({ application, dev, + index: currentApplicationIndex, }); applicationContainer.appendChild(applicationCard); + currentApplicationIndex--; }); } @@ -448,7 +484,8 @@ async function renderApplicationById(id) { if (applicationId) { await renderApplicationById(applicationId); } - + totalApplicationCount = 0; + currentApplicationIndex = 0; if (isDev) { await renderApplicationCards('', status, true, isDev); } else { @@ -467,7 +504,7 @@ const intersectionObserver = new IntersectionObserver(async (entries) => { if (entries[0].isIntersecting && !isDataLoading) { const dev = urlParams.get('dev'); if (dev) { - await renderApplicationCards(nextLink, status, true, dev); + await renderApplicationCards(nextLink, status, false, dev); } else { await renderApplicationCards(nextLink); } @@ -514,7 +551,7 @@ if (isDev) { const dev = urlParams.get('dev'); if (dev) { - renderApplicationCards(nextLink, status, false, dev); + renderApplicationCards(nextLink, status, true, dev); } else { renderApplicationCards(nextLink, status); } @@ -539,7 +576,7 @@ function applyFilter(filter, isDev) { addQueryParamInUrl('status', filter); changeFilter(); status = filter; - renderApplicationCards(nextLink, status, false, isDev); + renderApplicationCards('', status, false, isDev); filterDropdown.style.display = 'none'; } } @@ -550,7 +587,7 @@ filterRemove.addEventListener('click', () => { removeQueryParamInUrl('status'); changeFilter(); const dev = urlParams.get('dev'); - renderApplicationCards(nextLink, status, false, dev); + renderApplicationCards(nextLink, status, true, dev); }); backDrop.addEventListener('click', () => { diff --git a/applications/style.css b/applications/style.css index 6576f74c..33f8bc66 100644 --- a/applications/style.css +++ b/applications/style.css @@ -17,6 +17,19 @@ --color-red-variant1: #f43030; } +.user-text-index { + display: flex; + justify-content: space-between; +} + +.user-index { + width: 60px; + border: none; + font-style: normal; + font-size: 20px; + font-weight: 700; +} + body { font-family: 'Roboto', sans-serif; margin: 0; From d004a792eed90d4dc1964fa02c44cfa19918b33e Mon Sep 17 00:00:00 2001 From: Nawal Rai Chetan <152277551+PunditWhoCodes@users.noreply.github.com> Date: Thu, 10 Oct 2024 00:11:19 +0500 Subject: [PATCH 2/4] Fixed indexing of rendering list (#881) * changed port number from 5500 to 8000 * Disabled forced spaces for sublists * changed port number to 5500 --- task-requests/details/script.js | 1 + 1 file changed, 1 insertion(+) diff --git a/task-requests/details/script.js b/task-requests/details/script.js index 413ae81b..acab0c50 100644 --- a/task-requests/details/script.js +++ b/task-requests/details/script.js @@ -312,6 +312,7 @@ const renderGithubIssue = async () => { simplifiedAutoLink: true, ghCodeBlocks: true, openLinksInNewWindow: true, + disableForced4SpacesIndentedSublists: true, }); let res = await fetch(taskRequest?.externalIssueUrl); res = await res.json(); From 8fd162140980650efb64968326052bc2a090b8c7 Mon Sep 17 00:00:00 2001 From: Sameer Supe <65391345+Mir-SA@users.noreply.github.com> Date: Fri, 11 Oct 2024 21:08:15 +0530 Subject: [PATCH 3/4] fix online-members page task section (#878) changed tasks container details --- online-members/online-members.css | 2 +- online-members/script.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/online-members/online-members.css b/online-members/online-members.css index 14f693c4..e8075fe9 100644 --- a/online-members/online-members.css +++ b/online-members/online-members.css @@ -13,7 +13,7 @@ } .task-container { - overflow: scroll; + overflow: auto; display: none; padding-top: 10px; max-height: 85vh; diff --git a/online-members/script.js b/online-members/script.js index 8b9c861b..824e5577 100644 --- a/online-members/script.js +++ b/online-members/script.js @@ -142,7 +142,7 @@ async function generateUserTaskData(username) { return; } - showLoadingSpinner(`${TASKS_CONTAINER_ID}`); + showLoadingSpinner(`#${TASKS_CONTAINER_ID}`); isTaskDataBeingFetched = true; From fa3eb23357938bbeffa17662adaf2e3be48af54b Mon Sep 17 00:00:00 2001 From: Vinit khandal <111434418+vinit717@users.noreply.github.com> Date: Tue, 15 Oct 2024 01:26:10 +0530 Subject: [PATCH 4/4] fix failing tests over Github action (#889) * chore: fix test workflow file * chore: add comment for verify * chore: fix failing test --- .github/workflows/tests.yml | 16 ++++++++++++---- .../extension-requests.test.js | 3 +-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c1f81860..20a59420 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,10 +4,18 @@ on: branches: [main, develop] push: branches: [main, develop] + jobs: - Lint-Check: + test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - run: yarn - - run: yarn test + - uses: actions/checkout@v2 + + - name: Install system dependencies + run: | + echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns + - name: Install project dependencies + run: yarn install + + - name: Run tests + run: yarn test \ No newline at end of file diff --git a/__tests__/extension-requests/extension-requests.test.js b/__tests__/extension-requests/extension-requests.test.js index e09a893b..b9ffc5a2 100644 --- a/__tests__/extension-requests/extension-requests.test.js +++ b/__tests__/extension-requests/extension-requests.test.js @@ -633,10 +633,9 @@ describe('Tests the Extension Requests Screen', () => { break; } } - await page.waitForTimeout(1650); + await page.waitForTimeout(2000); const extensionCardsAfter = await page.$$('.extension-card'); - const cardCount = extensionCardsAfter.length; expect(cardCount === 3 || cardCount === 7).toBe(true); });