import { $, location, locationOf, navigateTo, steps } from '../support/world';

steps(({When, Then}) => {
  When(/^I open our app$/, () => {
    navigateTo('/');
  });
  Then(/^I should see a message saying that the app works$/, () => {
    $('app-root h1').getText().should.become('app works!');
  });
  Then(/^I should see the "(.*)" page$/, page => {
    location().should.become(locationOf(page));
  });
});

import { $, location, locationOf, navigateTo, steps } from '../support/world';

steps(({Given, When, Then}) => {
  Given(/^I am on the "(.*)" page$/, page =>
    navigateTo((locationOf(page))));
  When(/^I open our app$/, () =>
    navigateTo('/'));
  Then(/^I should see a message saying that the app works$/, () =>
    $('app-root h1').getText().should.become('app works!'));
  Then(/^I should see the "(.*)" page$/, page =>
    location().should.become(locationOf(page)));
});

Fix async e2e tests and shorten their syntax
Fix async e2e tests and shorten their syntax

It turns out that to properly support async tests,
we need to RETURN their output (as Promise) instead of just calling them.

We now use the shorthand return syntax (() => ...), which
also renders the steps more succinct.
