Skip to content

Commit

Permalink
Add accessibility testing (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
trevor-e authored Jul 15, 2024
1 parent 4cf3fa8 commit f490638
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 16 deletions.
46 changes: 31 additions & 15 deletions ios/HackerNews.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
A495B2952BFEA11B00A8A8A9 /* Reaper in Frameworks */ = {isa = PBXBuildFile; productRef = A495B2942BFEA11B00A8A8A9 /* Reaper */; };
A49933942AA28B5900DED8B1 /* StoryViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A48C0DE92A9819E00034CC0A /* StoryViewModel.swift */; };
A49933952AA28B6500DED8B1 /* StoryScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = A48C0DE62A9818A50034CC0A /* StoryScreen.swift */; };
A4BED5BC2ACE178C001642B3 /* SnapshottingTests in Frameworks */ = {isa = PBXBuildFile; productRef = A4BED5BB2ACE178C001642B3 /* SnapshottingTests */; };
A4BED5BE2ACE17B3001642B3 /* Snapshotting in Frameworks */ = {isa = PBXBuildFile; productRef = A4BED5BD2ACE17B3001642B3 /* Snapshotting */; };
A4BED5C32AD5E083001642B3 /* (null) in Frameworks */ = {isa = PBXBuildFile; };
A4BED5C42AD5E083001642B3 /* (null) in Frameworks */ = {isa = PBXBuildFile; };
A4D28AEE2C237E2A007F20D0 /* SnapshotPreferences in Frameworks */ = {isa = PBXBuildFile; productRef = A4D28AED2C237E2A007F20D0 /* SnapshotPreferences */; };
A4D28AF02C237E2A007F20D0 /* SnapshottingTests in Frameworks */ = {isa = PBXBuildFile; productRef = A4D28AEF2C237E2A007F20D0 /* SnapshottingTests */; };
A9DF68FF511E48048B0A703D /* Sentry in Frameworks */ = {isa = PBXBuildFile; productRef = 673236B0A4D04137A0D80A76 /* Sentry */; };
/* End PBXBuildFile section */

Expand All @@ -57,6 +57,19 @@
};
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
A4D28AE92C237BAE007F20D0 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
1DF161F92A4346F6001A3F76 /* StoryRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoryRow.swift; sourceTree = "<group>"; };
1DF161FF2A4365A1001A3F76 /* Colors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Colors.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -124,6 +137,7 @@
buildActionMask = 2147483647;
files = (
A47309B42AA29D9600201376 /* SwiftSoup in Frameworks */,
A4D28AEE2C237E2A007F20D0 /* SnapshotPreferences in Frameworks */,
A495B2952BFEA11B00A8A8A9 /* Reaper in Frameworks */,
A9DF68FF511E48048B0A703D /* Sentry in Frameworks */,
);
Expand All @@ -141,8 +155,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
A4BED5BE2ACE17B3001642B3 /* Snapshotting in Frameworks */,
A4BED5BC2ACE178C001642B3 /* SnapshottingTests in Frameworks */,
A4D28AF02C237E2A007F20D0 /* SnapshottingTests in Frameworks */,
A4BED5C42AD5E083001642B3 /* (null) in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -354,6 +367,7 @@
A42705772A4293B10057E439 /* Resources */,
A42705AE2A44C35D0057E439 /* Strip Symbols */,
F52059CED4FD476981550295 /* Upload Debug Symbols to Sentry */,
A4D28AE92C237BAE007F20D0 /* Embed Frameworks */,
);
buildRules = (
);
Expand All @@ -364,6 +378,7 @@
A47309B32AA29D9600201376 /* SwiftSoup */,
673236B0A4D04137A0D80A76 /* Sentry */,
A495B2942BFEA11B00A8A8A9 /* Reaper */,
A4D28AED2C237E2A007F20D0 /* SnapshotPreferences */,
);
productName = HackerNews;
productReference = A42705792A4293B10057E439 /* HackerNews.app */;
Expand Down Expand Up @@ -402,8 +417,7 @@
);
name = HackerNewsUITests;
packageProductDependencies = (
A4BED5BB2ACE178C001642B3 /* SnapshottingTests */,
A4BED5BD2ACE17B3001642B3 /* Snapshotting */,
A4D28AEF2C237E2A007F20D0 /* SnapshottingTests */,
);
productName = HackerNewsUITests;
productReference = A42705932A4293B30057E439 /* HackerNewsUITests.xctest */;
Expand Down Expand Up @@ -443,9 +457,9 @@
mainGroup = A42705702A4293B10057E439;
packageReferences = (
A47309B22AA29D9600201376 /* XCRemoteSwiftPackageReference "SwiftSoup" */,
A4BED5BA2ACE178C001642B3 /* XCRemoteSwiftPackageReference "SnapshotPreviews-iOS" */,
995A2BEDEF224F7085D3DB13 /* XCRemoteSwiftPackageReference "sentry-cocoa" */,
A495B2932BFEA11B00A8A8A9 /* XCRemoteSwiftPackageReference "Reaper" */,
A4D28AEC2C237E2A007F20D0 /* XCRemoteSwiftPackageReference "SnapshotPreviews-iOS" */,
);
productRefGroup = A427057A2A4293B10057E439 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -487,6 +501,7 @@
/* Begin PBXShellScriptBuildPhase section */
A42705AE2A44C35D0057E439 /* Strip Symbols */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand All @@ -502,10 +517,11 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "#!/bin/bash\nset -e\n\nif [ \"Release\" = \"${CONFIGURATION}\" ]; then\n # Path to the app directory\n APP_DIR_PATH=\"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_FOLDER_PATH}\"\n # Strip main binary\n strip -rSTx \"${APP_DIR_PATH}/${EXECUTABLE_NAME}\"\n # Path to the Frameworks directory\n APP_FRAMEWORKS_DIR=\"${APP_DIR_PATH}/Frameworks\"\n\n # Strip symbols from frameworks, if Frameworks/ exists at all\n # ... as long as the framework is NOT signed by Apple\n if [ -d \"${APP_FRAMEWORKS_DIR}\" ]\n then\n find \"${APP_FRAMEWORKS_DIR}\" -type f -perm +111 -maxdepth 2 -mindepth 2 -exec bash -c 'codesign -v -R=\"anchor apple\" \"{}\" &> /dev/null || (echo \"{}\" && strip -rSTx \"{}\")' \\;\n fi\nfi\n";
shellScript = "#!/bin/bash\nset -e\n\nif [ \"Release\" = \"${CONFIGURATION}\" ]; then\n # Path to the app directory\n APP_DIR_PATH=\"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_FOLDER_PATH}\"\n # Strip main binary\n strip -rSTx \"${APP_DIR_PATH}/${EXECUTABLE_NAME}\"\n # Path to the Frameworks directory\n APP_FRAMEWORKS_DIR=\"${APP_DIR_PATH}/Frameworks\"\n\n # Strip symbols from frameworks, if Frameworks/ exists at all\n # ... as long as the framework is NOT signed by Apple\n if [ -d \"${APP_FRAMEWORKS_DIR}\" ]\n then\n find \"${APP_FRAMEWORKS_DIR}\" -type f -perm +111 -maxdepth 2 -mindepth 2 -exec bash -c '\n codesign -v -R=\"anchor apple\" \"{}\" &> /dev/null ||\n (\n echo \"Stripping {}\" &&\n if [ -w \"{}\" ]; then\n strip -rSTx \"{}\"\n else\n echo \"Warning: No write permission for {}\"\n fi\n )\n ' \\;\n fi\nfi\n";
};
F52059CED4FD476981550295 /* Upload Debug Symbols to Sentry */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -923,7 +939,7 @@
minimumVersion = 1.3.1;
};
};
A4BED5BA2ACE178C001642B3 /* XCRemoteSwiftPackageReference "SnapshotPreviews-iOS" */ = {
A4D28AEC2C237E2A007F20D0 /* XCRemoteSwiftPackageReference "SnapshotPreviews-iOS" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/EmergeTools/SnapshotPreviews-iOS";
requirement = {
Expand All @@ -949,15 +965,15 @@
package = A495B2932BFEA11B00A8A8A9 /* XCRemoteSwiftPackageReference "Reaper" */;
productName = Reaper;
};
A4BED5BB2ACE178C001642B3 /* SnapshottingTests */ = {
A4D28AED2C237E2A007F20D0 /* SnapshotPreferences */ = {
isa = XCSwiftPackageProductDependency;
package = A4BED5BA2ACE178C001642B3 /* XCRemoteSwiftPackageReference "SnapshotPreviews-iOS" */;
productName = SnapshottingTests;
package = A4D28AEC2C237E2A007F20D0 /* XCRemoteSwiftPackageReference "SnapshotPreviews-iOS" */;
productName = SnapshotPreferences;
};
A4BED5BD2ACE17B3001642B3 /* Snapshotting */ = {
A4D28AEF2C237E2A007F20D0 /* SnapshottingTests */ = {
isa = XCSwiftPackageProductDependency;
package = A4BED5BA2ACE178C001642B3 /* XCRemoteSwiftPackageReference "SnapshotPreviews-iOS" */;
productName = Snapshotting;
package = A4D28AEC2C237E2A007F20D0 /* XCRemoteSwiftPackageReference "SnapshotPreviews-iOS" */;
productName = SnapshottingTests;
};
/* End XCSwiftPackageProductDependency section */
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
{
"originHash" : "77385174260e5a082870946dcb2ffee0e39ed35c0df6df3e0daa25b2102bf3f8",
"pins" : [
{
"identity" : "accessibilitysnapshot",
"kind" : "remoteSourceControl",
"location" : "https://github.com/EmergeTools/AccessibilitySnapshot.git",
"state" : {
"revision" : "54046d8fa44b9fa9f0e2229526f6ed89cb5e0ec2",
"version" : "1.0.2"
}
},
{
"identity" : "flyingfox",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swhitty/FlyingFox.git",
"state" : {
"revision" : "ed86fc6d68ec1467aaab3e494b581e66dd7a4512",
"version" : "0.12.2"
}
},
{
"identity" : "reaper",
"kind" : "remoteSourceControl",
Expand All @@ -25,7 +43,7 @@
"location" : "https://github.com/EmergeTools/SnapshotPreviews-iOS",
"state" : {
"branch" : "main",
"revision" : "f22f2f057ff26b6327d74279f9234f1b11822e23"
"revision" : "e5bf73a45a105049a4dacc960011559a78c914b2"
}
},
{
Expand Down
9 changes: 9 additions & 0 deletions ios/HackerNews/Utils/Previews.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation
import SwiftUI
import SnapshotPreferences

struct PreviewVariants<Content: View>: View {
let content: Content
Expand Down Expand Up @@ -58,6 +59,14 @@ struct PreviewVariants<Content: View>: View {
.navigationBarHidden(true)
.previewDevice("iPad Air (5th generation)")
.previewDisplayName("iPad Air, dark mode")

self.content
.environment(\.colorScheme, .light)
.preferredColorScheme(.light)
.navigationBarHidden(true)
.previewDevice("iPhone 11 Pro Max")
.previewDisplayName("Accessibility")
.emergeAccessibility(true)
}
}
}
Expand Down

0 comments on commit f490638

Please sign in to comment.