basic_spec.ts 839 B

123456789101112131415161718192021222324252627
  1. // https://docs.cypress.io/api/introduction/api.html
  2. describe('Homepage', () => {
  3. it('Shows correct text', () => {
  4. cy.visit('/')
  5. cy.contains('h2', 'Hello World Component')
  6. })
  7. it('Should not have vertical scroll bars on mobile or desktop', () => {
  8. cy.viewport('iphone-5')
  9. cy.window().then(() => {
  10. const htmlScrollWidth = Cypress.$('html')[0].scrollWidth
  11. const htmlWidth = Cypress.$('html')[0].clientWidth
  12. const scrollBarWidth = htmlScrollWidth - htmlWidth
  13. expect(scrollBarWidth).to.be.eq(0)
  14. })
  15. cy.viewport('macbook-11')
  16. cy.window().then(() => {
  17. const htmlScrollWidth = Cypress.$('html')[0].scrollWidth
  18. const htmlWidth = Cypress.$('html')[0].clientWidth
  19. const scrollBarWidth = htmlScrollWidth - htmlWidth
  20. expect(scrollBarWidth).to.be.eq(0)
  21. })
  22. })
  23. })