Skip to content

Commit 132cb1d

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 132cb1d

File tree

3 files changed

+13
-22
lines changed

3 files changed

+13
-22
lines changed
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
});
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)