-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented steps and documentation 🎉
- Loading branch information
Showing
2 changed files
with
80 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Import the cucumber operators we need | ||
import { Before, Given, Then, When } from "cucumber"; | ||
import { AppPage } from "../app.po"; | ||
import { element, by } from "protractor"; | ||
import { expect } from "chai"; | ||
|
||
let page: AppPage; | ||
|
||
Before(() => { | ||
page = new AppPage(); | ||
}); | ||
|
||
Given("I am on the home page", async () => { | ||
// Navigate to home page. | ||
await page.navigateTo(); | ||
}); | ||
|
||
When("I click on the increment button {int} times", async (x: number) => { | ||
// Click on the increment button x times. | ||
const incrementButton = element(by.id("increment")); | ||
for (let index = 0; index < x; index++) { | ||
await incrementButton.click(); | ||
} | ||
}); | ||
|
||
Then("The counter should show {int}", (x: number) => { | ||
element(by.id("counter")) | ||
.getText() | ||
.then((value: string) => { | ||
// Expect that we get the correct value showing | ||
expect(value).to.equal(x); | ||
}) | ||
.catch((error: any) => { | ||
console.error('Error occured ', error); | ||
}); | ||
}); |