autoComplete.spec.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. describe('autoComplete', () => {
  2. it('key press', () => {
  3. cy.visit('http://127.0.0.1:6006/iframe.html?id=autocomplete--basic-usage&args=&viewMode=story');
  4. cy.wait(400);
  5. cy.realPress("Tab");
  6. cy.get('input').type('123');
  7. // open panel
  8. cy.get('input').type('{enter}');
  9. cy.get('.semi-popover');
  10. // close panel
  11. cy.get('input').type('{enter}');
  12. cy.get('.semi-popover').not('.exit');
  13. cy.get('input').should('have.value', '123');
  14. // test downArrow and upArrow
  15. cy.get('input').type('{enter}');
  16. cy.get('input').type('{downArrow}');
  17. cy.get('input').type('{downArrow}');
  18. cy.get('input').type('{downArrow}');
  19. cy.get('input').type('{downArrow}');
  20. cy.get('input').type('{upArrow}');
  21. cy.get('input').type('{esc}');
  22. cy.get('input').should('have.value', '123');
  23. // test downArrow when panel hidden
  24. cy.get('input').type('{downArrow}');
  25. cy.get('input').type('{downArrow}');
  26. cy.get('input').type('{enter}');
  27. cy.get('input').should('have.value', '[email protected]');
  28. // test upArrow when panel hidden
  29. cy.get('input').type('{upArrow}');
  30. cy.get('input').type('{upArrow}');
  31. cy.get('input').type('{enter}');
  32. cy.get('input').should('have.value', '[email protected]');
  33. cy.get('input').trigger('mouseover');
  34. cy.get('.semi-input-clearbtn').click();
  35. cy.root().click('right');
  36. cy.get('input').should('have.value', '');
  37. // // test enter
  38. // cy.get('input').click();
  39. // cy.get('input').type('456');
  40. // cy.get('input').type('{downArrow}');
  41. // cy.get('input').type('{enter}');
  42. // cy.get('#root').click('right');
  43. // cy.get('input').should('have.value', '[email protected]');
  44. });
  45. it('mouse over option ', () => {
  46. cy.visit('http://127.0.0.1:6006/iframe.html?id=autocomplete--basic-usage&args=&viewMode=story');
  47. cy.get('input').type('123');
  48. cy.get('.semi-portal').contains('[email protected]').trigger('mouseover');
  49. cy.get('input').type('{downArrow}');
  50. cy.get('input').type('{enter}');
  51. cy.get('input').should('have.value', '[email protected]');
  52. });
  53. });