Skip to content

Commit c7427d7

Browse files
committed
build: attempt to de-flake harness integration test
Tries to de-flake the harness e2e integration test by swapping out `mat-select` with `mat-radio-group`. `mat-select` has been causing flakes in its own Firefox tests too so it's possible that it may be the reason for the integration test flakes as well. The component being tested doesn't really matter since the integration test is primarily verifying our npm packages.
1 parent b5c935a commit c7427d7

File tree

6 files changed

+1246
-786
lines changed

6 files changed

+1246
-786
lines changed

integration/harness-e2e-cli/BUILD.bazel

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ load("//tools:integration.bzl", "CLI_PROJECT_MAPPINGS")
33
load("//tools:defaults.bzl", "node_integration_test")
44

55
npmPackageMappings = dicts.add(
6-
CLI_PROJECT_MAPPINGS,
6+
dicts.omit(
7+
CLI_PROJECT_MAPPINGS,
8+
["@npm//:rxjs_archive"],
9+
),
710
{
811
"//src/cdk:npm_package_archive": "@angular/cdk",
912
"//src/material:npm_package_archive": "@angular/material",
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {MatSelectHarness} from '@angular/material/select/testing';
1+
import {MatRadioGroupHarness} from '@angular/material/radio/testing';
22
import {SeleniumWebDriverHarnessEnvironment} from '@angular/cdk/testing/selenium-webdriver';
33
import {HarnessLoader} from '@angular/cdk/testing';
44
import {configureDriver} from './driver.js';
@@ -15,18 +15,14 @@ describe('app test', () => {
1515
});
1616

1717
it('should work', async () => {
18-
const select = await loader.getHarness(MatSelectHarness);
18+
const group = await loader.getHarness(MatRadioGroupHarness);
1919

20-
expect(select).toBeDefined();
21-
expect(await select.getValueText()).toBe('');
20+
expect(group).toBeDefined();
21+
expect(await group.getCheckedValue()).toBe(null);
2222

23-
await select.open();
23+
const buttons = await group.getRadioButtons();
24+
await buttons[1].check();
2425

25-
const options = await select.getOptions();
26-
27-
await options[0].click();
28-
await select.close();
29-
30-
expect(await select.getValueText()).toBe('First');
26+
expect(await group.getCheckedValue()).toBe('Second');
3127
});
3228
});

integration/harness-e2e-cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"@angular/platform-browser": "file:../../node_modules/@angular/platform-browser",
2424
"@angular/platform-browser-dynamic": "file:../../node_modules/@angular/platform-browser-dynamic",
2525
"@angular/router": "file:../../node_modules/@angular/router",
26-
"rxjs": "file:../../node_modules/rxjs",
26+
"rxjs": "^7.5.5",
2727
"tslib": "^2.3.0",
2828
"zone.js": "~0.11.4"
2929
},
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
<mat-form-field>
2-
<mat-label>Select</mat-label>
3-
<mat-select>
4-
<mat-option value="first">First</mat-option>
5-
<mat-option value="second">Second</mat-option>
6-
</mat-select>
7-
</mat-form-field>
1+
<mat-radio-group name="radio-group">
2+
<mat-radio-button value="first">First</mat-radio-button>
3+
<mat-radio-button value="second">Second</mat-radio-button>
4+
</mat-radio-group>

integration/harness-e2e-cli/src/app/app.module.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ import {BrowserModule} from '@angular/platform-browser';
33
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
44

55
import {AppComponent} from './app.component';
6-
import {MatSelectModule} from '@angular/material/select';
7-
import {MatFormFieldModule} from '@angular/material/form-field';
6+
import {MatRadioModule} from '@angular/material/radio';
87

98
@NgModule({
109
declarations: [AppComponent],
11-
imports: [MatSelectModule, MatFormFieldModule, NoopAnimationsModule, BrowserModule],
12-
providers: [],
10+
imports: [MatRadioModule, NoopAnimationsModule, BrowserModule],
1311
bootstrap: [AppComponent],
1412
})
1513
export class AppModule {}

0 commit comments

Comments
 (0)