Skip to content
This repository was archived by the owner on Feb 3, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions example/tests/elementActions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,19 @@ describe("Element Actions", () => {
expect(await formElement.getAttributeValue(attributeName)).toEqual("/authenticate");
});

it("should type element's text value", async () => {
//Arrange
await page.goto("http://the-internet.herokuapp.com/inputs");
const inputElement = new Element("input[type=number]");
const inputNumber = "456";

//Act
await inputElement.enterText(inputNumber);

//Assert
expect(await inputElement.value()).toEqual(inputNumber);
});

xit("should cover element", async () => {
//TODO: Test should be added and unxit`ed when DTAF-78 is implemented.
});
Expand Down
6 changes: 6 additions & 0 deletions framework/Element.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ export default class Element {
return value;
}

async enterText(text) {
console.log(`Entering the text value for ${this.selector} ...`);
const elementHandle = await this.wait();
await elementHandle.type(text);
}

async getAttributeValue(attributeName) {
const elementHandle = await this.wait();
console.log(`Getting '${attributeName}' attribute value of element ${this.selector} ...`);
Expand Down