Remove ruby files and regen tests (#1501)
Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1501 Now that we have `gentest-driver.ts` we can delete the ruby gentest. I also regened all of the tests that have a comment with the wrong file name for where it was generated. Reviewed By: yungsters, NickGerleman Differential Revision: D51956567 fbshipit-source-id: d389492e54711cf161dff9e649396cc40f1e5073
This commit is contained in:
committed by
Facebook GitHub Bot
parent
fba32ebf14
commit
e61eb0178c
@@ -1,4 +0,0 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gem 'watir', '~>7.2.0'
|
||||
gem 'webdrivers', '~> 5.3.0'
|
@@ -1,31 +0,0 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
nokogiri (1.15.4-arm64-darwin)
|
||||
racc (~> 1.4)
|
||||
racc (1.7.1)
|
||||
regexp_parser (2.8.1)
|
||||
rexml (3.2.5)
|
||||
rubyzip (2.3.2)
|
||||
selenium-webdriver (4.10.0)
|
||||
rexml (~> 3.2, >= 3.2.5)
|
||||
rubyzip (>= 1.2.2, < 3.0)
|
||||
websocket (~> 1.0)
|
||||
watir (7.2.2)
|
||||
regexp_parser (>= 1.2, < 3)
|
||||
selenium-webdriver (~> 4.2)
|
||||
webdrivers (5.3.1)
|
||||
nokogiri (~> 1.6)
|
||||
rubyzip (>= 1.3.0)
|
||||
selenium-webdriver (~> 4.0, < 4.11)
|
||||
websocket (1.2.9)
|
||||
|
||||
PLATFORMS
|
||||
arm64-darwin-22
|
||||
|
||||
DEPENDENCIES
|
||||
watir (~> 7.2.0)
|
||||
webdrivers (~> 5.3.0)
|
||||
|
||||
BUNDLED WITH
|
||||
2.4.10
|
@@ -56,7 +56,7 @@ function printTest(e, ext, LTRContainer, RTLContainer, genericContainer) {
|
||||
' */',
|
||||
ext === 'cpp' ? '\n// clang-format off' : '',
|
||||
'// @' +
|
||||
'generated by gentest/gentest.rb from gentest/fixtures/' +
|
||||
'generated by gentest/gentest-driver.ts from gentest/fixtures/' +
|
||||
document.title +
|
||||
'.html',
|
||||
'',
|
||||
|
@@ -1,81 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
require 'watir'
|
||||
require 'webdrivers'
|
||||
require 'fileutils'
|
||||
require 'optparse'
|
||||
|
||||
browser = Watir::Browser.new(:chrome, options: {
|
||||
"goog:loggingPrefs" => {
|
||||
"browser" => "ALL",
|
||||
"performance" => "ALL"
|
||||
},
|
||||
args: ['--force-device-scale-factor=1', '--window-position=0,0', '--hide-scrollbars']
|
||||
})
|
||||
|
||||
Dir.chdir(File.dirname($0))
|
||||
|
||||
options = OpenStruct.new
|
||||
OptionParser.new do |opts|
|
||||
opts.on("-s", "--suspend", "Pauses the script after each fixture to allow for debugging on Chrome. Press enter to go to the next fixure.") do
|
||||
options.suspend = true
|
||||
end
|
||||
opts.on("-f", "--fixture [FIXTURE]", String, "Only runs the script on the specific fixture.") do |f|
|
||||
fixture = "fixtures/" + f + ".html"
|
||||
if !File.file?(fixture)
|
||||
puts fixture + " does not exist."
|
||||
else
|
||||
options.fixture = fixture
|
||||
end
|
||||
end
|
||||
end.parse!
|
||||
|
||||
files = options.fixture ? options.fixture : "fixtures/*.html"
|
||||
Dir[files].each do |file|
|
||||
fixture = File.read(file)
|
||||
name = File.basename(file, '.*')
|
||||
puts "Generate #{name}"
|
||||
|
||||
ltr_fixture = fixture.gsub('start', 'left')
|
||||
.gsub('end', 'right')
|
||||
.gsub('flex-left', 'flex-start')
|
||||
.gsub('flex-right', 'flex-end')
|
||||
|
||||
rtl_fixture = fixture.gsub('start', 'right')
|
||||
.gsub('end', 'left')
|
||||
.gsub('flex-right', 'flex-start')
|
||||
.gsub('flex-left', 'flex-end')
|
||||
|
||||
template = File.open('test-template.html').read
|
||||
f = File.open('test.html', 'w')
|
||||
f.write sprintf(template, name, ltr_fixture, rtl_fixture, fixture)
|
||||
f.close
|
||||
FileUtils.copy('test.html', "#{name}.html") if $DEBUG
|
||||
|
||||
browser.goto('file://' + Dir.pwd + '/test.html')
|
||||
logs = browser.driver.logs.get(:browser)
|
||||
|
||||
f = File.open("../tests/generated/#{name}.cpp", 'w')
|
||||
f.write eval(logs[0].message.sub(/^[^"]*/, ''))
|
||||
f.close
|
||||
|
||||
f = File.open("../java/tests/com/facebook/yoga/#{name}.java", 'w')
|
||||
f.write eval(logs[1].message.sub(/^[^"]*/, '')).sub('YogaTest', name)
|
||||
f.close
|
||||
|
||||
print logs[3]
|
||||
|
||||
f = File.open("../javascript/tests/generated/#{name}.test.ts", 'w')
|
||||
f.write eval(logs[2].message.sub(/^[^"]*/, '')).sub('YogaTest', name)
|
||||
f.close
|
||||
|
||||
if options.suspend
|
||||
gets
|
||||
end
|
||||
end
|
||||
File.delete('test.html')
|
||||
browser.close
|
Reference in New Issue
Block a user