DEV Community

Discussion on: How you can help Angular in 2020

Collapse
 
jwp profile image
John Peters • Edited

Hello damoeb;
I was a test manager of a team of 35 people in three continents for 7 years, (at one time). I am very familiar with testing methods and terminology.

The problem I kept seeing then, was that the traditional concepts of Unit Testing, E2E, and even Smoke testing are off-base today. All have very specific definitions which managers or product owners feel is the "right" one. Unfortunately most of them are not developers and are under the assumption their understanding of those definitions are only what they think they are, with no need to communicate that understanding.

Those old definitions are over 20+ years old. Since then, new tools such as Cypress have crossed the line from only E2E to overlapping with Unit Test and Smoke Test ability. It's a true one-stop-shop.

Cypress does not need, as you know; the huge Protractor and Selenium set up. It's simply a browser driver (similar to Selenium) which allows http request interception. This allows for creating unit tests by altering the data.

It's fast, complete, and requires only a small ramp up time to get going. Unfortunately it's based on JQuery, but for the goodness it has, I am easily able to overlook that part.

My motto "In 2021; Just say no to Karma/Jasmine or Protractor/Selenium"

Thread Thread
 
layzee profile image
Lars Gyrup Brink Nielsen

Thanks for discussing, everyone. Just wanted to make you all aware that there are plenty of options for end-to-end testing:

Thread Thread
 
jwp profile image
John Peters • Edited

I was wanting to look into Puppeteer a while back, today I found this on their site:

How to intercept an HTTP request in Puppeteer

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.setRequestInterception(true);
  page.on('request', interceptedRequest => {
    if (interceptedRequest.url().endsWith('.png') || interceptedRequest.url().endsWith('.jpg'))
      interceptedRequest.abort();
    else
      interceptedRequest.continue();
  });
  await page.goto('https://example.com');

  await browser.close();
})();
Enter fullscreen mode Exit fullscreen mode

They too can intercept inbound and outbound requests ✔️
I don't know yet if the data can be changed, but the workflow can be altered.