Skip to content

Instantly share code, notes, and snippets.

@M-Izadmehr
Last active January 5, 2019 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save M-Izadmehr/52411580ddaa481b17e542a4f8399648 to your computer and use it in GitHub Desktop.
Save M-Izadmehr/52411580ddaa481b17e542a4f8399648 to your computer and use it in GitHub Desktop.
End-to-End (E2E) code samples: searching medium with cypress
describe('medium search', () => {
it('should successfully find my profile', () => {
cy.visit('https://medium.com/search');
/**
* the functional chains used to:
* select search input, type values, press enter, and assert the first test
*/
cy
.get('form [type="Search"]')
.type('Izadmehr')
.type('{enter}')
.should('have.value', 'Izadmehr');
/**
* now click the profile link
*/
cy.get('[data-user-id="43f4a4c78443"]:first').click();
/**
* and here expect to find the avatar image, and it should have attribute of height
*/
cy.get('img[alt="Mojtaba Izadmehr"]').should('have.attr', 'height');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment