generated from Real-Dev-Squad/website-template
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into add-onboard-option
- Loading branch information
Showing
3 changed files
with
193 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
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'); | ||
|
||
describe('Input box', () => { | ||
let browser; | ||
let page; | ||
jest.setTimeout(60000); | ||
|
||
beforeAll(async () => { | ||
browser = await puppeteer.launch({ | ||
headless: true, | ||
ignoreHTTPSErrors: true, | ||
args: ['--incognito', '--disable-web-security'], | ||
devtools: false, | ||
}); | ||
page = await browser.newPage(); | ||
|
||
await page.setRequestInterception(true); | ||
|
||
page.on('request', (interceptedRequest) => { | ||
const url = interceptedRequest.url(); | ||
|
||
if (url === `${API_BASE_URL}/users/sunny`) { | ||
interceptedRequest.respond({ | ||
status: 200, | ||
contentType: 'application/json', | ||
headers: { | ||
'Access-Control-Allow-Origin': '*', | ||
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS', | ||
'Access-Control-Allow-Headers': 'Content-Type, Authorization', | ||
}, | ||
body: JSON.stringify(user), | ||
}); | ||
} else if ( | ||
url === `${API_BASE_URL}/progresses?userId=YleviOe1SsOML8eitV9W` | ||
) { | ||
interceptedRequest.respond({ | ||
status: 200, | ||
contentType: 'application/json', | ||
headers: { | ||
'Access-Control-Allow-Origin': '*', | ||
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS', | ||
'Access-Control-Allow-Headers': 'Content-Type, Authorization', | ||
}, | ||
body: JSON.stringify(standup), | ||
}); | ||
} else { | ||
interceptedRequest.continue(); | ||
} | ||
}); | ||
await page.goto('http://localhost:8000/standup'); | ||
await page.waitForNetworkIdle(); | ||
}); | ||
|
||
afterAll(async () => { | ||
await browser.close(); | ||
}); | ||
|
||
it('should display the table when the search button is clicked', async () => { | ||
const userInput = await page.$('#user-search-input'); | ||
const searchButton = await page.$('#search-button'); | ||
|
||
await userInput.type('sunny'); | ||
await searchButton.click(); | ||
await page.waitForSelector('#table-container'); | ||
const table = await page.$('.user-standup-table'); | ||
expect(table).toBeTruthy(); | ||
}); | ||
|
||
it('should display the loader when the search button is clicked', async () => { | ||
const userInput = await page.$('#user-search-input'); | ||
const searchButton = await page.$('#search-button'); | ||
|
||
await userInput.type('sunny'); | ||
await searchButton.click(); | ||
await page.waitForSelector('#table-container'); | ||
const loader = await page.$('.loader'); | ||
expect(loader).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
const standupOne = { | ||
message: 'Progress document retrieved successfully.', | ||
count: 9, | ||
data: [ | ||
{ | ||
id: '8hhlqHacZ9iWo3rbWHku', | ||
date: 1685145600000, | ||
createdAt: 1685163538297, | ||
blockers: 'Implement error handling for API endpoints', | ||
completed: 'Implement error handling for API endpoints', | ||
planned: 'Implement error handling for API endpoints', | ||
type: 'user', | ||
userId: 'YleviOe1SsOML8eitV9W', | ||
}, | ||
{ | ||
id: 'ANaIkUInoUeAagwMsxHI', | ||
date: 1685836800000, | ||
createdAt: 1685892283432, | ||
blockers: 'Working on a backend Go project', | ||
completed: 'Working on a backend Go project', | ||
planned: 'Working on a backend Go project', | ||
type: 'user', | ||
userId: 'YleviOe1SsOML8eitV9W', | ||
}, | ||
{ | ||
id: 'KYvOM36StltlBNxtW9Mm', | ||
date: 1685577600000, | ||
createdAt: 1685616571070, | ||
blockers: 'Working on a backend Go project', | ||
completed: 'Working on a backend Go project', | ||
planned: 'Working on a backend Go project', | ||
type: 'user', | ||
userId: 'YleviOe1SsOML8eitV9W', | ||
}, | ||
{ | ||
id: 'T8GZ191H8lVTnGBB3tAQ', | ||
date: 1685318400000, | ||
createdAt: 1685374251104, | ||
blockers: 'Implement error handling for API endpoints', | ||
completed: 'Implement error handling for API endpoints', | ||
planned: 'Implement error handling for API endpoints', | ||
type: 'user', | ||
userId: 'YleviOe1SsOML8eitV9W', | ||
}, | ||
{ | ||
id: 'h3eK4lVB5PlOZXX9RFFP', | ||
date: 1685750400000, | ||
createdAt: 1685783692663, | ||
blockers: 'Working on a backend Go project', | ||
completed: 'Working on a backend Go project', | ||
planned: 'Working on a backend Go project', | ||
type: 'user', | ||
userId: 'YleviOe1SsOML8eitV9W', | ||
}, | ||
{ | ||
id: 'jng8Zlsjr90EuGbBQisG', | ||
date: 1685059200000, | ||
createdAt: 1685115243500, | ||
blockers: 'Working on a backend Go project', | ||
completed: 'Working on a backend Go project', | ||
planned: 'Working on a backend Go project', | ||
type: 'user', | ||
userId: 'YleviOe1SsOML8eitV9W', | ||
}, | ||
{ | ||
id: 'nFTXyHfbufj7XY2mguVX', | ||
date: 1685491200000, | ||
createdAt: 1685506497607, | ||
blockers: 'Implement error handling for API endpoints', | ||
completed: 'Implement error handling for API endpoints', | ||
planned: 'Implement error handling for API endpoints', | ||
type: 'user', | ||
userId: 'YleviOe1SsOML8eitV9W', | ||
}, | ||
{ | ||
id: 'sG4sUGTILmxaby9xmU3I', | ||
date: 1685404800000, | ||
createdAt: 1685453697666, | ||
blockers: 'Working on a backend Go project', | ||
completed: 'Working on a backend Go project', | ||
planned: 'Working on a backend Go project', | ||
type: 'user', | ||
userId: 'YleviOe1SsOML8eitV9W', | ||
}, | ||
{ | ||
id: 'xxvvSUglhJQNnHWVyEZ9', | ||
date: 1685232000000, | ||
createdAt: 1685257952297, | ||
blockers: 'Waiting for database access credentials', | ||
completed: 'Waiting for database access credentials', | ||
planned: 'Waiting for database access credentials', | ||
type: 'user', | ||
userId: 'YleviOe1SsOML8eitV9W', | ||
}, | ||
], | ||
}; | ||
|
||
module.exports = { standupOne }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters