Skip to content

Commit

Permalink
chore: fix pupeteer errors and update version
Browse files Browse the repository at this point in the history
  • Loading branch information
vinit717 committed Oct 13, 2024
1 parent c72d183 commit 8234191
Show file tree
Hide file tree
Showing 10 changed files with 217 additions and 102 deletions.
2 changes: 1 addition & 1 deletion __tests__/extension-requests/extension-requests.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ describe('Tests the Extension Requests Screen', () => {

await element.hover();

await page.waitForTimeout(500);
await setTimeout(5000);
const isTooltipVisible = await page.evaluate(() => {
const tooltip = document.querySelector('.tooltip');
const style = window.getComputedStyle(tooltip);
Expand Down
5 changes: 3 additions & 2 deletions __tests__/home/home.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const puppeteer = require('puppeteer');
const { superUserData } = require('../../mock-data/users');
const setTimeout = require('node:timers/promises').setTimeout;

describe('Home Page', () => {
let browser;
Expand Down Expand Up @@ -447,7 +448,7 @@ describe('Home Page', () => {
},
];

await page.waitForTimeout(1500);
await setTimeout(5000);

const userName = await page.$eval(
'#user-name',
Expand Down Expand Up @@ -541,7 +542,7 @@ describe('Home Page', () => {

const hamIcon = await page.$('.hamburger');
expect(hamIcon).toBeTruthy();
await hamIcon.click();
await hamIcon.evaluate((h) => h.click());

await page.waitForSelector('.links');

Expand Down
7 changes: 4 additions & 3 deletions __tests__/standup/standup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const puppeteer = require('puppeteer');
const API_BASE_URL = 'https://staging-api.realdevsquad.com';
const { user } = require('../../mock-data/users');
const { standup } = require('../../mock-data/standup');
const setTimeout = require('node:timers/promises').setTimeout;

const oneDay = 24 * 60 * 60 * 1000;
const numberOfMonthsAgo = 3;
Expand Down Expand Up @@ -118,7 +119,7 @@ describe('Standup Page', () => {
await userInput.press('Backspace');
await userInput.type('sunny');
await searchButton.click();
await page.waitForTimeout(1000);
await setTimeout(1000);
const updatedUrl = page.url();
expect(updatedUrl).toContain('q=user:sunny');
});
Expand All @@ -130,7 +131,7 @@ describe('Standup Page', () => {
await userInput.press('Backspace');
await userInput.type('sunny,pratiyush');
await searchButton.click();
await page.waitForTimeout(1000);
await setTimeout(1000);
const updatedUrl = page.url();
expect(updatedUrl).toContain('q=user:sunny+user:pratiyush');
});
Expand All @@ -142,7 +143,7 @@ describe('Standup Page', () => {
await userInput.press('Backspace');
await userInput.type('sunny,sunny,pratiyush');
await searchButton.click();
await page.waitForTimeout(1000);
await setTimeout(1000);
const updatedUrl = page.url();
expect(updatedUrl).toContain('q=user:sunny+user:pratiyush');
});
Expand Down
5 changes: 3 additions & 2 deletions __tests__/tasks/profile-picture.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const puppeteer = require('puppeteer');
const { allUsersData } = require('../../mock-data/users');
const API_BASE_URL = 'https://api.realdevsquad.com';
const setTimeout = require('node:timers/promises').setTimeout;

describe('Task Page - Assignee Profile Pic', () => {
let browser;
Expand Down Expand Up @@ -61,7 +62,7 @@ describe('Task Page - Assignee Profile Pic', () => {

await page.waitForSelector('#suggested-users-container');

await page.waitForTimeout(2000);
await setTimeout(2000);
const imgSrc = await page.$eval('#list-items img', (img) => img.src);
const expectedImageFilename =
'https://res.cloudinary.com/realdevsquad/image/upload/v1679878917/profile/54vObOfoscwiIVNMSqnN/askdcanhcehukqrdugge.jpg';
Expand All @@ -81,7 +82,7 @@ describe('Task Page - Assignee Profile Pic', () => {
}

await page.waitForSelector('#suggested-users-container');
await page.waitForTimeout(2000);
await setTimeout(2000);

const imgSrc = await page.$eval('#list-items img', (img) => img.src);
const expectedImageFilename = 'No-profile-pic.jpg';
Expand Down
5 changes: 3 additions & 2 deletions __tests__/user-details/Intro-button.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const puppeteer = require('puppeteer');
const { userDetails } = require('../../mock-data/user-details/index');
const setTimeout = require('node:timers/promises').setTimeout;

describe('Intro User Button Users Detail Page', () => {
let browser;
Expand Down Expand Up @@ -55,7 +56,7 @@ describe('Intro User Button Users Detail Page', () => {
expect(button).toBeTruthy();

await button.hover();
await page.waitForTimeout(500);
await setTimeout(5000);

const tooltipElement = await page.$('.tooltip');
expect(tooltipElement).toBeTruthy();
Expand All @@ -68,7 +69,7 @@ describe('Intro User Button Users Detail Page', () => {
);

await page.mouse.move(0, 0);
await page.waitForTimeout(500);
await setTimeout(5000);

const updatedTooltipElement = await page.$('.tooltip');
expect(updatedTooltipElement).toBeFalsy();
Expand Down
7 changes: 4 additions & 3 deletions __tests__/user-details/task-duedate-hover.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const {
const {
superUserDetails,
} = require('../../mock-data/tasks-card-date-time-end-date-self/index'); // has super user info
const setTimeout = require('node:timers/promises').setTimeout;

describe('Tasks On User Management Page', () => {
let browser;
Expand Down Expand Up @@ -127,7 +128,7 @@ describe('Tasks On User Management Page', () => {

await taskDiv.click();

await page.waitForTimeout(500);
await setTimeout(5000);
});

it('should select and interact with text elements', async () => {
Expand All @@ -151,7 +152,7 @@ describe('Tasks On User Management Page', () => {
await page.waitForTimeout(200); //waiting for a moment to check changes(very helpful when you turn headless into false), please increase value to 2000 or above to see clear changes
}

await page.waitForTimeout(500); //waiting for a moment to check changes(very helpful when you turn headless into false)
await setTimeout(5000); //waiting for a moment to check changes(very helpful when you turn headless into false)
});

it('should interact with hover elements', async () => {
Expand All @@ -177,7 +178,7 @@ describe('Tasks On User Management Page', () => {
await page.waitForTimeout(200); //waiting for a moment to check changes(very helpful when you turn headless into false), please increase value to 2000 or above to see clear changes
}

await page.waitForTimeout(500); //waiting for a moment to check changes(very helpful when you turn headless into false)
await setTimeout(5000); //waiting for a moment to check changes(very helpful when you turn headless into false)
});

it('Scroll of task should work', async () => {
Expand Down
27 changes: 14 additions & 13 deletions __tests__/users/onboarding-31-days-multiple-selections.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const puppeteer = require('puppeteer');
const { superUserDetails } = require('../../mock-data/users/mockdata');
const setTimeout = require('node:timers/promises').setTimeout;

describe('Tests the "Onboarding > 31 Days" Filter', () => {
let browser;
Expand Down Expand Up @@ -63,7 +64,7 @@ describe('Tests the "Onboarding > 31 Days" Filter', () => {

await taskDiv.click();

await page.waitForTimeout(2000);
await setTimeout(2000);
const elements = await page.$$('.checkbox-label');

// Checking if elements are found
Expand All @@ -76,26 +77,26 @@ describe('Tests the "Onboarding > 31 Days" Filter', () => {
expect(applyfilterbutton).toBeTruthy();
await applyfilterbutton.click();

await page.waitForTimeout(500);
await setTimeout(5000);
});
it('should gives results for ACTIVE SELECTED', async () => {
const taskDiv = await page.$('.filter-button');
expect(taskDiv).toBeTruthy();

await taskDiv.click();

// await page.waitForTimeout(2000); enable to see the tests in actions
//await setTimeout(2000); enable to see the tests in actions
const elements = await page.$$('.checkbox-label');

const clear = await page.$('#clear-button');
await clear.click();
await clear.evaluate((b) => b.click());

// await page.waitForTimeout(2000); enable to see the tests in actions
//await setTimeout(2000); enable to see the tests in actions

const taskDiv2 = await page.$('.filter-button');
await taskDiv2.click();
expect(taskDiv2).toBeTruthy();
// await page.waitForTimeout(2000); enable to see the tests in actions
//await setTimeout(2000); enable to see the tests in actions
expect(elements).toBeTruthy();

const checkbox = await page.$('#ACTIVE');
Expand All @@ -105,7 +106,7 @@ describe('Tests the "Onboarding > 31 Days" Filter', () => {
expect(applyfilterbutton).toBeTruthy();
await applyfilterbutton.click();

await page.waitForTimeout(500);
await setTimeout(5000);
});

it('should gives results for both ACTIVE & Onboarding > 31 SELECTED', async () => {
Expand All @@ -114,7 +115,7 @@ describe('Tests the "Onboarding > 31 Days" Filter', () => {

await taskDiv.click();

// await page.waitForTimeout(2000); enable to see the tests in actions
//await setTimeout(2000); enable to see the tests in actions
const elements = await page.$$('.checkbox-label');

// Checking if elements are found
Expand All @@ -123,22 +124,22 @@ describe('Tests the "Onboarding > 31 Days" Filter', () => {
const clear = await page.$('#clear-button');
await clear.click();

// await page.waitForTimeout(2000); enable to see the tests in actions
//await setTimeout(2000); enable to see the tests in actions

const taskDiv2 = await page.$('.filter-button');
await taskDiv2.click();
expect(taskDiv2).toBeTruthy();
// await page.waitForTimeout(2000); enable to see the tests in actions
//await setTimeout(2000); enable to see the tests in actions
const checkbox = await page.$('#ONBOARDING31DAYS');
await checkbox.click();
// await page.waitForTimeout(2000); enable to see the tests in actions
//await setTimeout(2000); enable to see the tests in actions
const checkbox2 = await page.$('#ACTIVE');
await checkbox2.click();
// await page.waitForTimeout(2000); enable to see the tests in actions
//await setTimeout(2000); enable to see the tests in actions
const applyfilterbutton = await page.$('.apply-filter-button');
expect(applyfilterbutton).toBeTruthy();
await applyfilterbutton.click();

await page.waitForTimeout(500);
await setTimeout(5000);
});
});
4 changes: 2 additions & 2 deletions __tests__/users/onboarding31days.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('Tests the "Onboarding > 31 Days" Filter', () => {

await taskDiv.click();

await page.waitForTimeout(2000);
await setTimeout(2000);
const elements = await page.$$('.checkbox-label');

// Checking if elements are found
Expand All @@ -76,6 +76,6 @@ describe('Tests the "Onboarding > 31 Days" Filter', () => {
expect(applyfilterbutton).toBeTruthy();
await applyfilterbutton.click();

await page.waitForTimeout(5000);
await setTimeout(5000);
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"homepage": "https://github.com/Real-Dev-Squad/website-dashboard#readme",
"devDependencies": {
"jest": "^29.5.0",
"jest-puppeteer": "^8.0.6",
"jest-puppeteer": "^10.1.2",
"jest-puppeteer-istanbul": "^0.5.3",
"jsdom": "^21.1.1",
"local-ssl-proxy": "^2.0.5",
Expand Down
Loading

0 comments on commit 8234191

Please sign in to comment.