Skip to content

Commit 45b0aa5

Browse files
spetrescu84nilo-ms
andauthored
[macOS SDK] Add Native Auth E2E and Integration tests for macOS (#2250)
* MacOS changes to the project * unit tests * Added missing files to Mac Target * Removed unit tests that don't work * Merge dev into branch * Add flag to fix modules and unit tests * Last IC * Swift to dev IC * Add CacheAccessor for macOS for unit tests * fix compilation error integration tests * Set correctly URL for mock API when running end to end tests * use same XCAssert command * Update integration tests, do not skip tests anymore * add new schema dedicated to E2E tests. Move E2E tests from integration to new target * remove empty tests * copy conf json file and add new test to check that file is loaded correctly * retrieve OTP code from email using 1secmail * Read info from conf.json file * generate random email address * Cocoapod * Pointing IdenityCore to spetrescu/macos-version-increase * Updated modulemap * Latest IC * enable first signUp email-code signUp test * disable not runnable signup tests and fix one test * remove not E2E tests, move password tests to dedicated class * update input and output to build script to remove warning * add settings to retry tests on failure, enable all possible tests * remove not needed log in script * update pr validation and nightly build to include E2E tests for native auth * delete jobs redeclaration * update schema name * update target name * Increased minimum macOS version to 10.15 * Create new schema dedicated to E2E tests * execute new schema for E2E tests * set new name for xctestrun file * Removed all instances of if (@available(macOS 10.15, *)) * link conf.json file to target * not run E2E tests in parallel * test new file from secure files * Updated CHANGELOG.md * Corrected version * Run E2E tests in PR validation * fix pr-validation.yml script * update script * move tests execution with conf json to a template * add jobs definition in template * try creating a variables * use template only for steps and not job * fix template file reference * remove not needed comma * set schema name correctly * typo * run E2E tests using template * use id instead of date string to sort emails, refactor email parser * Removed commented file from modulemap Changed how test is split between iOS and macOS * fail the test if conf file can not be serialized * add enum for clientId key, add more log in code retriever, generate email in codeRetriever class * remove clientId type specification * remove changes from build script * remove spaces * Ownership for new testplan and target to MSAL NativeAuth team * Removed all API_AVAILABLE that were always satisfied Removed all if (@available) that were always satisfied * Reverted to dev IdentityCore * add missing owner to file * declare pool for each job * Created E2E and Integration Target tests for macOS * Test plans * Fixed E2E macOS script * Correct test plans * Latest version of IdentityCore * New tests * Run in PR validation * New IdentityCore * Last IdentityCore * Correct IdentityCore * Correct IdentityCore * Added to automation also * Changed job name * Updated for mac * Updated folders * Fix iOS pipeline * Updated xctestrun name for Mac * Changed to arm * Fixed for current pipeline * MacOS version for xctest Changed path for script * Trying new setup * Changed how path gets created * Fixed path * Quotes fix * Changed from moving to copying the file * Add conf.json to target * Update changelog * Updated changelog * Added check for macOS * Added comment to explain why the check happens * PR Comments * Update to mv * Testing with default target path * New Idenitycore * Point to proper IdentityCore * Pointing to correct IdentityCore * Updated IdenityCore to correct version * Updated IdentityCore to correct version * PR comments * Latest IdentityCore * Latest IdentityCore * PR comments, removed null * PR comments, reverted team * Moved script to automation.yml * Updated path * Updated sdk * Corrected path * Set correct scheme * Updated IdentityCore * Latest identityCore * Latest IdentityCore * Updated IdentityCore * Using dev branch after merge * Correct Identity Core * Added keychain access for macOS app Reverted yml file to previous * Update IdentityCore after merge * Latest IC * Reverted change to artifactName * Latest commit * Reverted discarded files * Adding missing unit tests * Sort out warning around Swift 4.0 Fixced pob lint for extension * Changed link-time optimization to Incremental * Latest IdentityCore * Add macOS e2e tests to PR validation and Pipeline * Properly escaped ( character in build.py * Removed xcpretty temporarly * Skipping code signature for macOS * Transformed else if into if * Fixed indetation * Corrected platform name * Added spacing * Added command after report * Reverted order, added xcpretty back * Log full path Fixed warnings * Setting full path to fixed version * Removed condition temporarly * Modified pr validation also * Added logging * Reverted echo, added additional flags * Logging with flags * Added flags to PR validation also * Modify to - * Set codesign to Apple Developer * Fixed synatx * Changed codesign * Trying with Apple development * Revert bundle name change * Added correct bundle back * Removed not needed entitlements Skipped test that requires cache * Removed unit-test-host-mac.entitlements * Reverted code sign * Reverted build.py * Removed flags from tests-with-conf-file Added condition for macOS back * Temp remove depends on check * Added conditions back * Moved e2e plans Fixed TOOD typo --------- Co-authored-by: Danilo Raspa <[email protected]>
1 parent 15c0674 commit 45b0aa5

15 files changed

+846
-52
lines changed

MSAL.xcworkspace/contents.xcworkspacedata

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MSAL/MSAL.xcodeproj/project.pbxproj

Lines changed: 604 additions & 32 deletions
Large diffs are not rendered by default.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1500"
4+
version = "1.7">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
</BuildAction>
9+
<TestAction
10+
buildConfiguration = "Debug"
11+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
12+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
13+
shouldUseLaunchSchemeArgsEnv = "YES">
14+
<TestPlans>
15+
<TestPlanReference
16+
reference = "container:test/testplan/MSAL Mac Native Auth E2E Tests.xctestplan"
17+
default = "YES">
18+
</TestPlanReference>
19+
</TestPlans>
20+
<Testables>
21+
<TestableReference
22+
skipped = "NO"
23+
parallelizable = "YES">
24+
<BuildableReference
25+
BuildableIdentifier = "primary"
26+
BlueprintIdentifier = "DE1BD0F52C3C282900B0888E"
27+
BuildableName = "MSAL Mac Native Auth E2E Tests.xctest"
28+
BlueprintName = "MSAL Mac Native Auth E2E Tests"
29+
ReferencedContainer = "container:MSAL.xcodeproj">
30+
</BuildableReference>
31+
</TestableReference>
32+
</Testables>
33+
</TestAction>
34+
<LaunchAction
35+
buildConfiguration = "Debug"
36+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
37+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
38+
launchStyle = "0"
39+
useCustomWorkingDirectory = "NO"
40+
ignoresPersistentStateOnLaunch = "NO"
41+
debugDocumentVersioning = "YES"
42+
debugServiceExtension = "internal"
43+
allowLocationSimulation = "YES">
44+
</LaunchAction>
45+
<ProfileAction
46+
buildConfiguration = "Release"
47+
shouldUseLaunchSchemeArgsEnv = "YES"
48+
savedToolIdentifier = ""
49+
useCustomWorkingDirectory = "NO"
50+
debugDocumentVersioning = "YES">
51+
</ProfileAction>
52+
<AnalyzeAction
53+
buildConfiguration = "Debug">
54+
</AnalyzeAction>
55+
<ArchiveAction
56+
buildConfiguration = "Release"
57+
revealArchiveInOrganizer = "YES">
58+
</ArchiveAction>
59+
</Scheme>

MSAL/MSAL.xcodeproj/xcshareddata/xcschemes/MSAL iOS Native Auth E2E Tests.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
shouldUseLaunchSchemeArgsEnv = "YES">
1515
<TestPlans>
1616
<TestPlanReference
17-
reference = "container:MSAL iOS Native Auth E2E Tests.xctestplan"
17+
reference = "container:test/testplan/MSAL iOS Native Auth E2E Tests.xctestplan"
1818
default = "YES">
1919
</TestPlanReference>
2020
</TestPlans>

MSAL/MSAL.xcodeproj/xcshareddata/xcschemes/unit-test-host-mac.xcscheme

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,33 @@
2020
ReferencedContainer = "container:MSAL.xcodeproj">
2121
</BuildableReference>
2222
</BuildActionEntry>
23+
<BuildActionEntry
24+
buildForTesting = "YES"
25+
buildForRunning = "NO"
26+
buildForProfiling = "NO"
27+
buildForArchiving = "NO"
28+
buildForAnalyzing = "NO">
29+
<BuildableReference
30+
BuildableIdentifier = "primary"
31+
BlueprintIdentifier = "DE1BD0CE2C3C275200B0888E"
32+
BuildableName = "MSAL Mac Native Auth Integration Tests.xctest"
33+
BlueprintName = "MSAL Mac Native Auth Integration Tests"
34+
ReferencedContainer = "container:MSAL.xcodeproj">
35+
</BuildableReference>
36+
</BuildActionEntry>
2337
</BuildActionEntries>
2438
</BuildAction>
2539
<TestAction
2640
buildConfiguration = "Debug"
2741
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2842
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29-
shouldUseLaunchSchemeArgsEnv = "YES"
30-
shouldAutocreateTestPlan = "YES">
43+
shouldUseLaunchSchemeArgsEnv = "YES">
44+
<TestPlans>
45+
<TestPlanReference
46+
reference = "container:test/testplan/NativeAuthEndToEndTestPlan Mac.xctestplan"
47+
default = "YES">
48+
</TestPlanReference>
49+
</TestPlans>
3150
</TestAction>
3251
<LaunchAction
3352
buildConfiguration = "Debug"

MSAL/MSAL.xcodeproj/xcshareddata/xcschemes/unit-test-host.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
shouldUseLaunchSchemeArgsEnv = "YES">
3030
<TestPlans>
3131
<TestPlanReference
32-
reference = "container:NativeAuthEndToEndTestPlan.xctestplan"
32+
reference = "container:test/testplan/NativeAuthEndToEndTestPlan.xctestplan"
3333
default = "YES">
3434
</TestPlanReference>
3535
</TestPlans>

MSAL/test/integration/native_auth/end_to_end/sign_out/MSALNativeAuthSignOutEndToEndTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ import XCTest
2828
final class MSALNativeAuthSignOutEndToEndTests: MSALNativeAuthEndToEndPasswordTestCase {
2929
// Hero Scenario 2.4.1. Sign out – Local sign out from app on device (no SSO)
3030
func test_signOutAfterSignInPasswordSuccess() async throws {
31+
// TODO: This will be re-enabled as part of another PBI
32+
#if os(macOS)
33+
throw XCTSkip("Keychain access is not active on the macOS app")
34+
#endif
3135
guard let sut = initialisePublicClientApplication(),
3236
let username = retrieveUsernameForSignInUsernameAndPassword(),
3337
let password = await retrievePasswordForSignInUsername()
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"configurations" : [
3+
{
4+
"id" : "7F1E1B34-AEF9-431F-B9CE-D295BED40820",
5+
"name" : "Test Scheme Action",
6+
"options" : {
7+
8+
}
9+
}
10+
],
11+
"defaultOptions" : {
12+
"testRepetitionMode" : "retryOnFailure"
13+
},
14+
"testTargets" : [
15+
{
16+
"target" : {
17+
"containerPath" : "container:MSAL.xcodeproj",
18+
"identifier" : "DE1BD0F52C3C282900B0888E",
19+
"name" : "MSAL Mac Native Auth E2E Tests"
20+
}
21+
}
22+
],
23+
"version" : 1
24+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"configurations" : [
3+
{
4+
"id" : "2A21CE4F-3AC3-481A-97AE-43C3291B8CD2",
5+
"name" : "Test Tenant",
6+
"options" : {
7+
"environmentVariableEntries" : [
8+
{
9+
"key" : "clientId",
10+
"value" : "<placeholder>"
11+
},
12+
{
13+
"key" : "existingPasswordUserEmail",
14+
"value" : "<placeholder>"
15+
},
16+
{
17+
"key" : "existingUserPassword",
18+
"value" : "<placeholder>"
19+
},
20+
{
21+
"key" : "authorityURL",
22+
"value" : "<placeholder>"
23+
}
24+
]
25+
}
26+
},
27+
{
28+
"id" : "0A110D07-5D21-4B70-8C37-00FF79C890B1",
29+
"name" : "Mock API",
30+
"options" : {
31+
"environmentVariableEntries" : [
32+
{
33+
"key" : "authorityURL",
34+
"value" : "<placeholder>"
35+
},
36+
{
37+
"key" : "existingOTPUserEmail",
38+
"value" : "<placeholder>"
39+
},
40+
{
41+
"key" : "existingPasswordUserEmail",
42+
"value" : "<placeholder>"
43+
},
44+
{
45+
"key" : "existingUserPassword",
46+
"value" : "<placeholder>"
47+
},
48+
{
49+
"key" : "clientId",
50+
"value" : "<placeholder>"
51+
},
52+
{
53+
"key" : "useMockAPI",
54+
"value" : "true"
55+
},
56+
{
57+
"key" : "mockAPIURL",
58+
"value" : "<placeholder>"
59+
}
60+
]
61+
}
62+
}
63+
],
64+
"defaultOptions" : {
65+
"codeCoverage" : false,
66+
"testRepetitionMode" : "retryOnFailure",
67+
"testTimeoutsEnabled" : true
68+
},
69+
"testTargets" : [
70+
{
71+
"target" : {
72+
"containerPath" : "container:MSAL.xcodeproj",
73+
"identifier" : "DE1BD0CE2C3C275200B0888E",
74+
"name" : "MSAL Mac Native Auth Integration Tests"
75+
}
76+
}
77+
],
78+
"version" : 1
79+
}

0 commit comments

Comments
 (0)