Guest User

Untitled

a guest
Feb 15th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. it.only('M14012 Focus move to main input box when a character key is selected', () => {
  2. // 1. Login and go to /
  3. cy.login('user-1');
  4. cy.visit('/');
  5.  
  6. // 2. Post a message
  7. const message = 'test for main input box focus';
  8. cy.get('#post_textbox').type(message + '{enter}');
  9.  
  10. // * Check post list content
  11. cy.get('#postListContent').each((postList) => {
  12. const divPost = postList[0].children[postList[0].children.length - 1];
  13. assert.ok(divPost, 'should get the posted message');
  14.  
  15. const postId = divPost.id.replace('post_', '');
  16.  
  17. // * Check that the message is posted
  18. cy.get(`#${postId}_message`).should('contain', message);
  19.  
  20. // 3. Click on any post to move the focus out of the main input box
  21. cy.get(`#post_${postId}`).click();
  22.  
  23. // 4. Push a character key such as "A"
  24. cy.get('#post_textbox').type('A');
  25.  
  26. // 5. Open the "..." menu on a post in the main or reply thread to move the focus out of the main input box
  27. cy.get(`#post_${postId}`).trigger('mouseover');
  28. cy.get(`#CENTER_dropdown_${postId} .dropdown-toggle`).click({force: true});
  29.  
  30. // 6. Push a character key such as "A"
  31. cy.get('#post_textbox').type('A');
  32.  
  33. // * Focus is moved back to the main input and the keystroke is captured
  34. cy.focused().should('have.id', 'post_textbox');
  35. cy.focused().should('contain', 'AA');
  36. });
  37. });
Add Comment
Please, Sign In to add comment