Skip to content

Commit bf6a2c3

Browse files
devversiontinayuangao
authored andcommitted
build: more stable screenshot tests (#7774)
* Most of the time the screenshot tests are failing because the caret is blinking and therefore the screenshot is different. Setting the caret-color to `transparent` for focused elements ensures that the screenshot tests are running more stable.
1 parent 5c6e3df commit bf6a2c3

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/e2e-app/e2e-app/e2e-app.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* Don't show the caret for focused elements since those are causing the screenshot comparisons
3+
* to be flaky. The `caret-color` CSS property is not supported in most of the browsers, but since
4+
* the e2e tests run against Chrome we can use that property instead of a workaround using `color`.
5+
*/
6+
*:focus {
7+
caret-color: transparent;
8+
}

src/e2e-app/e2e-app/e2e-app.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component} from '@angular/core';
1+
import {Component, ViewEncapsulation} from '@angular/core';
22

33

44
@Component({
@@ -11,6 +11,8 @@ export class Home {}
1111
moduleId: module.id,
1212
selector: 'e2e-app',
1313
templateUrl: 'e2e-app.html',
14+
styleUrls: ['e2e-app.css'],
15+
encapsulation: ViewEncapsulation.None,
1416
})
1517
export class E2EApp {
1618
showLinks: boolean = false;

0 commit comments

Comments
 (0)