Skip to main content

Posts

About this blog

This blog is mostly dedicated to automated testing. It also covers a wide range of topics related to load testing, Web development, Android development and Linux administration. You can support this blog by disabling AdBlock in your browser.
Recent posts

How to dynamically add coded ignore regions in Applitools

There is a special feature in in Applitools Eyes that's called "coded ignore regions" to handle dynamic data. It's often used in Strict mode to increase test coverage if you don't want to switch to Layout mode. You can add coded ignore regions to the screenshot like this: target = target.ignore(By.id('reg1')).ignore(By.id('reg2')).ignore(By.id('reg3')); But what if these elements are created dynamically and you don't know how many of them will appear on the page? There could be 5 elements, or maybe 100... You cannot just add them in a chain by modifying a target like that. The answer is - you have to count them first and then add them in a loop. You can see the complete solution below for JavaScript.

Accurate Word Count for non-Latin characters in Javascript regex

There is a problem that involves Javascript and regular expressions. The JS implementation of regexp does not support Unicode properly, for example
/\b\S+\b/g
regular expression will not count words with Unicode characters of many national alphabets and scripts, such as Cyrillic, Greek and Hindi. Unfortunately \S is restricted to Latin-only characters of English alphabet.
To solve this problem we must explicitly include all Unicode characters. My solution is to use this regular expression instead:
/([\u0080-\uFFFF\w]\u0027?)+/g
It covers the wide range of Unicode characters (from 0080 to FFFF) that includes all national alphabets + apostrophe symbol (0027).
This regex has been tested with the following sample text and it counts all 55 words accurately, ignoring all special characters and punctuation, I used https://regexr.com to check it. One Jack's two "three" 'happy' Кав′ярня два три нав'язливо ένα δύο τρία âêîôû,O’Brien/ëïü,är en häst बर्ताव करना चाहिए…

Switching between keyboard layouts in Openbox (Arch Linux)

Switching between two (or more) keyboard layouts in Openbox DE is a task that's quite easy to accomplish, although it might not be so obvious as in other desktop environments. This solution was tested on Arch Linux. You just need to edit this file (assuming you want to switch between English and Ukrainian Phonetic layouts with Alt-Shift): /etc/X11/xorg.conf.d/01-keyboard-layout.conf Section "InputClass" Identifier "keyboard-layout" Driver "evdev" MatchIsKeyboard "yes" Option "XkbLayout" "us,ua(phonetic)" Option "XkbModel" "pc105" Option "XkbOptions" "grp:alt_shift_toggle" EndSection If you have Nvidia card, don't forget to edit /etc/X11/xorg.conf.d/20-nvidia.conf and change Driver from "kbd" to "evdev" in InputDevice section: Section "InputDevice" Identifier "Keyboard0" Driver "evdev" EndSection You…

How to prevent screen tearing on Nvidia card with proprietary drivers in Linux

You might have noticed screen tearing on Nvidia card with proprietary drivers in Linux. Sometimes it gets worse, sometimes it's back to normal. The problem is in your graphics card performance settings, it's called PowerMizer and you can find it if you open nvidia-settings, it's in Auto mode by default. If you want to avoid screen tearing, this value must be set to Prefer Maximum Performance, you can also change this setting from command line if you execute nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=1'


Now the tricky part. You can set this performance setting to the desired level, but it will be back to Auto when you reboot you computer. It doesn't persist because nvidia-settings utility doesn't store this setting to the hidden ~/.nvidia-settings-rc file in your home directory. You have to edit this file manually and add [gpu:0]/GPUPowerMizerMode=1 to the last line, then it will persist upon reboot. Just don't open nvidia-settings GUI again, because …

Hiding a blinking caret (cursor) on the page with Webdriver and Javascript

When you use Applitools for testing, it is important to keep all pages in the same state as they used to be when the baseline Applitools screenshot was taken. In Applitools visual difference means a bug. This is why a blinking caret (cursor) can become a problem when the baseline screenshot was taken with a caret either visible or invisible, as long as the actual screenshot was captured with a different state of the caret. We can avoid this issue if we hide the caret by making it transparent before taking a screenshot in Applitools. This is how we can do it in Selenium Webdriver (Javascript bindings) (assuming that you initialized the driver object with Webdriver).

Basic setup and configuration of TestObject in Node JS for testing of a web application

If you are already using SauceLabs for automated web UI testing on mobile devices, then you could be interested in trying TestObject cloud service that was acquired and became a part of SauceLabs family in 2017. It allows you to run your existing tests on real devices (Android and iPhone). SauceLabs provides emulators, which work quite well, but, depending on the requirements of your project, you may need to execute tests on real hardware. Another reason for switching to TestObject could be using the latest version of Android OS which may not be available at SauceLabs. At the moment of posting this article the latest supported version was Android 7.1 on SauceLabs and Android 8.1 on TestObject. Luckily the transition to TestObject is quite seamless. You don't need to modify your existing automated tests, only the provider endpoint and a few capabilities. The disanvantage of using a free Testobject account is that you are limited to only a few devices which are marked as Free in the…