(see commits for details)
ng new your-app-name
npm i cucumber @types/cucumber chai @types/chai protractor-cucumber-framework -D
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
specs: [
'./src/**/*.feature'
],
cucumberOpts: {
compiler: "ts:ts-node/register",
require: [
'./src/**/*.steps.ts'
]
},
Feature: basic test
Scenario: check content
Given the page is opened
Then I should see the welcome message 'Welcome to your-app-name!'
import {Given, When, Then, Before} from 'cucumber';
import {expect} from 'chai';
import {AppPage} from './app.po';
let page: AppPage;
Before(() => page = new AppPage());
Given('the page is opened', () => {
return page.navigateTo();
});
Then('I should see the welcome message {string}', async (text: string) => {
const paragraphText = await page.getParagraphText();
return expect(paragraphText).to.equal(text);
});