Skip to content

Dev#5

Merged
nawazdhandala merged 49 commits intomainfrom
dev
Jan 6, 2022
Merged

Dev#5
nawazdhandala merged 49 commits intomainfrom
dev

Conversation

@crud-engr
Copy link
Copy Markdown

No description provided.

"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can directly run jest

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I directly run jest it's complaining of the import statement.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Google how to solve it.

/**
* Test the GET route for home /
*/
describe('Dao API', () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change this to 'Status API'

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

*/
describe('Dao API', () => {
it('returns status to be OK', async () => {
const apiUrl = 'http://localhost:2015/';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can create a file called utils.js and have the apiurl there. and import it and use it here. So, you dont have to copy paste it every time and if the API url changes we change it in one place.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted sir.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -0,0 +1,5 @@
const apiConfig = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be in tests folder.

also, this should be like

export const API_URL='https://localhost:2015'

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright.

const browser = await puppeteer.launch({});
const page = await browser.newPage()

await page.emulate({
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove page.emulate - we dont need this.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted sir.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted sir.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

*/
describe('On page load', () => {
test('Home page loads correctly', async () => {
const browser = await puppeteer.launch({});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You launch and new page in before.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the review here.

const html = await page.$eval('h5', e => e.innerHTML);
expect(html).toBe('Login or Register');

browser.close();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You close the browser in after.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get this also.


on:
push:
branches: [ dev ]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should work on all branches and not just dev. Please fix this for the other job as well.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright.

@nawazdhandala nawazdhandala merged commit 4a7fbdf into main Jan 6, 2022
@nawazdhandala nawazdhandala deleted the dev branch January 6, 2022 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants