Skip to content

Commit

Permalink
fix note
Browse files Browse the repository at this point in the history
  • Loading branch information
YusukeIwaki committed Nov 3, 2024
1 parent b2f66ec commit f0d3024
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 24 deletions.
55 changes: 31 additions & 24 deletions development/generate_api/models/doc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,39 @@ def name
# @returns [String|nil]
def comment_with_python_codes
@json['spec'].filter_map do |spec|
case spec['type']
when 'text'
"\n#{spec['text'].gsub('↵', "\n")}"
when 'code'
case spec['codeLang']
when 'js', 'js browser', 'java', 'csharp', 'python async'
nil # ignore.
else
code = spec['lines'].join("\n")
"\n```#{spec['codeLang']}\n#{code}\n```"
end
when 'li'
case spec['liType']
when 'bullet'
"- #{spec['text'].gsub('↵', " ")}"
when 'ordinal'
"1. #{spec['text'].gsub('↵', " ")}"
else
raise "Unknown liType: #{spec['liType']}"
end
when 'note'
"\n**NOTE**: #{spec['text'].gsub('↵', "\n")}"
parse_spec(spec)
end.join("\n")
end

private def parse_spec(spec)
case spec['type']
when 'text'
"\n#{spec['text'].gsub('↵', "\n")}"
when 'code'
case spec['codeLang']
when 'js', 'js browser', 'java', 'csharp', 'python async'
nil # ignore.
else
raise "Unknown spec type: #{spec['type']}"
code = spec['lines'].join("\n")
"\n```#{spec['codeLang']}\n#{code}\n```"
end
end.join("\n")
when 'li'
case spec['liType']
when 'bullet'
"- #{spec['text'].gsub('↵', " ")}"
when 'ordinal'
"1. #{spec['text'].gsub('↵', " ")}"
else
raise "Unknown liType: #{spec['liType']}"
end
when 'note'
children = spec['children'].filter_map do |child|
parse_spec(child)
end
"\n**NOTE**: #{children.join("\n")}"
else
raise "Unknown spec type: #{spec['type']}"
end
end

private def json_with_python_override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def initialize(target_classes)
end

def render
FileUtils.mkdir_p(File.join('.', 'documentation', 'docs', 'include'))
File.open(File.join('.', 'documentation', 'docs', 'include', 'api_coverage.md'), 'w') do |f|
f.write("# API coverages\n")

Expand Down
29 changes: 29 additions & 0 deletions development/unimplemented_examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,32 @@ Excample codes in API documentation is replaces with the methods defined in deve

The examples listed below is not yet implemented, and documentation shows Python code.


### example_388f0632ba64c07369bdd5e8fe0bfaf07d94a1b576444d4045d9787b2672e7d8 (FrameLocator)

```
locator = page.locator("my-frame").content_frame.get_by_text("Submit")
locator.click()
```

### example_32979c158691d02e6365a178a0ac9443ee6ef2b870815f0930199e8f39c43a5f (FrameLocator)

```
# Throws if there are several frames in DOM:
page.locator('.result-frame').content_frame.get_by_role('button').click()
# Works because we explicitly tell locator to pick the first frame:
page.locator('.result-frame').first.content_frame.get_by_role('button').click()
```

### example_a9d648fee9c328e08fc365f5f04a073d479a0b068248ac49cd10e4a0a2ce561b (FrameLocator#owner)

```
frame_locator = page.locator("iframe[name=\"embedded\"]").content_frame
# ...
locator = frame_locator.owner
expect(locator).to_be_visible()
```

0 comments on commit f0d3024

Please sign in to comment.