Skip to content

Commit fd180de

Browse files
NickGerlemanfacebook-github-bot
authored andcommitted
Fix Generation of Tests from Fixtures
Summary: #1116 added a change to the test generator "gentests.rb" to support a newer version of chromedriver, along with a change to the enum generator (not touched in this diff) to produce code consistent with the current tests, which seem to have been manually edited since last generation. I had trouble running the test generator locally, because it relies on unversioned third-party dependencies, whose APIs change. Looking at source history, it seems like each time someone wants to run the script, they end up updating its syntax to match whatever versions they pull in. This change adds a Gemfile and lock so that that the version of "watir" is locked, and so that we will also automatically pull in a consistent "chomedriver" version via the "webdrivers" gem. It includes the updates from the PR to be consistent with already output tests, and I have also updated the copyright header generation to no longer create lint warnings on newly generated tests (some of the previous ones were fixed manually it looks like). The test generator would still produce bodies which would fail clang-format, and were manually edited (causing generation to emit new lint warnings), so I updated the generator to suppress clang-format in the body of the generated files. Three tests, around the interaction of minimum dimensions and flexible children produce different results in Chrome now compared to when the tests were added, so running `gentests.rb` creates tests which break UTs. This doesn't seem like any sort of rounding, or device specific difference, so I have disabled these tests for now. While digging around, it does look like Chrome periodically will fix bugs in its own layout implementation which cause differences, like https://bugs.chromium.org/p/chromium/issues/detail?id=927066 Reviewed By: rozele, Andrey-Mishanin Differential Revision: D39907416 fbshipit-source-id: f88714ff038b42f935901783452df25eabb6ebb1
1 parent 7d37b2e commit fd180de

80 files changed

Lines changed: 566 additions & 1541 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Instead of manually writing a test which ensures parity with web implementations
1818

1919
Run `gentest/gentest.rb` to generate test code and re-run `buck test //:yoga` to validate the behavior. One test case will be generated for every root `div` in the input html.
2020

21-
You may need to install the latest watir-webdriver gem (`gem install watir-webdriver`) and [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/) to run `gentest/gentest.rb` Ruby script.
21+
You should run `bundle install` in the `gentest` directory to install dependencies for the `gentest/gentest.rb` Ruby script.
2222

2323
### .NET
2424
.NET testing is not integrated in buck yet, you might need to set up .NET testing environment. We have a script which to launch C# test on macOS, `csharp/tests/Facebook.Yoga/test_macos.sh`.

csharp/tests/Facebook.Yoga/YGAbsolutePositionTest.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
/**
2-
* Copyright (c) Facebook, Inc. and its affiliates.
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
33
*
4-
* This source code is licensed under the MIT license found in the LICENSE
5-
* file in the root directory of this source tree.
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
66
*/
7+
78
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAbsolutePositionTest.html
89

910
using System;

csharp/tests/Facebook.Yoga/YGAlignContentTest.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
/**
2-
* Copyright (c) Facebook, Inc. and its affiliates.
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
33
*
4-
* This source code is licensed under the MIT license found in the LICENSE
5-
* file in the root directory of this source tree.
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
66
*/
7+
78
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignContentTest.html
89

910
using System;

csharp/tests/Facebook.Yoga/YGAlignItemsTest.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
/**
2-
* Copyright (c) Facebook, Inc. and its affiliates.
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
33
*
4-
* This source code is licensed under the MIT license found in the LICENSE
5-
* file in the root directory of this source tree.
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
66
*/
7+
78
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignItemsTest.html
89

910
using System;

csharp/tests/Facebook.Yoga/YGAlignSelfTest.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
/**
2-
* Copyright (c) Facebook, Inc. and its affiliates.
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
33
*
4-
* This source code is licensed under the MIT license found in the LICENSE
5-
* file in the root directory of this source tree.
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
66
*/
7+
78
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignSelfTest.html
89

910
using System;

csharp/tests/Facebook.Yoga/YGAndroidNewsFeed.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
/**
2-
* Copyright (c) Facebook, Inc. and its affiliates.
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
33
*
4-
* This source code is licensed under the MIT license found in the LICENSE
5-
* file in the root directory of this source tree.
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
66
*/
7+
78
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAndroidNewsFeed.html
89

910
using System;

csharp/tests/Facebook.Yoga/YGBorderTest.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
/**
2-
* Copyright (c) Facebook, Inc. and its affiliates.
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
33
*
4-
* This source code is licensed under the MIT license found in the LICENSE
5-
* file in the root directory of this source tree.
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
66
*/
7+
78
// @Generated by gentest/gentest.rb from gentest/fixtures/YGBorderTest.html
89

910
using System;

csharp/tests/Facebook.Yoga/YGDimensionTest.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
/**
2-
* Copyright (c) Facebook, Inc. and its affiliates.
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
33
*
4-
* This source code is licensed under the MIT license found in the LICENSE
5-
* file in the root directory of this source tree.
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
66
*/
7+
78
// @Generated by gentest/gentest.rb from gentest/fixtures/YGDimensionTest.html
89

910
using System;

csharp/tests/Facebook.Yoga/YGDisplayTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) Facebook, Inc. and its affiliates.
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.

csharp/tests/Facebook.Yoga/YGFlexDirectionTest.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
/**
2-
* Copyright (c) Facebook, Inc. and its affiliates.
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
33
*
4-
* This source code is licensed under the MIT license found in the LICENSE
5-
* file in the root directory of this source tree.
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
66
*/
7+
78
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexDirectionTest.html
89

910
using System;

0 commit comments

Comments
 (0)