Skip to content

build: run edge tests on browserstack #20662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/cdk/testing/tests/cross-environment.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,23 +354,23 @@ export function crossEnvironmentSpecs(
});

it('should be able to hover', async () => {
const host = await harness.host();
let classAttr = await host.getAttribute('class');
const box = await harness.hoverTest();
Copy link
Member Author

@crisbeto crisbeto Sep 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to change these tests to hover an element inside the host, instead of the host itself, because the first assertion, that ensures that the element doesn't start off as hovered, was breaking on Browserstack. What I think was going on is that it would put the cursor inside the viewport when the window is opened, throwing off our assertion since the host takes up most of the screen and the cursor would land on it.

let classAttr = await box.getAttribute('class');
expect(classAttr).not.toContain('hovering');
await host.hover();
classAttr = await host.getAttribute('class');
await box.hover();
classAttr = await box.getAttribute('class');
expect(classAttr).toContain('hovering');
});

it('should be able to stop hovering', async () => {
const host = await harness.host();
let classAttr = await host.getAttribute('class');
const box = await harness.hoverTest();
let classAttr = await box.getAttribute('class');
expect(classAttr).not.toContain('hovering');
await host.hover();
classAttr = await host.getAttribute('class');
await box.hover();
classAttr = await box.getAttribute('class');
expect(classAttr).toContain('hovering');
await host.mouseAway();
classAttr = await host.getAttribute('class');
await box.mouseAway();
classAttr = await box.getAttribute('class');
expect(classAttr).not.toContain('hovering');
});

Expand Down
1 change: 1 addition & 0 deletions src/cdk/testing/tests/harnesses/main-component-harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export class MainComponentHarness extends ComponentHarness {
readonly shadows = this.locatorForAll('.in-the-shadows');
readonly deepShadow = this.locatorFor(
'test-shadow-boundary test-sub-shadow-boundary > .in-the-shadows');
readonly hoverTest = this.locatorFor('#hover-box');

private _testTools = this.locatorFor(SubComponentHarness);

Expand Down
8 changes: 8 additions & 0 deletions src/cdk/testing/tests/test-main-component.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,11 @@ <h1 style="height: 100px; width: 200px;">Main Component</h1>
<span id="task-state-result" #taskStateResult></span>
</div>
<test-shadow-boundary *ngIf="_shadowDomSupported"></test-shadow-boundary>


<div
id="hover-box"
[class.hovering]="isHovering"
(mouseenter)="isHovering = true"
(mouseleave)="isHovering = false"
style="width: 50px; height: 50px; background: hotpink;"></div>
15 changes: 1 addition & 14 deletions src/cdk/testing/tests/test-main-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ import {
@Component({
selector: 'test-main',
templateUrl: 'test-main-component.html',
host: {
'[class.hovering]': '_isHovering',
'(mouseenter)': 'onMouseEnter()',
'(mouseleave)': 'onMouseLeave()',
},
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
})
Expand All @@ -39,7 +34,7 @@ export class TestMainComponent implements OnDestroy {
memo: string;
testTools: string[];
testMethods: string[];
_isHovering: boolean;
isHovering = false;
specialKey = '';
relativeX = 0;
relativeY = 0;
Expand All @@ -54,14 +49,6 @@ export class TestMainComponent implements OnDestroy {

private _fakeOverlayElement: HTMLElement;

onMouseEnter() {
this._isHovering = true;
}

onMouseLeave() {
this._isHovering = false;
}

constructor(private _cdr: ChangeDetectorRef, private _zone: NgZone) {
this.username = 'Yi';
this.counter = 0;
Expand Down
2 changes: 1 addition & 1 deletion test/browser-providers.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* - `saucelabs`: Launches the browser within Saucelabs
*/
const browserConfig = {
'Edge83': {unitTest: {target: 'saucelabs'}},
'Edge83': {unitTest: {target: 'browserstack'}},
'iOS13': {unitTest: {target: 'saucelabs'}},
'Safari13': {unitTest: {target: 'browserstack'}},
};
Expand Down
11 changes: 6 additions & 5 deletions test/karma-browsers.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
"platformName": "iOS",
"deviceName": "iPhone XS Simulator"
},
"SAUCELABS_EDGE83": {
"base": "SauceLabs",
"browserName": "MicrosoftEdge",
"browserVersion": "83.0",
"platformName": "Windows 10"
"BROWSERSTACK_EDGE83": {
"base": "BrowserStack",
"browser": "Edge",
"browser_version": "83.0",
"os": "Windows",
"os_version": "10"
},
"BROWSERSTACK_SAFARI13": {
"base": "BrowserStack",
Expand Down