-
Notifications
You must be signed in to change notification settings - Fork 568
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
tests for Student Registration page #537
base: master
Are you sure you want to change the base?
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 task requirements! 🎉 Your code effectively automates the student registration form workflow and verifies the input data in the modal window. While there are a few minor issues, such as the ecmaVersion
being a string instead of a number and the need to ensure the findByPlaceholder
command returns the result of cy.get
, these do not critically impact the functionality of your solution. Keep up the good work, and consider addressing these minor points to enhance your code's clarity and robustness in the future. 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
parserOptions: { | ||
ecmaVersion: 'latest' | ||
ecmaVersion: 'latest', |
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 ecmaVersion
should be a number, not a string. Change 'latest'
to 2021
or another specific version number.
'max-len': [ | ||
'error', | ||
80, | ||
{ | ||
ignoreTemplateLiterals: true, | ||
ignoreRegExpLiterals: true, | ||
ignoreComments: true, | ||
}, | ||
], |
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.
Ensure that the max-len
rule options are correctly set according to your project's requirements. The current configuration ignores template literals, regular expression literals, and comments, which might not be desired in all cases.
setupNodeEvents(on, config) { | ||
} | ||
} | ||
setupNodeEvents(on, config) {}, |
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 setupNodeEvents
function is currently empty. If you need to handle specific Cypress events, you should implement the necessary logic inside this function. If no events need handling, you can leave it as is.
'should fill and submit the form' + | ||
' then validate input data in the modal', | ||
() => { | ||
const user = 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.
Ensure that the generateUser
function is correctly imported and returns the expected user object. The function is defined in cypress/support/generateUser.js
and should match the expected structure used in this test file.
' then validate input data in the modal', | ||
() => { | ||
const user = generateUser(); | ||
const getGender = user.gender === 'Female' ? 2 : 3; |
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 getGender
variable is used to determine the gender radio button index. Ensure that the logic correctly matches the form's expected values for gender selection.
`label[for="gender-radio-${user.gender === 'Male' ? 1 : getGender}"]` | ||
).click(); | ||
cy.findById('userNumber').type(user.mobileNumber); | ||
cy.findById('dateOfBirthInput').type( |
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.
When typing the date of birth, ensure that the format matches what the form expects. The generateUser
function formats the date as 'day month year', which should align with the form's requirements.
cy.findById('subjectsInput').type(subject + '{enter}'); | ||
} | ||
user.hobbies.forEach((hobby, i) => { | ||
cy.get(`label[for="hobbies-checkbox-${i + 1}"]`).click(); |
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 hobbies selection assumes a specific order of checkboxes. Verify that the indices used here match the actual order of hobbies checkboxes in the form.
@@ -23,3 +23,11 @@ | |||
// | |||
// -- This will overwrite an existing command -- | |||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) | |||
|
|||
Cypress.Commands.add('findByPlaceholder', (placeholder) => { | |||
cy.get(`[placeholder='${String(placeholder)}']`); |
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 findByPlaceholder
command should return the result of cy.get
to allow chaining of Cypress commands. Add a return
statement before cy.get
to ensure the command can be used effectively in test scripts.
}; | ||
} | ||
|
||
export default { 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 export statement uses export default { generateUser };
, which exports an object containing generateUser
. If you intend to export the function directly, consider using export default generateUser;
instead. This will allow you to import the function directly without needing to destructure it.
No description provided.