Friday, November 20, 2015

Web site incorrectly rendering a font in italics at least in Windows Chrome browser

If your browser (I have seen it in Windows Chrome) incorrectly renders a specific font in italics you might be facing a corrupted font.

The first thing to do in order to resolve this issue is to determine the font being used. This is something you can find easily from chrome inspector (right click on an incorrectly rendered in italics word) which will reveal the current applied style including the font.

Once you know the font type then go to and select that font. Most likely it will be looking also in italics. See below how the whole page renders in italics:

This means that the particular font is corrupted as a result of a corrupted program installation or uninstallation.

To correct the issue just delete the font from C:\Windows\Fonts and bring it back again from a working machine (the file is a ttf which contains bold, italics, narrow and other combinations for example arial.ttf).

Saturday, November 14, 2015

On Protractor: End to End (e2e) tests should fail if there are javascript errors

End to End (e2e) tests should fail if there are javascript errors. They most likely won't cover all the application functionality, but many (if not most) of the regressions we encounter in production are related to javascript errors. Here is how to stop your continuous delivery pipeline if there is a single javascript error at runtime. Note that at a minimum smoke e2e tests should exist meaning that all of your views should be tested at least expecting to render html, not having unexpected logical errors and not having javascript errors. Webdriver allows us to get a hold of the browser console log. This means we can detect if there are javascript errors at runtime and make our tests fail. For more info see Protractor makes our lifes easier though. All we need to do is to include the below configuration in protractor.conf.js:
exports.config = {
  plugins: [{
    path: 'node_modules/protractor-console-plugin',
    failOnWarning: true,
    failOnError: true
// To test the solution just force a JS error that does not stop your test from passing. // For example adding a simple script tag in your index.html:
    console.undefinedMethod('will never run');
After the test is run you get:
Plugin: /usr/local/lib/node_modules/protractor/plugins/console/index.js (teardown) Fail: Console output SEVERE: 72:17 Uncaught TypeError: console.undefinedMethod is not a function [launcher] 0 instance(s) of WebDriver still running [launcher] chrome #1 failed 1 test(s) [launcher] overall: 1 failed spec(s) [launcher] Process exited with error code 1

Tuesday, November 10, 2015

Find all javascript files except those below a directory

Very useful specially for those dealing with nodejs where we want to avoid searching for "node_modules"
find ./ -not -path "*node_modules*" -name "*.js"