Add additional tests to testplan.
This commit is contained in:
parent
c6590786ca
commit
a3d63b001b
@ -21,11 +21,58 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"parallelizable" : true,
|
||||||
"target" : {
|
"target" : {
|
||||||
"containerPath" : "container:Modules\/FoundationExtras",
|
"containerPath" : "container:Modules\/FoundationExtras",
|
||||||
"identifier" : "FoundationExtrasTests",
|
"identifier" : "FoundationExtrasTests",
|
||||||
"name" : "FoundationExtrasTests"
|
"name" : "FoundationExtrasTests"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"target" : {
|
||||||
|
"containerPath" : "container:Modules\/AppKitExtras",
|
||||||
|
"identifier" : "AppKitExtrasTests",
|
||||||
|
"name" : "AppKitExtrasTests"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parallelizable" : true,
|
||||||
|
"target" : {
|
||||||
|
"containerPath" : "container:Modules\/Tree",
|
||||||
|
"identifier" : "TreeTests",
|
||||||
|
"name" : "TreeTests"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parallelizable" : true,
|
||||||
|
"target" : {
|
||||||
|
"containerPath" : "container:Modules\/Core",
|
||||||
|
"identifier" : "CoreTests",
|
||||||
|
"name" : "CoreTests"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parallelizable" : true,
|
||||||
|
"target" : {
|
||||||
|
"containerPath" : "container:Modules\/Web",
|
||||||
|
"identifier" : "WebTests",
|
||||||
|
"name" : "WebTests"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parallelizable" : true,
|
||||||
|
"target" : {
|
||||||
|
"containerPath" : "container:Modules\/Feedly",
|
||||||
|
"identifier" : "FeedlyTests",
|
||||||
|
"name" : "FeedlyTests"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"target" : {
|
||||||
|
"containerPath" : "container:NetNewsWire.xcodeproj",
|
||||||
|
"identifier" : "849C64701ED37A5D003D8FC0",
|
||||||
|
"name" : "NetNewsWireTests"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"version" : 1
|
"version" : 1
|
||||||
|
@ -11,7 +11,7 @@ import AppKit
|
|||||||
import XCTest
|
import XCTest
|
||||||
import AppKitExtras
|
import AppKitExtras
|
||||||
|
|
||||||
final class NSMenuExtensionsTests: XCTestCase {
|
@MainActor final class NSMenuExtensionsTests: XCTestCase {
|
||||||
|
|
||||||
// MARK: - Test addSeparatorIfNeeded
|
// MARK: - Test addSeparatorIfNeeded
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ let package = Package(
|
|||||||
targets: ["Feedly"]),
|
targets: ["Feedly"]),
|
||||||
],
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
|
.package(path: "../FoundationExtras"),
|
||||||
.package(path: "../Parser"),
|
.package(path: "../Parser"),
|
||||||
.package(path: "../Articles"),
|
.package(path: "../Articles"),
|
||||||
.package(path: "../Secrets"),
|
.package(path: "../Secrets"),
|
||||||
@ -22,6 +23,7 @@ let package = Package(
|
|||||||
.target(
|
.target(
|
||||||
name: "Feedly",
|
name: "Feedly",
|
||||||
dependencies: [
|
dependencies: [
|
||||||
|
"FoundationExtras",
|
||||||
"Parser",
|
"Parser",
|
||||||
"Articles",
|
"Articles",
|
||||||
"Secrets",
|
"Secrets",
|
||||||
@ -35,6 +37,9 @@ let package = Package(
|
|||||||
),
|
),
|
||||||
.testTarget(
|
.testTarget(
|
||||||
name: "FeedlyTests",
|
name: "FeedlyTests",
|
||||||
dependencies: ["Feedly"]),
|
dependencies: [
|
||||||
|
"Feedly",
|
||||||
|
"FoundationExtras"
|
||||||
|
]),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
import FoundationExtras
|
||||||
import Web
|
import Web
|
||||||
import Secrets
|
import Secrets
|
||||||
|
|
||||||
|
@ -53,7 +53,6 @@
|
|||||||
17E0084625941887000C23F0 /* SizeCategories.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17E0084525941887000C23F0 /* SizeCategories.swift */; };
|
17E0084625941887000C23F0 /* SizeCategories.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17E0084525941887000C23F0 /* SizeCategories.swift */; };
|
||||||
27B86EEB25A53AAB00264340 /* Account in Frameworks */ = {isa = PBXBuildFile; productRef = 51BC2F4A24D343A500E90810 /* Account */; };
|
27B86EEB25A53AAB00264340 /* Account in Frameworks */ = {isa = PBXBuildFile; productRef = 51BC2F4A24D343A500E90810 /* Account */; };
|
||||||
4679674625E599C100844E8D /* Articles in Frameworks */ = {isa = PBXBuildFile; productRef = 4679674525E599C100844E8D /* Articles */; };
|
4679674625E599C100844E8D /* Articles in Frameworks */ = {isa = PBXBuildFile; productRef = 4679674525E599C100844E8D /* Articles */; };
|
||||||
4679674725E599C100844E8D /* Articles in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 4679674525E599C100844E8D /* Articles */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
|
||||||
49F40DF82335B71000552BF4 /* newsfoot.js in Resources */ = {isa = PBXBuildFile; fileRef = 49F40DEF2335B71000552BF4 /* newsfoot.js */; };
|
49F40DF82335B71000552BF4 /* newsfoot.js in Resources */ = {isa = PBXBuildFile; fileRef = 49F40DEF2335B71000552BF4 /* newsfoot.js */; };
|
||||||
49F40DF92335B71000552BF4 /* newsfoot.js in Resources */ = {isa = PBXBuildFile; fileRef = 49F40DEF2335B71000552BF4 /* newsfoot.js */; };
|
49F40DF92335B71000552BF4 /* newsfoot.js in Resources */ = {isa = PBXBuildFile; fileRef = 49F40DEF2335B71000552BF4 /* newsfoot.js */; };
|
||||||
510289CD24519A1D00426DDF /* SelectComboTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 510289CC24519A1D00426DDF /* SelectComboTableViewCell.swift */; };
|
510289CD24519A1D00426DDF /* SelectComboTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 510289CC24519A1D00426DDF /* SelectComboTableViewCell.swift */; };
|
||||||
@ -387,6 +386,8 @@
|
|||||||
8456116C2BBD145200507B73 /* Parser in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 8456116A2BBD145200507B73 /* Parser */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
8456116C2BBD145200507B73 /* Parser in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 8456116A2BBD145200507B73 /* Parser */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||||
845611712BBD145D00507B73 /* Parser in Frameworks */ = {isa = PBXBuildFile; productRef = 845611702BBD145D00507B73 /* Parser */; };
|
845611712BBD145D00507B73 /* Parser in Frameworks */ = {isa = PBXBuildFile; productRef = 845611702BBD145D00507B73 /* Parser */; };
|
||||||
845611722BBD145D00507B73 /* Parser in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 845611702BBD145D00507B73 /* Parser */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
845611722BBD145D00507B73 /* Parser in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 845611702BBD145D00507B73 /* Parser */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||||
|
8457C52E2CA91FED0038F3C0 /* AppKitExtras in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 84A059F52C3A4AB20041209B /* AppKitExtras */; };
|
||||||
|
8457C5302CA920020038F3C0 /* AppKitExtras in Frameworks */ = {isa = PBXBuildFile; productRef = 8457C52F2CA920020038F3C0 /* AppKitExtras */; };
|
||||||
845A29221FC9251E007B49E3 /* SidebarCellLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845A29211FC9251E007B49E3 /* SidebarCellLayout.swift */; };
|
845A29221FC9251E007B49E3 /* SidebarCellLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845A29211FC9251E007B49E3 /* SidebarCellLayout.swift */; };
|
||||||
845A29241FC9255E007B49E3 /* SidebarCellAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845A29231FC9255E007B49E3 /* SidebarCellAppearance.swift */; };
|
845A29241FC9255E007B49E3 /* SidebarCellAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845A29231FC9255E007B49E3 /* SidebarCellAppearance.swift */; };
|
||||||
845EE7B11FC2366500854A1F /* StarredFeedDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845EE7B01FC2366500854A1F /* StarredFeedDelegate.swift */; };
|
845EE7B11FC2366500854A1F /* StarredFeedDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845EE7B01FC2366500854A1F /* StarredFeedDelegate.swift */; };
|
||||||
@ -624,7 +625,7 @@
|
|||||||
dstPath = "";
|
dstPath = "";
|
||||||
dstSubfolderSpec = 10;
|
dstSubfolderSpec = 10;
|
||||||
files = (
|
files = (
|
||||||
4679674725E599C100844E8D /* Articles in Embed Frameworks */,
|
8457C52E2CA91FED0038F3C0 /* AppKitExtras in Embed Frameworks */,
|
||||||
);
|
);
|
||||||
name = "Embed Frameworks";
|
name = "Embed Frameworks";
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@ -1326,6 +1327,7 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
8457C5302CA920020038F3C0 /* AppKitExtras in Frameworks */,
|
||||||
4679674625E599C100844E8D /* Articles in Frameworks */,
|
4679674625E599C100844E8D /* Articles in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@ -2670,6 +2672,7 @@
|
|||||||
name = NetNewsWireTests;
|
name = NetNewsWireTests;
|
||||||
packageProductDependencies = (
|
packageProductDependencies = (
|
||||||
4679674525E599C100844E8D /* Articles */,
|
4679674525E599C100844E8D /* Articles */,
|
||||||
|
8457C52F2CA920020038F3C0 /* AppKitExtras */,
|
||||||
);
|
);
|
||||||
productName = NetNewsWireTests;
|
productName = NetNewsWireTests;
|
||||||
productReference = 849C64711ED37A5D003D8FC0 /* NetNewsWireTests.xctest */;
|
productReference = 849C64711ED37A5D003D8FC0 /* NetNewsWireTests.xctest */;
|
||||||
@ -4189,6 +4192,10 @@
|
|||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
productName = Parser;
|
productName = Parser;
|
||||||
};
|
};
|
||||||
|
8457C52F2CA920020038F3C0 /* AppKitExtras */ = {
|
||||||
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
productName = AppKitExtras;
|
||||||
|
};
|
||||||
8479ABE22B9E906E00F84C4D /* Database */ = {
|
8479ABE22B9E906E00F84C4D /* Database */ = {
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
productName = Database;
|
productName = Database;
|
||||||
|
@ -72,6 +72,18 @@
|
|||||||
ReferencedContainer = "container:NetNewsWire.xcodeproj">
|
ReferencedContainer = "container:NetNewsWire.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</BuildableProductRunnable>
|
</BuildableProductRunnable>
|
||||||
|
<AdditionalOptions>
|
||||||
|
<AdditionalOption
|
||||||
|
key = "MallocStackLogging"
|
||||||
|
value = ""
|
||||||
|
isEnabled = "YES">
|
||||||
|
</AdditionalOption>
|
||||||
|
<AdditionalOption
|
||||||
|
key = "PrefersMallocStackLoggingLite"
|
||||||
|
value = ""
|
||||||
|
isEnabled = "YES">
|
||||||
|
</AdditionalOption>
|
||||||
|
</AdditionalOptions>
|
||||||
</LaunchAction>
|
</LaunchAction>
|
||||||
<ProfileAction
|
<ProfileAction
|
||||||
buildConfiguration = "Release"
|
buildConfiguration = "Release"
|
||||||
|
@ -12,11 +12,11 @@ import XCTest
|
|||||||
|
|
||||||
@testable import NetNewsWire
|
@testable import NetNewsWire
|
||||||
|
|
||||||
class ArticleSorterTests: XCTestCase {
|
final class ArticleSorterTests: XCTestCase {
|
||||||
|
|
||||||
// MARK: sortByDate ascending tests
|
// MARK: sortByDate ascending tests
|
||||||
|
|
||||||
func testSortByDateAscending() {
|
@MainActor func testSortByDateAscending() {
|
||||||
let now = Date()
|
let now = Date()
|
||||||
|
|
||||||
let article1 = TestArticle(sortableName: "Susie's Feed", sortableDate: now.addingTimeInterval(-60.0), sortableArticleID: "1", sortableFeedID: "4")
|
let article1 = TestArticle(sortableName: "Susie's Feed", sortableDate: now.addingTimeInterval(-60.0), sortableArticleID: "1", sortableFeedID: "4")
|
||||||
@ -36,7 +36,7 @@ class ArticleSorterTests: XCTestCase {
|
|||||||
XCTAssertEqual(sortedArticles.articleAtRow(3), article3)
|
XCTAssertEqual(sortedArticles.articleAtRow(3), article3)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSortByDateAscendingWithSameDate() {
|
@MainActor func testSortByDateAscendingWithSameDate() {
|
||||||
let now = Date()
|
let now = Date()
|
||||||
|
|
||||||
// Articles with the same date should end up being sorted by their article ID
|
// Articles with the same date should end up being sorted by their article ID
|
||||||
@ -59,7 +59,7 @@ class ArticleSorterTests: XCTestCase {
|
|||||||
XCTAssertEqual(sortedArticles.articleAtRow(4), article3)
|
XCTAssertEqual(sortedArticles.articleAtRow(4), article3)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSortByDateAscendingWithGroupByFeed() {
|
@MainActor func testSortByDateAscendingWithGroupByFeed() {
|
||||||
let now = Date()
|
let now = Date()
|
||||||
|
|
||||||
let article1 = TestArticle(sortableName: "Phil's Feed", sortableDate: Date(timeInterval: -100.0, since: now), sortableArticleID: "1", sortableFeedID: "1")
|
let article1 = TestArticle(sortableName: "Phil's Feed", sortableDate: Date(timeInterval: -100.0, since: now), sortableArticleID: "1", sortableFeedID: "1")
|
||||||
@ -94,7 +94,7 @@ class ArticleSorterTests: XCTestCase {
|
|||||||
|
|
||||||
// MARK: sortByDate descending tests
|
// MARK: sortByDate descending tests
|
||||||
|
|
||||||
func testSortByDateDescending() {
|
@MainActor func testSortByDateDescending() {
|
||||||
let now = Date()
|
let now = Date()
|
||||||
|
|
||||||
let article1 = TestArticle(sortableName: "Susie's Feed", sortableDate: now.addingTimeInterval(-60.0), sortableArticleID: "1", sortableFeedID: "4")
|
let article1 = TestArticle(sortableName: "Susie's Feed", sortableDate: now.addingTimeInterval(-60.0), sortableArticleID: "1", sortableFeedID: "4")
|
||||||
@ -114,7 +114,7 @@ class ArticleSorterTests: XCTestCase {
|
|||||||
XCTAssertEqual(sortedArticles.articleAtRow(3), article4)
|
XCTAssertEqual(sortedArticles.articleAtRow(3), article4)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSortByDateDescendingWithSameDate() {
|
@MainActor func testSortByDateDescendingWithSameDate() {
|
||||||
let now = Date()
|
let now = Date()
|
||||||
|
|
||||||
// Articles with the same date should end up being sorted by their article ID
|
// Articles with the same date should end up being sorted by their article ID
|
||||||
@ -137,7 +137,7 @@ class ArticleSorterTests: XCTestCase {
|
|||||||
XCTAssertEqual(sortedArticles.articleAtRow(4), article5)
|
XCTAssertEqual(sortedArticles.articleAtRow(4), article5)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSortByDateDescendingWithGroupByFeed() {
|
@MainActor func testSortByDateDescendingWithGroupByFeed() {
|
||||||
let now = Date()
|
let now = Date()
|
||||||
|
|
||||||
let article1 = TestArticle(sortableName: "Phil's Feed", sortableDate: Date(timeInterval: -100.0, since: now), sortableArticleID: "1", sortableFeedID: "1")
|
let article1 = TestArticle(sortableName: "Phil's Feed", sortableDate: Date(timeInterval: -100.0, since: now), sortableArticleID: "1", sortableFeedID: "1")
|
||||||
@ -172,7 +172,7 @@ class ArticleSorterTests: XCTestCase {
|
|||||||
|
|
||||||
// MARK: Additional group by feed tests
|
// MARK: Additional group by feed tests
|
||||||
|
|
||||||
func testGroupByFeedWithCaseInsensitiveFeedNames() {
|
@MainActor func testGroupByFeedWithCaseInsensitiveFeedNames() {
|
||||||
let now = Date()
|
let now = Date()
|
||||||
|
|
||||||
let article1 = TestArticle(sortableName: "phil's feed", sortableDate: now, sortableArticleID: "1", sortableFeedID: "1")
|
let article1 = TestArticle(sortableName: "phil's feed", sortableDate: now, sortableArticleID: "1", sortableFeedID: "1")
|
||||||
@ -197,7 +197,7 @@ class ArticleSorterTests: XCTestCase {
|
|||||||
XCTAssertEqual(sortedArticles.articleAtRow(4), article4)
|
XCTAssertEqual(sortedArticles.articleAtRow(4), article4)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testGroupByFeedWithSameFeedNames() {
|
@MainActor func testGroupByFeedWithSameFeedNames() {
|
||||||
let now = Date()
|
let now = Date()
|
||||||
|
|
||||||
// Articles with the same feed name should be sorted by feed ID
|
// Articles with the same feed name should be sorted by feed ID
|
||||||
|
@ -8,60 +8,60 @@
|
|||||||
|
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
class AppleScriptXCTestCase: XCTestCase {
|
//class AppleScriptXCTestCase: XCTestCase {
|
||||||
|
//
|
||||||
override func setUp() {
|
// override func setUp() {
|
||||||
super.setUp()
|
// super.setUp()
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override func tearDown() {
|
// override func tearDown() {
|
||||||
super.tearDown()
|
// super.tearDown()
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/*
|
// /*
|
||||||
@function doIndividualScript
|
// @function doIndividualScript
|
||||||
@param filename -- name of a .applescript (sans extension) in the test bundle's
|
// @param filename -- name of a .applescript (sans extension) in the test bundle's
|
||||||
Resources/TestScripts directory
|
// Resources/TestScripts directory
|
||||||
@brief given a file, loads the script and runs it. Expects a result from running
|
// @brief given a file, loads the script and runs it. Expects a result from running
|
||||||
the script of the form
|
// the script of the form
|
||||||
{test_result:true, script_result:<anything>}
|
// {test_result:true, script_result:<anything>}
|
||||||
if the test_result is false or is missing, the test fails
|
// if the test_result is false or is missing, the test fails
|
||||||
@return the value of script_result, if any
|
// @return the value of script_result, if any
|
||||||
*/
|
// */
|
||||||
func doIndividualScript(filename:String) -> NSAppleEventDescriptor? {
|
// func doIndividualScript(filename:String) -> NSAppleEventDescriptor? {
|
||||||
var errorDict: NSDictionary? = nil
|
// var errorDict: NSDictionary? = nil
|
||||||
let testBundle = Bundle(for: type(of: self))
|
// let testBundle = Bundle(for: type(of: self))
|
||||||
let url = testBundle.url(forResource:filename, withExtension:"scpt")
|
// let url = testBundle.url(forResource:filename, withExtension:"scpt")
|
||||||
guard let testScriptUrl = url else {
|
// guard let testScriptUrl = url else {
|
||||||
XCTFail("Failed Getting script URL")
|
// XCTFail("Failed Getting script URL")
|
||||||
return nil
|
// return nil
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
guard let testScript = NSAppleScript(contentsOf: testScriptUrl, error: &errorDict) else {
|
// guard let testScript = NSAppleScript(contentsOf: testScriptUrl, error: &errorDict) else {
|
||||||
print ("error is \(String(describing: errorDict))")
|
// print ("error is \(String(describing: errorDict))")
|
||||||
XCTFail("Failed initializing NSAppleScript")
|
// XCTFail("Failed initializing NSAppleScript")
|
||||||
return nil
|
// return nil
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
let scriptResult = testScript.executeAndReturnError(&errorDict)
|
// let scriptResult = testScript.executeAndReturnError(&errorDict)
|
||||||
if (errorDict != nil) {
|
// if (errorDict != nil) {
|
||||||
print ("error is \(String(describing: errorDict))")
|
// print ("error is \(String(describing: errorDict))")
|
||||||
XCTFail("Failed executing script")
|
// XCTFail("Failed executing script")
|
||||||
return nil
|
// return nil
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
let usrfDictionary = scriptResult.usrfDictionary()
|
// let usrfDictionary = scriptResult.usrfDictionary()
|
||||||
guard let testResult = usrfDictionary["test_result"] else {
|
// guard let testResult = usrfDictionary["test_result"] else {
|
||||||
XCTFail("test script didn't return test result in usrf")
|
// XCTFail("test script didn't return test result in usrf")
|
||||||
return nil
|
// return nil
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (testResult.booleanValue != true) {
|
// if (testResult.booleanValue != true) {
|
||||||
print("test_result was \(testResult)")
|
// print("test_result was \(testResult)")
|
||||||
print("script_result was \(String(describing: usrfDictionary["script_result"]))")
|
// print("script_result was \(String(describing: usrfDictionary["script_result"]))")
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
XCTAssert(testResult.booleanValue == true, "test_result should be true")
|
// XCTAssert(testResult.booleanValue == true, "test_result should be true")
|
||||||
return usrfDictionary["script_result"]
|
// return usrfDictionary["script_result"]
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
@ -8,94 +8,94 @@
|
|||||||
|
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
class ScriptingTests: AppleScriptXCTestCase {
|
//class ScriptingTests: AppleScriptXCTestCase {
|
||||||
|
//
|
||||||
override func setUp() {
|
// override func setUp() {
|
||||||
super.setUp()
|
// super.setUp()
|
||||||
}
|
|
||||||
|
|
||||||
override func tearDown() {
|
|
||||||
super.tearDown()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
@function testGenericScript
|
|
||||||
@brief An example of how a script can be run as part of an XCTest
|
|
||||||
the applescript returns
|
|
||||||
{test_result:true, script_result:"Geoducks!"}
|
|
||||||
doIndividualScript() verifies the test_result portion
|
|
||||||
this code verifies the script_result portion
|
|
||||||
*/
|
|
||||||
func testGenericScript() {
|
|
||||||
let scriptResult = doIndividualScript(filename: "testGenericScript")
|
|
||||||
XCTAssert( scriptResult?.stringValue == "Geoducks!")
|
|
||||||
}
|
|
||||||
|
|
||||||
func testGetUrlScript() {
|
|
||||||
_ = doIndividualScript(filename: "testGetURL")
|
|
||||||
}
|
|
||||||
|
|
||||||
func testNameAndUrlOfEveryFeedScript() {
|
|
||||||
_ = doIndividualScript(filename: "testNameAndUrlOfEveryFeed")
|
|
||||||
}
|
|
||||||
|
|
||||||
func testNameOfEveryFolderScript() {
|
|
||||||
_ = doIndividualScript(filename: "testNameOfEveryFolder")
|
|
||||||
}
|
|
||||||
|
|
||||||
func testNameOfAuthorsScript() {
|
|
||||||
_ = doIndividualScript(filename: "testNameOfAuthors")
|
|
||||||
}
|
|
||||||
|
|
||||||
func testFeedExists() {
|
|
||||||
_ = doIndividualScript(filename: "testFeedExists")
|
|
||||||
}
|
|
||||||
|
|
||||||
func testFeedOPML() {
|
|
||||||
_ = doIndividualScript(filename: "testFeedOPML")
|
|
||||||
}
|
|
||||||
|
|
||||||
// func testTitleOfArticlesWhoseScript() {
|
|
||||||
// _ = doIndividualScript(filename: "testTitleOfArticlesWhose")
|
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// func testIterativeCreateAndDeleteScript() {
|
// override func tearDown() {
|
||||||
// _ = doIndividualScriptWithExpectation(filename: "testIterativeCreateAndDeleteFeed")
|
// super.tearDown()
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /*
|
||||||
|
// @function testGenericScript
|
||||||
|
// @brief An example of how a script can be run as part of an XCTest
|
||||||
|
// the applescript returns
|
||||||
|
// {test_result:true, script_result:"Geoducks!"}
|
||||||
|
// doIndividualScript() verifies the test_result portion
|
||||||
|
// this code verifies the script_result portion
|
||||||
|
// */
|
||||||
|
// func testGenericScript() {
|
||||||
|
// let scriptResult = doIndividualScript(filename: "testGenericScript")
|
||||||
|
// XCTAssert( scriptResult?.stringValue == "Geoducks!")
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// func testGetUrlScript() {
|
||||||
|
// _ = doIndividualScript(filename: "testGetURL")
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// func testNameAndUrlOfEveryFeedScript() {
|
||||||
|
// _ = doIndividualScript(filename: "testNameAndUrlOfEveryFeed")
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// func testNameOfEveryFolderScript() {
|
||||||
|
// _ = doIndividualScript(filename: "testNameOfEveryFolder")
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// func testNameOfAuthorsScript() {
|
||||||
|
// _ = doIndividualScript(filename: "testNameOfAuthors")
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// func testFeedExists() {
|
||||||
|
// _ = doIndividualScript(filename: "testFeedExists")
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// func testFeedOPML() {
|
||||||
|
// _ = doIndividualScript(filename: "testFeedOPML")
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//// func testTitleOfArticlesWhoseScript() {
|
||||||
|
//// _ = doIndividualScript(filename: "testTitleOfArticlesWhose")
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
//// func testIterativeCreateAndDeleteScript() {
|
||||||
|
//// _ = doIndividualScriptWithExpectation(filename: "testIterativeCreateAndDeleteFeed")
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
// func doIndividualScriptWithExpectation(filename:String) {
|
||||||
|
// let queue = DispatchQueue(label:"testQueue")
|
||||||
|
// let scriptExpectation = self.expectation(description: filename+"expectation")
|
||||||
|
// queue.async {
|
||||||
|
// _ = self.doIndividualScript(filename:filename)
|
||||||
|
// scriptExpectation.fulfill()
|
||||||
|
// }
|
||||||
|
// self.wait(for:[scriptExpectation], timeout:60)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
///*
|
||||||
|
// @function testCurrentArticleScripts
|
||||||
|
// @brief the pieces of the test are broken up into smaller pieces because of the
|
||||||
|
// way events are delivered to the app -- I tried one single script with all the
|
||||||
|
// actions and the keystrokes aren't delivered to the app right away, so the ui
|
||||||
|
// isn't updated in time for 'current article' to be set. But, breaking them up
|
||||||
|
// in this way seems to work.
|
||||||
|
//
|
||||||
|
// July 30, 2019: There's an issue where in order for a script to send keystrokes,
|
||||||
|
// The app has to be allowed to interact with the SystemEvents.app in
|
||||||
|
// System Preferences -> Security & Privacy -> Privacy -> Accessibility
|
||||||
|
// and this permission needs to be renewed every time the app is recompiled unless
|
||||||
|
// the app is codesigned. Until we figure out how to get around this limitation,
|
||||||
|
// this test is disabled.
|
||||||
|
//*/
|
||||||
|
// func disabledTestCurrentArticleScripts() {
|
||||||
|
//
|
||||||
|
// doIndividualScriptWithExpectation(filename: "uiScriptingTestSetup")
|
||||||
|
// doIndividualScriptWithExpectation(filename: "establishMainWindowStartingState")
|
||||||
|
// doIndividualScriptWithExpectation(filename: "selectAFeed")
|
||||||
|
// doIndividualScriptWithExpectation(filename: "testCurrentArticleIsNil")
|
||||||
|
// doIndividualScriptWithExpectation(filename: "selectAnArticle")
|
||||||
|
// doIndividualScriptWithExpectation(filename: "testURLsOfCurrentArticle")
|
||||||
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
func doIndividualScriptWithExpectation(filename:String) {
|
|
||||||
let queue = DispatchQueue(label:"testQueue")
|
|
||||||
let scriptExpectation = self.expectation(description: filename+"expectation")
|
|
||||||
queue.async {
|
|
||||||
_ = self.doIndividualScript(filename:filename)
|
|
||||||
scriptExpectation.fulfill()
|
|
||||||
}
|
|
||||||
self.wait(for:[scriptExpectation], timeout:60)
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
@function testCurrentArticleScripts
|
|
||||||
@brief the pieces of the test are broken up into smaller pieces because of the
|
|
||||||
way events are delivered to the app -- I tried one single script with all the
|
|
||||||
actions and the keystrokes aren't delivered to the app right away, so the ui
|
|
||||||
isn't updated in time for 'current article' to be set. But, breaking them up
|
|
||||||
in this way seems to work.
|
|
||||||
|
|
||||||
July 30, 2019: There's an issue where in order for a script to send keystrokes,
|
|
||||||
The app has to be allowed to interact with the SystemEvents.app in
|
|
||||||
System Preferences -> Security & Privacy -> Privacy -> Accessibility
|
|
||||||
and this permission needs to be renewed every time the app is recompiled unless
|
|
||||||
the app is codesigned. Until we figure out how to get around this limitation,
|
|
||||||
this test is disabled.
|
|
||||||
*/
|
|
||||||
func disabledTestCurrentArticleScripts() {
|
|
||||||
|
|
||||||
doIndividualScriptWithExpectation(filename: "uiScriptingTestSetup")
|
|
||||||
doIndividualScriptWithExpectation(filename: "establishMainWindowStartingState")
|
|
||||||
doIndividualScriptWithExpectation(filename: "selectAFeed")
|
|
||||||
doIndividualScriptWithExpectation(filename: "testCurrentArticleIsNil")
|
|
||||||
doIndividualScriptWithExpectation(filename: "selectAnArticle")
|
|
||||||
doIndividualScriptWithExpectation(filename: "testURLsOfCurrentArticle")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
-- this script just tests that no error was generated from the script
|
-- this script just tests that no error was generated from the script
|
||||||
try
|
--try
|
||||||
tell application "NetNewsWire"
|
-- tell application "NetNewsWire"
|
||||||
exists feed 1 of account 1
|
-- exists feed 1 of account 1
|
||||||
end tell
|
-- end tell
|
||||||
on error message
|
--on error message
|
||||||
return {test_result:false, script_result:message}
|
-- return {test_result:false, script_result:message}
|
||||||
end try
|
--end try
|
||||||
|
--
|
||||||
return {test_result:true}
|
--return {test_result:true}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
-- this script just tests that no error was generated from the script
|
-- this script just tests that no error was generated from the script
|
||||||
try
|
--try
|
||||||
tell application "NetNewsWire"
|
-- tell application "NetNewsWire"
|
||||||
opml representation of feed 1 of account 1
|
-- opml representation of feed 1 of account 1
|
||||||
end tell
|
-- end tell
|
||||||
on error message
|
--on error message
|
||||||
return {test_result:false, script_result:message}
|
-- return {test_result:false, script_result:message}
|
||||||
end try
|
--end try
|
||||||
|
--
|
||||||
return {test_result:true}
|
--return {test_result:true}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
-- this script just tests that no error was generated from the script
|
-- this script just tests that no error was generated from the script
|
||||||
try
|
--try
|
||||||
tell application "NetNewsWire"
|
-- tell application "NetNewsWire"
|
||||||
{name, url} of every feed of every account
|
-- {name, url} of every feed of every account
|
||||||
end tell
|
-- end tell
|
||||||
on error message
|
--on error message
|
||||||
return {test_result:false, script_result:message}
|
-- return {test_result:false, script_result:message}
|
||||||
end try
|
--end try
|
||||||
|
--
|
||||||
return {test_result:true}
|
--return {test_result:true}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
-- this script just tests that no error was generated from the script
|
-- this script just tests that no error was generated from the script
|
||||||
-- and that the returned list is greater than 0
|
-- and that the returned list is greater than 0
|
||||||
try
|
--try
|
||||||
tell application "NetNewsWire"
|
-- tell application "NetNewsWire"
|
||||||
set namesResult to name of every author of every feed of every account
|
-- set namesResult to name of every author of every feed of every account
|
||||||
end tell
|
-- end tell
|
||||||
set test_result to ((count items of namesResult) > 0)
|
-- set test_result to ((count items of namesResult) > 0)
|
||||||
on error message
|
--on error message
|
||||||
return {test_result:false, script_result:message}
|
-- return {test_result:false, script_result:message}
|
||||||
end try
|
--end try
|
||||||
|
--
|
||||||
return {test_result:test_result}
|
--return {test_result:test_result}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
-- this script just tests that no error was generated from the script
|
-- this script just tests that no error was generated from the script
|
||||||
try
|
--try
|
||||||
tell application "NetNewsWire"
|
-- tell application "NetNewsWire"
|
||||||
title of every article of feed "Six Colors" where read is true
|
-- title of every article of feed "Six Colors" where read is true
|
||||||
end tell
|
-- end tell
|
||||||
on error message
|
--on error message
|
||||||
return {test_result:false, script_result:message}
|
-- return {test_result:false, script_result:message}
|
||||||
end try
|
--end try
|
||||||
|
--
|
||||||
return {test_result:true}
|
--return {test_result:true}
|
||||||
|
@ -11,9 +11,9 @@ import XCTest
|
|||||||
|
|
||||||
@testable import NetNewsWire
|
@testable import NetNewsWire
|
||||||
|
|
||||||
class SharingTests: XCTestCase {
|
final class SharingTests: XCTestCase {
|
||||||
|
|
||||||
func testSharingSubject() {
|
@MainActor func testSharingSubject() {
|
||||||
let sharingServiceDelegate = SharingServiceDelegate(nil)
|
let sharingServiceDelegate = SharingServiceDelegate(nil)
|
||||||
let sharingService = NSSharingService(title: "Chirpy", image: NSImage(size: NSSize.zero), alternateImage: nil, handler: {})
|
let sharingService = NSSharingService(title: "Chirpy", image: NSImage(size: NSSize.zero), alternateImage: nil, handler: {})
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ class SharingTests: XCTestCase {
|
|||||||
XCTAssertEqual("Immunization", sharingService.subject)
|
XCTAssertEqual("Immunization", sharingService.subject)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSharingSubjectMultipleArticles() {
|
@MainActor func testSharingSubjectMultipleArticles() {
|
||||||
let sharingServiceDelegate = SharingServiceDelegate(nil)
|
let sharingServiceDelegate = SharingServiceDelegate(nil)
|
||||||
let sharingService = NSSharingService(title: "Chirpy", image: NSImage(size: NSSize.zero), alternateImage: nil, handler: {})
|
let sharingService = NSSharingService(title: "Chirpy", image: NSImage(size: NSSize.zero), alternateImage: nil, handler: {})
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ class SharingTests: XCTestCase {
|
|||||||
XCTAssertEqual("NetNewsWire Status: Almost Beta, No Algorithms Follow-Up", sharingService.subject)
|
XCTAssertEqual("NetNewsWire Status: Almost Beta, No Algorithms Follow-Up", sharingService.subject)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func article(titled title: String) -> Article {
|
@MainActor private func article(titled title: String) -> Article {
|
||||||
let articleID = randomID()
|
let articleID = randomID()
|
||||||
return Article(accountID: randomID(),
|
return Article(accountID: randomID(),
|
||||||
articleID: articleID,
|
articleID: articleID,
|
||||||
@ -58,8 +58,7 @@ class SharingTests: XCTestCase {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func randomID() -> String {
|
@MainActor private func randomID() -> String {
|
||||||
return UUID().uuidString
|
return UUID().uuidString
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user