[Catalog] Revert "Snapshot Testing Proof of Concept" (#5883)

Reverts material-components/material-components-ios#5754

Travis CI on `develop` branch testing has failed since snapshot testing was introduced. Rolling it back.

https://travis-ci.org/material-components/material-components-ios/builds
This commit is contained in:
Robert Moore 2018-11-30 09:20:03 -05:00 committed by GitHub
parent 111a869381
commit 13781e6d45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 15 additions and 91 deletions

1
.gitattributes vendored
View File

@ -1 +0,0 @@
snapshot_test_goldens/**/*.png filter=lfs diff=lfs merge=lfs -text

View File

@ -229,11 +229,6 @@ run_cocoapods() {
gem install xcpretty cocoapods --no-rdoc --no-ri --no-document --quiet
pod --version
# Install git-lfs
brew install git-lfs
git lfs install
git lfs pull
fi
if [ "$DEPENDENCY_SYSTEM" = "cocoapods" ]; then

View File

@ -356,12 +356,6 @@ Pod::Spec.new do |mdc|
unit_tests.source_files = "components/#{component.base_name}/tests/unit/*.{h,m,swift}", "components/#{component.base_name}/tests/unit/supplemental/*.{h,m,swift}"
unit_tests.resources = "components/#{component.base_name}/tests/unit/resources/*"
end
tests.test_spec 'snapshot' do |snapshot_tests|
snapshot_tests.requires_app_host = true
snapshot_tests.source_files = "components/#{component.base_name}/tests/snapshot/*.{h,m,swift}", "components/#{component.base_name}/tests/snapshot/supplemental/*.{h,m,swift}"
snapshot_tests.resources = "components/#{component.base_name}/tests/snapshot/resources/*"
snapshot_tests.dependency 'iOSSnapshotTestCase', '2.2.0'
end
end
end

View File

@ -33,7 +33,7 @@
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C513816E6BA200E1B2FC1E985E620012"
BlueprintIdentifier = "153B950E9F5C9E9E4BE2D402CB52E43A"
BuildableName = "MaterialComponents-Unit-Tests.xctest"
BlueprintName = "MaterialComponents-Unit-Tests"
ReferencedContainer = "container:Pods/Pods.xcodeproj">
@ -43,7 +43,7 @@
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3171F7594A536C448D38F6611EB2A7B7"
BlueprintIdentifier = "47FB08CD9CD5B00DEC8D9A84BCFD9232"
BuildableName = "MaterialComponentsAlpha-Unit-Tests.xctest"
BlueprintName = "MaterialComponentsAlpha-Unit-Tests"
ReferencedContainer = "container:Pods/Pods.xcodeproj">
@ -61,8 +61,8 @@
</MacroExpansion>
<EnvironmentVariables>
<EnvironmentVariable
key = "FB_REFERENCE_IMAGE_DIR"
value = "$(SOURCE_ROOT)/../snapshot_test_goldens/goldens"
key = "DYLD_INSERT_LIBRARIES"
value = "@executable_path/EarlGrey.framework/EarlGrey"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>

View File

@ -26,13 +26,13 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "NO">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C513816E6BA200E1B2FC1E985E620012"
BlueprintIdentifier = "153B950E9F5C9E9E4BE2D402CB52E43A"
BuildableName = "MaterialComponents-Unit-Tests.xctest"
BlueprintName = "MaterialComponents-Unit-Tests"
ReferencedContainer = "container:Pods/Pods.xcodeproj">
@ -42,7 +42,7 @@
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3171F7594A536C448D38F6611EB2A7B7"
BlueprintIdentifier = "47FB08CD9CD5B00DEC8D9A84BCFD9232"
BuildableName = "MaterialComponentsAlpha-Unit-Tests.xctest"
BlueprintName = "MaterialComponentsAlpha-Unit-Tests"
ReferencedContainer = "container:Pods/Pods.xcodeproj">
@ -58,13 +58,6 @@
ReferencedContainer = "container:MDCDragons.xcodeproj">
</BuildableReference>
</MacroExpansion>
<EnvironmentVariables>
<EnvironmentVariable
key = "FB_REFERENCE_IMAGE_DIR"
value = "$(SOURCE_ROOT)/../snapshot_test_goldens/goldens"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>

View File

@ -13,7 +13,6 @@ target "MDCCatalog" do
'BottomNavigation/tests/unit',
'BottomSheet/tests/unit',
'Buttons/tests/unit',
'Cards/tests/snapshot',
'Cards/tests/unit',
'Chips/tests/unit',
'CollectionCells/tests/unit',

View File

@ -1,60 +0,0 @@
// Copyright 2018-present the Material Components for iOS authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#import <FBSnapshotTestCase/FBSnapshotTestCase.h>
#import "MaterialCards.h"
@interface MDCCardSnapshotTests : FBSnapshotTestCase
@end
@implementation MDCCardSnapshotTests
- (void)testDefaultCard {
// Uncomment below to recreate the golden
// self.recordMode = YES;
UIView *backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 70, 70)];
backgroundView.backgroundColor = [UIColor colorWithWhite:0.8 alpha:1];
MDCCard *card = [[MDCCard alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
[backgroundView addSubview:card];
card.center = backgroundView.center;
FBSnapshotVerifyView([self imageViewSnapshotOfView:backgroundView], nil);
}
// TODO: To be extracted into test helper method
- (UIImageView *)imageViewSnapshotOfView:(UIView *)view {
UIImage *result = nil;
if (@available(iOS 10, *)) {
UIGraphicsImageRenderer *renderer =
[[UIGraphicsImageRenderer alloc] initWithSize:view.frame.size];
result = [renderer imageWithActions:^(UIGraphicsImageRendererContext *_Nonnull context) {
BOOL success = [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES];
NSAssert(success, @"View %@ must draw correctly", view);
}];
NSAssert(result != nil, @"View %@ must render image", view);
} else {
NSAssert(NO, @"This test requires iOS 10.0 or later.");
}
UIImageView *imageView = [[UIImageView alloc] initWithFrame:view.frame];
imageView.image = result;
return imageView;
}
@end

View File

@ -50,7 +50,14 @@ did_any_fail=false
xcodebuid_test \
-workspace "$ROOT_DIR/catalog/MDCCatalog.xcworkspace" \
-scheme "MDCCatalog"
-scheme "MaterialComponents-Unit-Tests"
if [ $? -ne 0 ]; then
did_any_fail=true
fi
xcodebuid_test \
-workspace "$ROOT_DIR/catalog/MDCCatalog.xcworkspace" \
-scheme "MaterialComponentsAlpha-Unit-Tests"
if [ $? -ne 0 ]; then
did_any_fail=true
fi

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:96d48d51f415dc94427e49a361cf68cdadc86d0e00a6706894a7f82b5d13b086
size 1896