Unit tests or end-to-end tests in web apps? How to decide

Clicking elements


Pressing keys


Get the number of elements

$$('.items li').count();

Navigation & routing

expect(await browser.getCurrentUrl()).toBe('https://www.bing.com');

Hovering elements


Checking whether elements are present / visible


Responsive testing

expect(await $('#menu-toggle').isPresent()).toBe(false);
browser.driver.manage().window().setSize(640, 360);
expect(await $('#menu-toggle').isPresent()).toBe(true);

Getting cookies / window storage

browser.executeScript('return localStorage.getItem("' + item + '");');

Getting HTML attributes


Scrolling (e.g. to an element)


Drag & Drop

dragAndDrop($('#source'), $('#target')).


Senior Software Engineer @LeanIX. Co-founder of Sedeo. Passion for software engineering and startups. Looking forward to build great things. 有難うございます。🚀

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store