Skip to content

Commit d70a669

Browse files
authored
chore: add material-examples to e2e-app (#5735)
1 parent 25b1844 commit d70a669

File tree

12 files changed

+50
-14
lines changed

12 files changed

+50
-14
lines changed

e2e/components/card-e2e.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {browser, by, element} from 'protractor';
2+
import {screenshot} from '../screenshot';
3+
4+
describe('md-card', () => {
5+
describe('card-fancy', () => {
6+
beforeEach(() => browser.get('/card-fancy'));
7+
8+
it('should show a card', async () => {
9+
const card = element(by.tagName('md-card'));
10+
expect(card).toBeDefined();
11+
12+
screenshot('fancy card example');
13+
});
14+
});
15+
});

e2e/components/menu-e2e.spec.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Key, protractor, browser, by, element} from 'protractor';
1+
import {Key, protractor, browser, by, element, ExpectedConditions} from 'protractor';
22
import {screenshot} from '../screenshot';
33
import {
44
expectToExist,
@@ -8,6 +8,9 @@ import {
88
pressKeys,
99
} from '../util/index';
1010

11+
const presenceOf = ExpectedConditions.presenceOf;
12+
const not = ExpectedConditions.not;
13+
1114

1215
describe('menu', () => {
1316
const menuSelector = '.mat-menu-panel';
@@ -50,22 +53,25 @@ describe('menu', () => {
5053
screenshot();
5154
});
5255

53-
it('should support multiple triggers opening the same menu', () => {
56+
it('should support multiple triggers opening the same menu', async () => {
5457
page.triggerTwo().click();
5558

5659
expect(page.menu().getText()).toEqual('One\nTwo\nThree\nFour');
5760
expectAlignedWith(page.menu(), '#trigger-two');
5861

5962
page.backdrop().click();
60-
expectToExist(menuSelector, false);
63+
await browser.wait(not(presenceOf(element(by.css(menuSelector)))));
64+
await browser.wait(not(presenceOf(element(by.css('.cdk-overlay-backdrop')))));
6165

6266
page.trigger().click();
6367

6468
expect(page.menu().getText()).toEqual('One\nTwo\nThree\nFour');
6569
expectAlignedWith(page.menu(), '#trigger');
6670

6771
page.backdrop().click();
68-
expectToExist(menuSelector, false);
72+
73+
await browser.wait(not(presenceOf(element(by.css(menuSelector)))));
74+
await browser.wait(not(presenceOf(element(by.css('.cdk-overlay-backdrop')))));
6975
});
7076

7177
it('should mirror classes on host to menu template in overlay', () => {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"@types/node": "^7.0.21",
5757
"@types/run-sequence": "^0.0.29",
5858
"autoprefixer": "^6.7.6",
59-
"axe-core": "^2.2.1",
59+
"axe-core": "^2.3.1",
6060
"axe-webdriverjs": "^1.1.1",
6161
"chalk": "^1.1.3",
6262
"conventional-changelog": "^1.1.3",

src/e2e-app/e2e-app-module.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ import {
2424
OverlayContainer, FullscreenOverlayContainer, MdGridListModule, MdProgressBarModule,
2525
MdProgressSpinnerModule, MdTabsModule, MdRadioModule, MdSlideToggleModule, MdMenuModule,
2626
MdListModule, MdInputModule, MdIconModule, MdDialogModule, MdCheckboxModule, MdButtonModule,
27-
MdSidenavModule
27+
MdSidenavModule, MdNativeDateModule,
2828
} from '@angular/material';
29+
import {ExampleModule} from '@angular/material-examples';
2930

3031
/**
3132
* NgModule that contains all Material modules that are required to serve the e2e-app.
@@ -45,7 +46,8 @@ import {
4546
MdRadioModule,
4647
MdSidenavModule,
4748
MdSlideToggleModule,
48-
MdTabsModule
49+
MdTabsModule,
50+
MdNativeDateModule,
4951
]
5052
})
5153
export class E2eMaterialModule {}
@@ -56,6 +58,7 @@ export class E2eMaterialModule {}
5658
RouterModule.forRoot(E2E_APP_ROUTES),
5759
E2eMaterialModule,
5860
NoopAnimationsModule,
61+
ExampleModule,
5962
],
6063
declarations: [
6164
BasicTabs,

src/e2e-app/e2e-app/routes.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import {Routes} from '@angular/router';
2+
import {CardFancyExample} from '@angular/material-examples';
3+
24
import {Home} from './e2e-app';
35
import {ButtonE2E} from '../button/button-e2e';
46
import {BasicTabs} from '../tabs/tabs-e2e';
@@ -35,4 +37,5 @@ export const E2E_APP_ROUTES: Routes = [
3537
{path: 'sidenav', component: SidenavE2E},
3638
{path: 'slide-toggle', component: SlideToggleE2E},
3739
{path: 'tabs', component: BasicTabs},
40+
{path: 'card-fancy', component: CardFancyExample},
3841
];

src/e2e-app/system-config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ System.config({
2626
'node:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
2727

2828
'@angular/material': 'dist/bundles/material.umd.js',
29-
'@angular/cdk': 'dist/bundles/cdk.umd.js'
29+
'@angular/cdk': 'dist/bundles/cdk.umd.js',
30+
'@angular/material-examples': 'dist/bundles/material-examples.umd.js'
3031
},
3132
packages: {
3233
// Thirdparty barrels.

src/e2e-app/tsconfig-build.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"experimentalDecorators": true,
88
// TODO(paul): Remove once Angular has been upgraded and supports noUnusedParameters in AOT.
99
"noUnusedParameters": false,
10-
"strictNullChecks": true,
10+
// Don't use strict nulls for the e2e-app because the material-examples are not
11+
// strict-null compliant.
12+
"strictNullChecks": false,
1113
"lib": ["es6", "es2015", "dom"],
1214
"module": "commonjs",
1315
"moduleResolution": "node",
@@ -20,10 +22,11 @@
2022
"typeRoots": [
2123
"../../node_modules/@types/!(node)"
2224
],
23-
"baseUrl": "",
25+
"baseUrl": ".",
2426
"paths": {
2527
"@angular/material": ["./material"],
26-
"@angular/cdk": ["./cdk"]
28+
"@angular/cdk": ["./cdk"],
29+
"@angular/material-examples": ["./material-examples"]
2730
}
2831
},
2932
"files": [

src/material-examples/card-fancy/card-fancy-example.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<md-card-title>Shiba Inu</md-card-title>
55
<md-card-subtitle>Dog Breed</md-card-subtitle>
66
</md-card-header>
7-
<img md-card-image src="assets/img/examples/shiba2.jpg">
7+
<img md-card-image src="assets/img/examples/shiba2.jpg" alt="Photo of a Shiba Inu">
88
<md-card-content>
99
<p>
1010
The Shiba Inu is the smallest of the six original and distinct spitz breeds of dog from Japan.

src/material-examples/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './public_api';

src/material-examples/public_api.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
export * from './example-data';
22
export * from './example-module';
3+
export * from './datepicker-overview/datepicker-overview-example';
4+
export * from './card-fancy/card-fancy-example';

tools/gulp/tasks/e2e.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ task('e2e', sequenceTask(
3434
/** Task that builds the e2e-app in AOT mode. */
3535
task('e2e-app:build', sequenceTask(
3636
'clean',
37-
['material:build-release', 'cdk:build-release'],
37+
['material:build-release', 'cdk:build-release', 'material-examples:build-release'],
3838
['e2e-app:copy-release', 'e2e-app:copy-assets'],
3939
'e2e-app:build-ts'
4040
));
@@ -76,5 +76,6 @@ task('serve:e2eapp:watch', ['serve:e2eapp', 'material:watch', ':watch:e2eapp']);
7676
task('e2e-app:copy-release', () => {
7777
copySync(join(releasesDir, 'material'), join(outDir, 'material'));
7878
copySync(join(releasesDir, 'cdk'), join(outDir, 'cdk'));
79+
copySync(join(releasesDir, 'material-examples'), join(outDir, 'material-examples'));
7980
});
8081

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"paths": {
1818
"@angular/material": ["./src/lib/public_api.ts"],
1919
"@angular/cdk": ["./src/cdk/public_api.ts"],
20-
"@angular/cdk/testing": ["./src/cdk/testing"]
20+
"@angular/cdk/testing": ["./src/cdk/testing"],
21+
"@angular/material-examples": ["./src/material-examples"]
2122
}
2223
},
2324
"include": [

0 commit comments

Comments
 (0)