2020-04-09 17:43:26 +00:00
|
|
|
import { browser, element, by } from 'protractor';
|
|
|
|
|
|
|
|
|
|
describe('Router basic tutorial e2e tests', () => {
|
|
|
|
|
|
2020-11-23 20:17:10 +02:00
|
|
|
beforeEach(() => browser.get(''));
|
2020-04-09 17:43:26 +00:00
|
|
|
|
2020-11-23 20:17:10 +02:00
|
|
|
it('should display Angular Router Sample', async () => {
|
|
|
|
|
expect(await element(by.css('h1')).getText()).toBe('Angular Router Sample');
|
2020-04-09 17:43:26 +00:00
|
|
|
});
|
|
|
|
|
|
2020-11-23 20:17:10 +02:00
|
|
|
it('should display Crisis Center button', async () => {
|
|
|
|
|
expect(await element.all(by.css('a')).get(0).getText()).toBe('Crisis Center');
|
2020-04-09 17:43:26 +00:00
|
|
|
});
|
|
|
|
|
|
2020-11-23 20:17:10 +02:00
|
|
|
it('should display Heroes button', async () => {
|
|
|
|
|
expect(await element.all(by.css('a')).get(1).getText()).toBe('Heroes');
|
2020-04-09 17:43:26 +00:00
|
|
|
});
|
|
|
|
|
|
2020-11-23 20:17:10 +02:00
|
|
|
it('should display HEROES', async () => {
|
|
|
|
|
expect(await element(by.css('h3')).getText()).toBe('HEROES');
|
2020-04-09 17:43:26 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should change to display crisis list component', async () => {
|
|
|
|
|
const crisisButton = element.all(by.css('a')).get(0);
|
|
|
|
|
await crisisButton.click();
|
2020-11-23 20:17:10 +02:00
|
|
|
expect(await element(by.css('h3')).getText()).toBe('CRISIS CENTER');
|
2020-04-09 17:43:26 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should change to display heroes component', async () => {
|
|
|
|
|
const heroesButton = element.all(by.css('a')).get(1);
|
|
|
|
|
await heroesButton.click();
|
2020-11-23 20:17:10 +02:00
|
|
|
expect(await element(by.css('h3')).getText()).toBe('HEROES');
|
2020-04-09 17:43:26 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should use wildcard route', async () => {
|
2020-11-23 20:17:10 +02:00
|
|
|
await browser.get('/fake-page');
|
|
|
|
|
expect(await browser.getCurrentUrl()).toContain('fake-page');
|
|
|
|
|
expect(await element(by.css('h2')).getText()).toBe('Page Not Found');
|
2020-04-09 17:43:26 +00:00
|
|
|
});
|
|
|
|
|
});
|