Skip to content

Commit 76163bb

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-selection-list`. `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 76163bb

File tree

3 files changed

+13
-23
lines changed

3 files changed

+13
-23
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {MatSelectHarness} from '@angular/material/select/testing';
1+
import {MatSelectionListHarness} from '@angular/material/list/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,13 @@ describe('app test', () => {
1515
});
1616

1717
it('should work', async () => {
18-
const select = await loader.getHarness(MatSelectHarness);
18+
const list = await loader.getHarness(MatSelectionListHarness);
19+
expect(list).toBeDefined();
1920

20-
expect(select).toBeDefined();
21-
expect(await select.getValueText()).toBe('');
21+
const items = await list.getItems();
22+
expect(await items[1].isSelected()).toBe(false);
2223

23-
await select.open();
24-
25-
const options = await select.getOptions();
26-
27-
await options[0].click();
28-
await select.close();
29-
30-
expect(await select.getValueText()).toBe('First');
24+
await items[1].select();
25+
expect(await items[1].isSelected()).toBe(true);
3126
});
3227
});
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-selection-list>
2+
<mat-list-option value="first">First</mat-list-option>
3+
<mat-list-option value="second">Second</mat-list-option>
4+
</mat-selection-list>

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 {MatListModule} from '@angular/material/list';
87

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

0 commit comments

Comments
 (0)