-
Notifications
You must be signed in to change notification settings - Fork 357
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
added tests #286
base: main
Are you sure you want to change the base?
added tests #286
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job on implementing the Cypress tests! 🎉 The code meets all the core requirements and functionalities. While there are some minor improvements suggested, such as removing unnecessary use of new Object()
and optimizing parameter usage in the login
command, these do not impact the overall functionality. Keep up the great work and consider these suggestions for future enhancements! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
let user; | ||
cy.task('db:clear'); | ||
cy.task('generateUser').then((generateUser) => { | ||
user = new Object(generateUser); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of new Object(generateUser)
is unnecessary. You can directly assign user = generateUser;
since generateUser
is already an object.
|
||
it('should be created using New Article form', () => { | ||
|
||
cy.task('generateArticle').then((articleDataString) => { | ||
const article = new Object(articleDataString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of new Object(articleDataString)
is unnecessary. You can directly assign const article = articleDataString;
since articleDataString
is already an object.
}); | ||
|
||
it('should be edited using Edit button', () => { | ||
|
||
cy.task('generateArticle').then((articleDataString) => { | ||
const article = new Object(articleDataString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of new Object(articleDataString)
is unnecessary. You can directly assign const article = articleDataString;
since articleDataString
is already an object.
}); | ||
articlePage.editArticle(); | ||
cy.task('generateArticle').then((articleDataString) => { | ||
const articleUpdated = new Object(articleDataString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of new Object(articleDataString)
is unnecessary. You can directly assign const articleUpdated = articleDataString;
since articleDataString
is already an object.
}); | ||
|
||
it('should be deleted using Delete button', () => { | ||
|
||
cy.task('generateArticle').then((articleDataString) => { | ||
const article = new Object(articleDataString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of new Object(articleDataString)
is unnecessary. You can directly assign const article = articleDataString;
since articleDataString
is already an object.
|
||
cy.task('db:clear'); | ||
cy.task('generateUser').then((generateUser) => { | ||
user = new Object(generateUser); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of new Object(generateUser)
is unnecessary. You can directly assign user = generateUser;
since generateUser
is already an object.
let user; | ||
cy.task('db:clear'); | ||
cy.task('generateUser').then((generateUser) => { | ||
user = new Object(generateUser); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of new Object(generateUser)
is unnecessary. You can directly assign user = generateUser;
since generateUser
is already an object.
let user; | ||
cy.task('db:clear'); | ||
cy.task('generateUser').then((generateUser) => { | ||
user = new Object(generateUser); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of new Object(generateUser)
is unnecessary. You can directly assign user = generateUser;
since generateUser
is already an object.
Cypress.Commands.add('login', (email = '[email protected]', username = 'riot', password = '12345Qwert!') => { | ||
cy.request('POST', '/users', { | ||
user: { | ||
email, | ||
username, | ||
password | ||
} | ||
}).then(response => { | ||
const user = { | ||
bio: response.body.user.bio, | ||
effectiveImage: "https://static.productionready.io/images/smiley-cyrus.jpg", | ||
email: response.body.user.email, | ||
image: response.body.user.image, | ||
token: response.body.user.token, | ||
username: response.body.user.username, | ||
}; | ||
window.localStorage.setItem('user', JSON.stringify(user)); | ||
cy.setCookie('auth', response.body.user.token); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the login
command, the username
parameter is not used in the request body. Consider removing it from the parameters if it's not needed for the login process.
No description provided.