-
Notifications
You must be signed in to change notification settings - Fork 105
Get window size #125
base: master
Are you sure you want to change the base?
Get window size #125
Conversation
- add test for page.GetSize
I merged the |
Height int `json:"height"` | ||
}{} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove newline
@@ -19,3 +19,17 @@ func (w *Window) SetSize(width, height int) error { | |||
|
|||
return w.Send("POST", "size", request, nil) | |||
} | |||
|
|||
func (w *Window) GetSize() (width int, height int, err error) { | |||
request := struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This struct does not represent a request
|
||
Describe("#GetSize", func() { | ||
It("should successfully send a GET request to the size endpoint", func() { | ||
width, height, err := window.GetSize() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setup and test return values using the mock bus (ideally in a separate test)
session.GetWindowCall.ReturnWindow = window | ||
width, height, err := page.GetSize() | ||
Expect(err).To(Succeed()) | ||
Expect(width).To(BeNumerically(">=", 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setup return values using the mock bus
It can be useful to be able to get the browser window size.
So, I added 2 functions GetSize() in window.go and page.go (but I'm not sure to comply with method naming convention with GetSize() in page.go).
I tried to add some tests, I hope it's ok, but I'm not used to Ginkgo yet 😉.