build: run tslint against e2e directory (#2945)

* Now runs TSLint also against the e2e/ directory.
* Add comments for the different tasks in the lint file.
* Refactors the screenshot e2e file to pass TSLint and also to be less nested.
This commit is contained in:
Paul Gschwendtner
2017-02-07 00:00:26 +01:00
committed by tinayuangao
parent 328f7ef5de
commit d9f57001cd
4 changed files with 32 additions and 28 deletions
+24 -24
View File
@@ -1,38 +1,38 @@
import {browser, by, element, Key, ProtractorBy} from 'protractor';
import {browser, by, element} from 'protractor';
describe('fullscreen', () => {
beforeEach(() => browser.get('/fullscreen'));
let overlayInBody = () =>
browser.isElementPresent(by.css('body > .cdk-overlay-container') as ProtractorBy);
let overlayInFullscreen = () =>
browser.isElementPresent(by.css('#fullscreenpane > .cdk-overlay-container') as ProtractorBy);
beforeEach(() => browser.get('/fullscreen'));
it('should open a dialog inside a fullscreen element and move it to the document body', () => {
element(by.id('fullscreen')).click();
element(by.id('dialog')).click();
overlayInFullscreen().then((isPresent: boolean) => {
expect(isPresent).toBe(true);
element(by.id('exitfullscreenindialog')).click();
overlayInBody().then((isPresent: boolean) => {
expect(isPresent).toBe(true);
});
});
expectOverlayInFullscreen();
element(by.id('exitfullscreenindialog')).click();
expectOverlayInBody();
});
it('should open a dialog inside the document body and move it to a fullscreen element', () => {
element(by.id('dialog')).click();
overlayInBody().then((isPresent: boolean) => {
expect(isPresent).toBe(true);
element(by.id('fullscreenindialog')).click();
overlayInFullscreen().then((isPresent: boolean) => {
expect(isPresent).toBe(true);
element(by.id('exitfullscreenindialog')).click();
overlayInBody().then((isPresent: boolean) => {
expect(isPresent).toBe(true);
});
});
});
expectOverlayInBody();
element(by.id('fullscreenindialog')).click();
expectOverlayInFullscreen();
element(by.id('exitfullscreenindialog')).click();
expectOverlayInBody();
});
/** Expects the overlay container to be inside of the body element. */
function expectOverlayInBody() {
expect(browser.isElementPresent(by.css('body > .cdk-overlay-container'))).toBe(true);
}
/** Expects the overlay container to be in fullscreen mode. */
function expectOverlayInFullscreen() {
expect(browser.isElementPresent(by.css('#fullscreenpane > .cdk-overlay-container'))).toBe(true);
}
});
+1 -1
View File
@@ -1,4 +1,4 @@
import {browser, Key, protractor} from 'protractor';
import {Key, protractor} from 'protractor';
import {MenuPage} from './menu-page';
import {expectToExist, expectAlignedWith, expectFocusOn, expectLocation} from '../../util/asserts';
import {pressKeys} from '../../util/actions';
-1
View File
@@ -1,5 +1,4 @@
import * as fs from 'fs';
import * as gulp from 'gulp';
import * as path from 'path';
import {browser} from 'protractor';
+7 -2
View File
@@ -1,10 +1,15 @@
import gulp = require('gulp');
import {execNodeTask} from '../task_helpers';
gulp.task('lint', ['tslint', 'stylelint', 'madge']);
/** Task that runs madge to detect circular dependencies. */
gulp.task('madge', ['build:release'], execNodeTask('madge', ['--circular', './dist']));
/** Task to lint Angular Material's scss stylesheets. */
gulp.task('stylelint', execNodeTask(
'stylelint', ['src/**/*.scss', '--config', 'stylelint-config.json', '--syntax', 'scss']
));
gulp.task('tslint', execNodeTask('tslint', ['-c', 'tslint.json', 'src/**/*.ts']));
/** Task to run TSLint against the e2e/ and src/ directories. */
gulp.task('tslint', execNodeTask('tslint', ['-c', 'tslint.json', 'src/**/*.ts', 'e2e/**/*.ts']));