playwright-ruby-client 1.17.1 → 1.18.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/docs/api/api_request_context.md +45 -133
  3. data/documentation/docs/api/browser_context.md +0 -4
  4. data/documentation/docs/api/download.md +1 -3
  5. data/documentation/docs/api/frame.md +1 -1
  6. data/documentation/docs/api/frame_locator.md +10 -1
  7. data/documentation/docs/api/locator.md +19 -47
  8. data/documentation/docs/api/page.md +1 -1
  9. data/documentation/docs/include/api_coverage.md +16 -28
  10. data/lib/playwright/channel_owners/api_request_context.rb +0 -232
  11. data/lib/playwright/channel_owners/browser_context.rb +6 -3
  12. data/lib/playwright/channel_owners/frame.rb +2 -2
  13. data/lib/playwright/channel_owners/local_utils.rb +14 -0
  14. data/lib/playwright/channel_owners/page.rb +2 -6
  15. data/lib/playwright/frame_locator_impl.rb +2 -1
  16. data/lib/playwright/locator_impl.rb +62 -3
  17. data/lib/playwright/tracing_impl.rb +21 -7
  18. data/lib/playwright/version.rb +2 -2
  19. data/lib/playwright_api/api_request_context.rb +55 -8
  20. data/lib/playwright_api/browser_context.rb +6 -6
  21. data/lib/playwright_api/download.rb +0 -4
  22. data/lib/playwright_api/frame.rb +2 -2
  23. data/lib/playwright_api/frame_locator.rb +11 -2
  24. data/lib/playwright_api/local_utils.rb +9 -0
  25. data/lib/playwright_api/locator.rb +16 -46
  26. data/lib/playwright_api/page.rb +7 -7
  27. metadata +7 -10
  28. data/documentation/docs/api/api_request.md +0 -7
  29. data/documentation/docs/api/api_response.md +0 -90
  30. data/lib/playwright/api_response_impl.rb +0 -73
  31. data/lib/playwright_api/api_request.rb +0 -18
  32. data/lib/playwright_api/api_response.rb +0 -68
@@ -1,90 +0,0 @@
1
- ---
2
- sidebar_position: 10
3
- ---
4
-
5
- # APIResponse
6
-
7
- [APIResponse](./api_response) class represents responses returned by [APIRequestContext#get](./api_request_context#get) and similar methods.
8
-
9
- ## body
10
-
11
- ```
12
- def body
13
- ```
14
-
15
- Returns the buffer with response body.
16
-
17
- ## dispose
18
-
19
- ```
20
- def dispose
21
- ```
22
-
23
- Disposes the body of this response. If not called then the body will stay in memory until the context closes.
24
-
25
- ## headers
26
-
27
- ```
28
- def headers
29
- ```
30
-
31
- An object with all the response HTTP headers associated with this response.
32
-
33
- ## headers_array
34
-
35
- ```
36
- def headers_array
37
- ```
38
-
39
- An array with all the request HTTP headers associated with this response. Header names are not lower-cased. Headers with
40
- multiple entries, such as `Set-Cookie`, appear in the array multiple times.
41
-
42
- ## json
43
-
44
- ```
45
- def json
46
- ```
47
-
48
- Returns the JSON representation of response body.
49
-
50
- This method will throw if the response body is not parsable via `JSON.parse`.
51
-
52
- ## ok
53
-
54
- ```
55
- def ok
56
- ```
57
-
58
- Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
59
-
60
- ## status
61
-
62
- ```
63
- def status
64
- ```
65
-
66
- Contains the status code of the response (e.g., 200 for a success).
67
-
68
- ## status_text
69
-
70
- ```
71
- def status_text
72
- ```
73
-
74
- Contains the status text of the response (e.g. usually an "OK" for a success).
75
-
76
- ## text
77
-
78
- ```
79
- def text
80
- ```
81
-
82
- Returns the text representation of response body.
83
-
84
- ## url
85
-
86
- ```
87
- def url
88
- ```
89
-
90
- Contains the URL of the response.
@@ -1,73 +0,0 @@
1
- module Playwright
2
- define_api_implementation :APIResponseImpl do
3
- include Utils::Errors::SafeCloseError
4
-
5
- # @params context [APIRequestContext]
6
- # @params initializer [Hash]
7
- def initialize(context, initializer)
8
- @request = context
9
- @initializer = initializer
10
- @headers = RawHeaders.new(initializer['headers'])
11
- end
12
-
13
- def to_s
14
- "#<APIResponse url=#{url} status=#{status} status_text=#{status_text}>"
15
- end
16
-
17
- def url
18
- @initializer['url']
19
- end
20
-
21
- def ok
22
- (200...300).include?(status)
23
- end
24
- alias_method :ok?, :ok
25
-
26
- def status
27
- @initializer['status']
28
- end
29
-
30
- def status_text
31
- @initializer['statusText']
32
- end
33
-
34
- def headers
35
- @headers.headers
36
- end
37
-
38
- def headers_array
39
- @headers.headers_array
40
- end
41
-
42
- class AlreadyDisposedError < StandardError
43
- def initialize
44
- super('Response has been disposed')
45
- end
46
- end
47
-
48
- def body
49
- binary = @request.channel.send_message_to_server("fetchResponseBody", fetchUid: fetch_uid)
50
- raise AlreadyDisposedError.new unless binary
51
- Base64.strict_decode64(binary)
52
- rescue => err
53
- if safe_close_error?(err)
54
- raise AlreadyDisposedError.new
55
- else
56
- raise
57
- end
58
- end
59
- alias_method :text, :body
60
-
61
- def json
62
- JSON.parse(text)
63
- end
64
-
65
- def dispose
66
- @request.channel.send_message_to_server("disposeAPIResponse", fetchUid: fetch_uid)
67
- end
68
-
69
- private def fetch_uid
70
- @initializer['fetchUid']
71
- end
72
- end
73
- end
@@ -1,18 +0,0 @@
1
- module Playwright
2
- # Exposes API that can be used for the Web API testing.
3
- class APIRequest < PlaywrightApi
4
-
5
- # Creates new instances of `APIRequestContext`.
6
- def new_context(
7
- baseURL: nil,
8
- extraHTTPHeaders: nil,
9
- httpCredentials: nil,
10
- ignoreHTTPSErrors: nil,
11
- proxy: nil,
12
- storageState: nil,
13
- timeout: nil,
14
- userAgent: nil)
15
- raise NotImplementedError.new('new_context is not implemented yet.')
16
- end
17
- end
18
- end
@@ -1,68 +0,0 @@
1
- module Playwright
2
- # `APIResponse` class represents responses returned by [`method: APIRequestContext.get`] and similar methods.
3
- class APIResponse < PlaywrightApi
4
-
5
- # Returns the buffer with response body.
6
- def body
7
- wrap_impl(@impl.body)
8
- end
9
-
10
- # Disposes the body of this response. If not called then the body will stay in memory until the context closes.
11
- def dispose
12
- wrap_impl(@impl.dispose)
13
- end
14
-
15
- # An object with all the response HTTP headers associated with this response.
16
- def headers
17
- wrap_impl(@impl.headers)
18
- end
19
-
20
- # An array with all the request HTTP headers associated with this response. Header names are not lower-cased. Headers with
21
- # multiple entries, such as `Set-Cookie`, appear in the array multiple times.
22
- def headers_array
23
- wrap_impl(@impl.headers_array)
24
- end
25
-
26
- # Returns the JSON representation of response body.
27
- #
28
- # This method will throw if the response body is not parsable via `JSON.parse`.
29
- def json
30
- wrap_impl(@impl.json)
31
- end
32
-
33
- # Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
34
- def ok
35
- wrap_impl(@impl.ok)
36
- end
37
-
38
- # Contains the status code of the response (e.g., 200 for a success).
39
- def status
40
- wrap_impl(@impl.status)
41
- end
42
-
43
- # Contains the status text of the response (e.g. usually an "OK" for a success).
44
- def status_text
45
- wrap_impl(@impl.status_text)
46
- end
47
-
48
- # Returns the text representation of response body.
49
- def text
50
- wrap_impl(@impl.text)
51
- end
52
-
53
- # Contains the URL of the response.
54
- def url
55
- wrap_impl(@impl.url)
56
- end
57
-
58
- # @nodoc
59
- def ok?
60
- wrap_impl(@impl.ok?)
61
- end
62
-
63
- # @nodoc
64
- def to_s
65
- wrap_impl(@impl.to_s)
66
- end
67
- end
68
- end