Skip to content
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
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ jobs:
test-remote:
docker:
- image: cimg/ruby:3.4
- image: mcr.microsoft.com/playwright:v1.62.1-noble
command: /bin/sh -c "cd /home/pwuser && npm install --no-save playwright-core@1.62.1 && ./node_modules/.bin/playwright-core install && ./node_modules/.bin/playwright-core run-server --port 8888 --host 0.0.0.0 --path /ws"
- image: mcr.microsoft.com/playwright:v1.63.0-noble
command: /bin/sh -c "cd /home/pwuser && npm install --no-save playwright-core@1.63.0 && ./node_modules/.bin/playwright-core install && ./node_modules/.bin/playwright-core run-server --port 8888 --host 0.0.0.0 --path /ws"
environment:
DEBUG: "pw:*"
user: pwuser
Expand Down
2 changes: 1 addition & 1 deletion development/CLI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.62.1
1.63.0
2,344 changes: 1,948 additions & 396 deletions development/api.json

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions development/generate_api/example_codes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,12 @@ def example_7c9cfab83defacca7518fb1e95efb47bdd2a9ba0e6be836e973be19d8b4c4cb7(fra
locator.click
end

# Frame#frame_locator
def example_b5fadfd47db49d4381a9f484bc41745d0c9f176fce56203a73bafb17ca54c20a(frame:)
locator = frame.frame_locator.get_by_role('button')
locator.click
end

# Frame#get_by_alt_text
def example_40a7d124045a4f729e0deddcfb511b9232ada7f16e0caa4e07ea083c2bfd3c16(page:)
page.get_by_alt_text("Playwright logo").click
Expand Down Expand Up @@ -815,6 +821,15 @@ def example_a9d648fee9c328e08fc365f5f04a073d479a0b068248ac49cd10e4a0a2ce561b(pag
locator.get_attribute('src') # => frame1.html
end

# FrameLocator
def example_9ee987e2edbb4979dd4f859118075cceed3d3105cf612152e5a3a722c19b0c5b(page:)
# Finds the button in any frame on the page:
page.frame_locator.get_by_role('button').click

# Finds the iframe anywhere on the page and clicks the button inside it:
page.frame_locator.locator('#my-frame').content_frame.get_by_role('button').click
end

# JSHandle
def example_c408a96b8ac9c9bd54d915009c8b477eb75b7bf9e879fd76b32f3d4b6340a667(page:)
window_handle = page.evaluate_handle("window")
Expand Down Expand Up @@ -1211,6 +1226,11 @@ def example_ead0dc91ccaf4d3de1e28cccdadfacb0e75c79ffcfb8fc5a2b55afa736870fa6(pag
page.get_by_role("checkbox").uncheck
end

# Locator#visible
def example_29b5672d77ce36156e932588ac4f0254f2e2fc3c9ab5e527734d84a5101772a6(page:)
page.locator('button').visible.click
end

# Locator#visible?
def example_b54ab20fe81143e0242d5d001ce2b1af4a272a2cc7c9d6925551de10f46a68c4(page:)
visible = page.get_by_role("button").visible?
Expand Down Expand Up @@ -1685,6 +1705,12 @@ def example_e2abd82db97f2a0531855941d4ae70ef68fe8f844318e7a474d14a217dfd2595(pag
locator.click
end

# Page#frame_locator
def example_baa3371b838c7b85056072b30bb30405debbc593119cd8cb214052f338aca062(page:)
locator = page.frame_locator.get_by_role('button')
locator.click
end

# Page#pdf
def example_e079fbec8ee0607ee45cdca94df61dea36f7fd3840986d5f4ac24918569a5f5e(page:)
# generates a pdf with "screen" media type.
Expand Down
11 changes: 10 additions & 1 deletion development/generate_api/models/documented_method_args.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ def js_type
end
end

class OptionalPositionalArg < OptionalArg
def options?
false
end
end

class OptionalKwArg
def initialize(doc)
@doc = doc
Expand All @@ -63,7 +69,8 @@ class BlockArg
# @param inflector [Dry::Inflector]
# @param arg_docs [Array<ArgDoc>]
# @param with_block [Boolean]
def initialize(inflector, arg_docs, with_block: false)
# @param optional_positional_args [Array<String>] Optional arguments that preserve the implementation's positional API.
def initialize(inflector, arg_docs, with_block: false, optional_positional_args: [])
@inflector = inflector

# Some API definitions have preceding "options = {}" before python's optional parameters (ex: ElementHandle#select_option)
Expand All @@ -72,6 +79,8 @@ def initialize(inflector, arg_docs, with_block: false)
@args = arg_docs.each_with_object([]) do |arg_doc, args|
if arg_doc.required?
args << RequiredArg.new(arg_doc)
elsif optional_positional_args.include?(arg_doc.name)
args << OptionalPositionalArg.new(arg_doc)
elsif !arg_doc.langs.only_python?
ruby_optional_args << OptionalArg.new(arg_doc)
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ def method_name
end

def method_args
@method_args ||= DocumentedMethodArgs.new(@inflector, @doc.arg_docs, with_block: has_block?)
@method_args ||= DocumentedMethodArgs.new(
@inflector,
@doc.arg_docs,
with_block: has_block?,
optional_positional_args: @method.parameters.select { |kind, _| kind == :opt }.map { |_, name| name.to_s },
)
end

def has_block?
Expand Down
2 changes: 2 additions & 0 deletions development/generate_api/renderers/apidoc_renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ def render_for_method_definition
case arg
when DocumentedMethodArgs::RequiredArg
arg.name
when DocumentedMethodArgs::OptionalPositionalArg
"#{arg.name} = nil"
when DocumentedMethodArgs::OptionalArg, DocumentedMethodArgs::OptionalKwArg
"#{arg.name}: nil"
when DocumentedMethodArgs::BlockArg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ def render_for_method_definition
case arg
when DocumentedMethodArgs::RequiredArg
arg.name
when DocumentedMethodArgs::OptionalPositionalArg
"#{arg.name} = nil"
when DocumentedMethodArgs::OptionalArg, DocumentedMethodArgs::OptionalKwArg
"#{arg.name}: nil"
when DocumentedMethodArgs::BlockArg
Expand All @@ -359,7 +361,7 @@ def render_for_method_definition
def render_for_method_call
args_for_method_call = @documented_args.map do |arg|
case arg
when DocumentedMethodArgs::RequiredArg
when DocumentedMethodArgs::RequiredArg, DocumentedMethodArgs::OptionalPositionalArg
"unwrap_impl(#{arg.name})"
when DocumentedMethodArgs::OptionalArg, DocumentedMethodArgs::OptionalKwArg
"#{arg.name}: unwrap_impl(#{arg.name})"
Expand Down
2 changes: 2 additions & 0 deletions development/generate_api/renderers/rbs_renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ def render_for_method_definition
case arg
when DocumentedMethodArgs::RequiredArg
"#{arg.js_type.ruby_signature} #{RESERVED_NAME_MAP[arg.name] || arg.name}"
when DocumentedMethodArgs::OptionalPositionalArg
"?#{arg.js_type.ruby_signature} #{RESERVED_NAME_MAP[arg.name] || arg.name}"
when DocumentedMethodArgs::OptionalArg, DocumentedMethodArgs::OptionalKwArg
"?#{arg.name}: #{arg.js_type.ruby_signature}"
when DocumentedMethodArgs::BlockArg
Expand Down
Loading
Loading