This repository has been archived by the owner on Feb 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into add-offset-support-to-click-and-hover
# Conflicts: # example/tests/elementActions.test.js # example/tests/interceptor.test.js
- Loading branch information
Showing
16 changed files
with
355 additions
and
62 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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import { Element } from "test-juggler"; | ||
import TopBar from "../components/TopBar"; | ||
|
||
export default class FeedbackPage { | ||
class FeedbackPage { | ||
constructor() { | ||
this.TopBar = new TopBar(); | ||
this.TitleText = new Element("#feedback-title"); | ||
} | ||
} | ||
} | ||
|
||
export default new FeedbackPage(); |
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
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,120 @@ | ||
import { ApiHelpers } from "test-juggler"; | ||
|
||
describe("Helpers", () => { | ||
let apiHelpers = new ApiHelpers({ baseURL: "https://reqres.in" }); | ||
|
||
beforeEach(async () => { | ||
console.log("Running test: " + jasmine["currentTest"].fullName); | ||
}); | ||
|
||
it("should issue GET request", async () => { | ||
//Arrange, Act | ||
const response = await apiHelpers.get("/api/users/2"); | ||
|
||
//Assert | ||
expect(response.status).toEqual(200); | ||
}); | ||
|
||
it("should issue POST request", async () => { | ||
//Arrange, Act | ||
const response = await apiHelpers.post("/api/users", | ||
{ | ||
"name": "morpheus", | ||
"job": "leader" | ||
}); | ||
|
||
//Assert | ||
expect(response.status).toEqual(201); | ||
}); | ||
|
||
it("should issue PUT request", async () => { | ||
//Arrange, Act | ||
const response = await apiHelpers.put("/api/users/2", | ||
{ | ||
"name": "morpheus", | ||
"job": "zion resident" | ||
}); | ||
|
||
//Assert | ||
expect(response.status).toEqual(200); | ||
}); | ||
|
||
it("should issue PATCH request", async () => { | ||
//Arrange, Act | ||
const response = await apiHelpers.patch("/api/users/2", | ||
{ | ||
"name": "morpheus", | ||
"job": "zion resident" | ||
}); | ||
|
||
//Assert | ||
expect(response.status).toEqual(200); | ||
}); | ||
|
||
it("should issue DELETE request", async () => { | ||
//Arrange, Act | ||
const response = await apiHelpers.delete("/api/users/2"); | ||
|
||
//Assert | ||
expect(response.status).toEqual(204); | ||
}); | ||
|
||
it("should issue arbitrary request", async () => { | ||
//Arrange, Act | ||
const response = await apiHelpers.request({ | ||
method: "patch", | ||
url: "/api/users/2", | ||
data: { | ||
"name": "morpheus", | ||
"job": "zion resident" | ||
} | ||
}); | ||
|
||
//Assert | ||
expect(response.status).toEqual(200); | ||
}); | ||
|
||
it("should handle bad response", async () => { | ||
//Arrange, Act | ||
const response = await apiHelpers.get("/api/users/23"); | ||
|
||
//Assert | ||
expect(response.status).toEqual(404); | ||
}); | ||
|
||
it("should verify JSON response", async () => { | ||
//Arrange, Act | ||
const response = await apiHelpers.get("/api/users/2"); | ||
|
||
//Assert | ||
expect(response.data.data.first_name).toEqual("Janet"); | ||
}); | ||
|
||
it("should convert XML response to JSON", async () => { | ||
//Arrange | ||
const response = await apiHelpers.get("https://www.crcind.com/csp/samples/SOAP.Demo.cls?soap_method=AddInteger&Arg1=1&Arg2=2"); | ||
|
||
//Act | ||
const responseJsonData = apiHelpers.parseXml(response.data); | ||
|
||
//Assert | ||
expect(responseJsonData["SOAP-ENV:Envelope"]["SOAP-ENV:Body"][0].AddIntegerResponse[0].AddIntegerResult[0]).toEqual("3"); | ||
}); | ||
|
||
it("should issue request with basic auth", async () => { | ||
//Arrange | ||
const authedApiHelpers = new ApiHelpers({ | ||
baseURL: "https://postman-echo.com", | ||
auth: { | ||
username: "postman", | ||
password: "password" | ||
} | ||
}); | ||
|
||
//Act | ||
const response = await authedApiHelpers.get("/basic-auth"); | ||
|
||
//Assert | ||
expect(response.data.authenticated).toBe(true); | ||
}); | ||
}); |
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
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
Oops, something went wrong.