Skip to content

Commit 8b6aab1

Browse files
authored
build: run edge tests on browserstack (#20662)
Moves the Edge tests to Browserstack to avoid the recent issues with Saucelabs.
1 parent 4ef3d3f commit 8b6aab1

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
@@ -354,23 +354,23 @@ export function crossEnvironmentSpecs(
354354
});
355355

356356
it('should be able to hover', async () => {
357-
const host = await harness.host();
358-
let classAttr = await host.getAttribute('class');
357+
const box = await harness.hoverTest();
358+
let classAttr = await box.getAttribute('class');
359359
expect(classAttr).not.toContain('hovering');
360-
await host.hover();
361-
classAttr = await host.getAttribute('class');
360+
await box.hover();
361+
classAttr = await box.getAttribute('class');
362362
expect(classAttr).toContain('hovering');
363363
});
364364

365365
it('should be able to stop hovering', async () => {
366-
const host = await harness.host();
367-
let classAttr = await host.getAttribute('class');
366+
const box = await harness.hoverTest();
367+
let classAttr = await box.getAttribute('class');
368368
expect(classAttr).not.toContain('hovering');
369-
await host.hover();
370-
classAttr = await host.getAttribute('class');
369+
await box.hover();
370+
classAttr = await box.getAttribute('class');
371371
expect(classAttr).toContain('hovering');
372-
await host.mouseAway();
373-
classAttr = await host.getAttribute('class');
372+
await box.mouseAway();
373+
classAttr = await box.getAttribute('class');
374374
expect(classAttr).not.toContain('hovering');
375375
});
376376

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

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

9495
private _testTools = this.locatorFor(SubComponentHarness);
9596

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,11 @@ <h1 style="height: 100px; width: 200px;">Main Component</h1>
5858
<span id="task-state-result" #taskStateResult></span>
5959
</div>
6060
<test-shadow-boundary *ngIf="_shadowDomSupported"></test-shadow-boundary>
61+
62+
63+
<div
64+
id="hover-box"
65+
[class.hovering]="isHovering"
66+
(mouseenter)="isHovering = true"
67+
(mouseleave)="isHovering = false"
68+
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;
@@ -54,14 +49,6 @@ export class TestMainComponent implements OnDestroy {
5449

5550
private _fakeOverlayElement: HTMLElement;
5651

57-
onMouseEnter() {
58-
this._isHovering = true;
59-
}
60-
61-
onMouseLeave() {
62-
this._isHovering = false;
63-
}
64-
6552
constructor(private _cdr: ChangeDetectorRef, private _zone: NgZone) {
6653
this.username = 'Yi';
6754
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)