Skip to content

Commit 44ef3a0

Browse files
crisbetommalerba
authored andcommitted
build: run edge tests on browserstack (#20662)
Moves the Edge tests to Browserstack to avoid the recent issues with Saucelabs. (cherry picked from commit 8b6aab1)
1 parent 275a7af commit 44ef3a0

File tree

6 files changed

+27
-30
lines changed

6 files changed

+27
-30
lines changed

src/cdk/testing/tests/cross-environment.spec.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -347,23 +347,23 @@ export function crossEnvironmentSpecs(
347347
});
348348

349349
it('should be able to hover', async () => {
350-
const host = await harness.host();
351-
let classAttr = await host.getAttribute('class');
350+
const box = await harness.hoverTest();
351+
let classAttr = await box.getAttribute('class');
352352
expect(classAttr).not.toContain('hovering');
353-
await host.hover();
354-
classAttr = await host.getAttribute('class');
353+
await box.hover();
354+
classAttr = await box.getAttribute('class');
355355
expect(classAttr).toContain('hovering');
356356
});
357357

358358
it('should be able to stop hovering', async () => {
359-
const host = await harness.host();
360-
let classAttr = await host.getAttribute('class');
359+
const box = await harness.hoverTest();
360+
let classAttr = await box.getAttribute('class');
361361
expect(classAttr).not.toContain('hovering');
362-
await host.hover();
363-
classAttr = await host.getAttribute('class');
362+
await box.hover();
363+
classAttr = await box.getAttribute('class');
364364
expect(classAttr).toContain('hovering');
365-
await host.mouseAway();
366-
classAttr = await host.getAttribute('class');
365+
await box.mouseAway();
366+
classAttr = await box.getAttribute('class');
367367
expect(classAttr).not.toContain('hovering');
368368
});
369369

src/cdk/testing/tests/harnesses/main-component-harness.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export class MainComponentHarness extends ComponentHarness {
8484
readonly shadows = this.locatorForAll('.in-the-shadows');
8585
readonly deepShadow = this.locatorFor(
8686
'test-shadow-boundary test-sub-shadow-boundary > .in-the-shadows');
87+
readonly hoverTest = this.locatorFor('#hover-box');
8788

8889
private _testTools = this.locatorFor(SubComponentHarness);
8990

src/cdk/testing/tests/test-main-component.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,11 @@ <h1 style="height: 100px; width: 200px;">Main Component</h1>
3333
<span id="task-state-result" #taskStateResult></span>
3434
</div>
3535
<test-shadow-boundary *ngIf="_shadowDomSupported"></test-shadow-boundary>
36+
37+
38+
<div
39+
id="hover-box"
40+
[class.hovering]="isHovering"
41+
(mouseenter)="isHovering = true"
42+
(mouseleave)="isHovering = false"
43+
style="width: 50px; height: 50px; background: hotpink;"></div>

src/cdk/testing/tests/test-main-component.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ import {
2222
@Component({
2323
selector: 'test-main',
2424
templateUrl: 'test-main-component.html',
25-
host: {
26-
'[class.hovering]': '_isHovering',
27-
'(mouseenter)': 'onMouseEnter()',
28-
'(mouseleave)': 'onMouseLeave()',
29-
},
3025
encapsulation: ViewEncapsulation.None,
3126
changeDetection: ChangeDetectionStrategy.OnPush,
3227
})
@@ -39,7 +34,7 @@ export class TestMainComponent implements OnDestroy {
3934
memo: string;
4035
testTools: string[];
4136
testMethods: string[];
42-
_isHovering: boolean;
37+
isHovering = false;
4338
specialKey = '';
4439
relativeX = 0;
4540
relativeY = 0;
@@ -50,14 +45,6 @@ export class TestMainComponent implements OnDestroy {
5045

5146
private _fakeOverlayElement: HTMLElement;
5247

53-
onMouseEnter() {
54-
this._isHovering = true;
55-
}
56-
57-
onMouseLeave() {
58-
this._isHovering = false;
59-
}
60-
6148
constructor(private _cdr: ChangeDetectorRef, private _zone: NgZone) {
6249
this.username = 'Yi';
6350
this.counter = 0;

test/browser-providers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* - `saucelabs`: Launches the browser within Saucelabs
88
*/
99
const browserConfig = {
10-
'Edge83': {unitTest: {target: 'saucelabs'}},
10+
'Edge83': {unitTest: {target: 'browserstack'}},
1111
'iOS13': {unitTest: {target: 'saucelabs'}},
1212
'Safari13': {unitTest: {target: 'browserstack'}},
1313
};

test/karma-browsers.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
"platformName": "iOS",
2020
"deviceName": "iPhone XS Simulator"
2121
},
22-
"SAUCELABS_EDGE83": {
23-
"base": "SauceLabs",
24-
"browserName": "MicrosoftEdge",
25-
"browserVersion": "83.0",
26-
"platformName": "Windows 10"
22+
"BROWSERSTACK_EDGE83": {
23+
"base": "BrowserStack",
24+
"browser": "Edge",
25+
"browser_version": "83.0",
26+
"os": "Windows",
27+
"os_version": "10"
2728
},
2829
"BROWSERSTACK_SAFARI13": {
2930
"base": "BrowserStack",

0 commit comments

Comments
 (0)