Optimize testing logic per each viewport/filename.