Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettier #33

Draft
wants to merge 8 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": [
"some-other-config-you-use",
"prettier"
],
"rules":{
"indent": "error"
}
}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
node_modules
tmp
config/local.json
social-media
social-media
.pnp.*
.yarn/*
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 4,
"semi": false,
"singleQuote": true
}
Binary file added .yarn/install-state.gz
Binary file not shown.
75 changes: 75 additions & 0 deletions acceptance/new-user/join-button.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
const puppeteer = require("puppeteer");

const URLS = require("../../constants/urls");

const {JOIN } = URLS;


let browser, page;


/* time delay */
const delay = (time) => {
return new Promise((res) => {
setTimeout(res, time);
});
};

/* confirm alerts */
async function confirmAlerts(){
page.on('dialog', async dialog => {
await dialog.accept();

delay(2000)
await page.waitForNavigation()

delay(4000)
await browser.close()
})
}

async function checkResponse(){
page.on("response", (response) => {
if(response.url().endsWith("/users/self") && page.url().endsWith('/join')){
switch (response.status()) {
case 401:
delay(2000);
confirmAlerts();
break;
case 200:
browser.close();
break;
default:
browser.close()
}
}
})
}


beforeAll(async () => {
browser = await puppeteer.launch({
headless: false,
slowMo: 0,
});

const context = await browser.createIncognitoBrowserContext();

page = await context.newPage();
return page;
});

describe("Navigation of Join button with logged user and logged out user", () => {
test("Join button test for user", async () => {

await page.goto(JOIN)

await Promise.all([
page.click('.btn-join'),
page.waitForNavigation()
]);

delay(2000)
await checkResponse()
})
})
2 changes: 2 additions & 0 deletions constants/urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ const API_HOST = "https://api.realdevquad.com";

const HOME_PAGE = `${WWW_HOST}`;
const SIGN_UP_PAGE = `${MY_HOST}/signup`;
const JOIN = `${WWW_HOST}/?join=true`

const SELF_USER_API = `${API_HOST}/users/self`;

module.exports = {
HOME_PAGE,
SELF_USER_API,
MY_HOST,
JOIN,
SIGN_UP_PAGE,
};
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
"license": "MIT",
"dependencies": {
"config": "^3.3.6",
"eslint-config-prettier": "^8.8.0",
"expect-puppeteer": "^6.1.0",
"puppeteer": "^19.3.0"
},
"devDependencies": {
"jest": "^29.3.1"
"jest": "^29.5.0",
"prettier": "2.8.4"
},
"scripts": {
"test": "jest"
"test": "jest",
"check": "prettier --check .",
"write": "prettier --write ."
}
}
Loading