Looking to create a Cypress method for checking three different rounding cases regarding the hour.
An example of the second case I want to include in a general method, if a specific argument is provided:
( cy.contains('00') && cy.contains('30') ).should('be.visible');
( cy.contains('15') && cy.contains('45') ).should('not.exist')
Uncertain about using an if syntax with multiple conditions:
- For the 15-minute case: all times displayed should be rounded to 15-minute intervals (e.g., 10:00AM, 10:15AM, 10:30AM, 10:45AM). Need to check for occurrences of :00, :15, :30, and :45, totaling 4 cases on the page.
- In the 30-minute case: all displayed times must round to 30 minutes (e.g., 10:00AM, 10:30AM, 11:00AM), yielding 2 potential instances after the colon.
- Lastly, for the one-hour case: displayed hours should be rounded to 60 minutes (e.g., 10:00AM, 11:00AM), meaning only :00 will appear following the colon.
What's the most efficient way to develop this functionality?
Hoping I've outlined everything you need. Thank you.