Skip to content

Commit 8e6bee8

Browse files
crisbetoandrewseguin
authored andcommitted
chore: reorganize e2e test files (#5032)
* Renames the e2e test file to match the pattern of `{{component}}-e2e.spec.ts`. * Flattens the directory structure in the `e2e` directory. Having a separate dir for each component was overkill since only have one file per component. * Fixes some inconsistent code styles in the Protractor config. Fixes #5030.
1 parent 21f764c commit 8e6bee8

18 files changed

+45
-60
lines changed

e2e/components/block-scroll-strategy/block-scroll-strategy.e2e.ts renamed to e2e/components/block-scroll-strategy-e2e.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {browser, Key, element, by} from 'protractor';
2-
import {screenshot} from '../../screenshot';
3-
import {getScrollPosition} from '../../util/index';
2+
import {screenshot} from '../screenshot';
3+
import {getScrollPosition} from '../util/index';
44

55

66
describe('scroll blocking', () => {

e2e/components/button/button.e2e.ts renamed to e2e/components/button-e2e.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {browser, by, element, ExpectedConditions} from 'protractor';
2-
import {screenshot} from '../../screenshot';
2+
import {screenshot} from '../screenshot';
33

44

55
describe('button', () => {

e2e/components/checkbox/checkbox.e2e.ts renamed to e2e/components/checkbox-e2e.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {browser, by, element, Key, ExpectedConditions} from 'protractor';
2-
import {screenshot} from '../../screenshot';
2+
import {screenshot} from '../screenshot';
33

44

55
describe('checkbox', () => {

e2e/components/dialog/dialog.e2e.ts renamed to e2e/components/dialog-e2e.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
pressKeys,
66
clickElementAtPoint,
77
waitForElement,
8-
} from '../../util/index';
8+
} from '../util/index';
99

1010

1111
describe('dialog', () => {

e2e/components/grid-list/grid-list.e2e.ts renamed to e2e/components/grid-list-e2e.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {browser} from 'protractor';
2-
import {expectToExist} from '../../util/index';
3-
import {screenshot} from '../../screenshot';
2+
import {expectToExist} from '../util/index';
3+
import {screenshot} from '../screenshot';
44

55
describe('grid-list', () => {
66
beforeEach(() => browser.get('/grid-list'));

e2e/components/icon/icon.e2e.ts renamed to e2e/components/icon-e2e.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {browser, by, element} from 'protractor';
2-
import {screenshot} from '../../screenshot';
2+
import {screenshot} from '../screenshot';
33

44

55
describe('icon', () => {
File renamed without changes.

e2e/components/list/list.e2e.ts renamed to e2e/components/list-e2e.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {browser} from 'protractor';
2-
import {expectToExist} from '../../util/index';
3-
import {screenshot} from '../../screenshot';
2+
import {expectToExist} from '../util/index';
3+
import {screenshot} from '../screenshot';
44

55
describe('list', () => {
66
beforeEach(() => browser.get('/list'));

e2e/components/menu/menu.e2e.ts renamed to e2e/components/menu-e2e.spec.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import {Key, protractor} from 'protractor';
2-
import {MenuPage} from './menu-page';
3-
import {screenshot} from '../../screenshot';
1+
import {Key, protractor, browser, by, element, ElementFinder} from 'protractor';
2+
import {screenshot} from '../screenshot';
43
import {
54
expectToExist,
65
expectAlignedWith,
76
expectFocusOn,
87
expectLocation,
98
pressKeys,
10-
} from '../../util/index';
9+
} from '../util/index';
1110

1211

1312
describe('menu', () => {
@@ -192,3 +191,22 @@ describe('menu', () => {
192191

193192
});
194193
});
194+
195+
196+
export class MenuPage {
197+
constructor() { browser.get('/menu'); }
198+
menu = () => element(by.css('.mat-menu-panel'));
199+
start = () => element(by.id('start'));
200+
trigger = () => element(by.id('trigger'));
201+
triggerTwo = () => element(by.id('trigger-two'));
202+
backdrop = () => element(by.css('.cdk-overlay-backdrop'));
203+
items = (index: number) => element.all(by.css('[md-menu-item]')).get(index);
204+
textArea = () => element(by.id('text'));
205+
beforeTrigger = () => element(by.id('before-t'));
206+
aboveTrigger = () => element(by.id('above-t'));
207+
combinedTrigger = () => element(by.id('combined-t'));
208+
beforeMenu = () => element(by.css('.mat-menu-panel.before'));
209+
aboveMenu = () => element(by.css('.mat-menu-panel.above'));
210+
combinedMenu = () => element(by.css('.mat-menu-panel.combined'));
211+
getResultText = () => this.textArea().getText();
212+
}

0 commit comments

Comments
 (0)