From 98fb88a8823f2028ddf0ae3c8c70cdca228d43f2 Mon Sep 17 00:00:00 2001 From: Salakar Date: Sun, 13 May 2018 00:37:47 +0100 Subject: [PATCH] [tests][auth] misc email auth tests --- bridge/e2e/auth/auth.e2e.js | 6 +-- bridge/e2e/auth/emailLink.e2e.js | 38 ++++++++++++++ bridge/e2e/auth/provider.e2e.js | 2 +- bridge/ios/Podfile.lock | 54 ++++++++++---------- bridge/ios/testing.xcodeproj/project.pbxproj | 8 +-- 5 files changed, 70 insertions(+), 38 deletions(-) create mode 100644 bridge/e2e/auth/emailLink.e2e.js diff --git a/bridge/e2e/auth/auth.e2e.js b/bridge/e2e/auth/auth.e2e.js index 02e74ed2..b71cf3b2 100644 --- a/bridge/e2e/auth/auth.e2e.js +++ b/bridge/e2e/auth/auth.e2e.js @@ -991,7 +991,7 @@ describe('auth()', () => { new Error( `A user is currently signed in. ${ firebase.auth().currentUser.uid - }` + }` ) ); } @@ -1099,9 +1099,7 @@ describe('auth()', () => { } catch (error) { // Reject await firebase.auth().currentUser.delete(); - Promise.reject( - new Error('sendPasswordResetEmail() caused an error', error) - ); + throw new Error('sendPasswordResetEmail() caused an error', error); } }); }); diff --git a/bridge/e2e/auth/emailLink.e2e.js b/bridge/e2e/auth/emailLink.e2e.js new file mode 100644 index 00000000..acb9ae25 --- /dev/null +++ b/bridge/e2e/auth/emailLink.e2e.js @@ -0,0 +1,38 @@ +describe('auth() -> emailLink Provider', () => { + describe('sendSignInLinkToEmail', () => { + it('should send email', async () => { + const random = randomString(12, '#aA'); + const email = `${random}@${random}.com`; + // const email = 'MANUAL TEST EMAIL HERE'; + const actionCodeSettings = { + url: 'http://localhost:1337/authLinkFoo?bar=1234', + handleCodeInApp: true, + iOS: { + bundleId: 'com.testing', + }, + android: { + packageName: 'com.testing', + installApp: true, + minimumVersion: '12', + }, + }; + await firebase.auth().sendSignInLinkToEmail(email, actionCodeSettings); + }); + }); + + // FOR MANUAL TESTING ONLY + xdescribe('signInWithEmailLink', () => { + it('should signIn', async () => { + const email = 'MANUAL TEST EMAIL HERE'; + const emailLink = 'MANUAL TEST CODE HERE'; + + const userCredential = await firebase + .auth() + .signInWithEmailLink(email, emailLink); + + userCredential.user.email.should.equal(email); + + await await firebase.auth().signOut(); + }); + }); +}); diff --git a/bridge/e2e/auth/provider.e2e.js b/bridge/e2e/auth/provider.e2e.js index e3319110..d98b2e6a 100644 --- a/bridge/e2e/auth/provider.e2e.js +++ b/bridge/e2e/auth/provider.e2e.js @@ -1,4 +1,4 @@ -describe.only('auth() -> Providers', () => { +describe('auth() -> Providers', () => { describe('EmailAuthProvider', () => { describe('constructor', () => { it('should throw an unsupported error', () => { diff --git a/bridge/ios/Podfile.lock b/bridge/ios/Podfile.lock index 465d68c0..7539564c 100644 --- a/bridge/ios/Podfile.lock +++ b/bridge/ios/Podfile.lock @@ -139,27 +139,27 @@ PODS: - GoogleToolboxForMac/NSString+URLArguments (~> 2.1) - GTMOAuth2 (~> 1.0) - GTMSessionFetcher/Core (~> 1.1) - - GoogleToolboxForMac/Core (2.1.4): - - GoogleToolboxForMac/Defines (= 2.1.4) - - GoogleToolboxForMac/DebugUtils (2.1.4): - - GoogleToolboxForMac/Defines (= 2.1.4) - - GoogleToolboxForMac/Defines (2.1.4) - - GoogleToolboxForMac/Logger (2.1.4): - - GoogleToolboxForMac/Defines (= 2.1.4) - - GoogleToolboxForMac/NSData+zlib (2.1.4): - - GoogleToolboxForMac/Defines (= 2.1.4) - - GoogleToolboxForMac/NSDictionary+URLArguments (2.1.4): - - GoogleToolboxForMac/DebugUtils (= 2.1.4) - - GoogleToolboxForMac/Defines (= 2.1.4) - - GoogleToolboxForMac/NSString+URLArguments (= 2.1.4) - - GoogleToolboxForMac/NSString+URLArguments (2.1.4) - - GoogleToolboxForMac/StringEncoding (2.1.4): - - GoogleToolboxForMac/Defines (= 2.1.4) - - GoogleToolboxForMac/URLBuilder (2.1.4): - - GoogleToolboxForMac/Core (= 2.1.4) - - GoogleToolboxForMac/Defines (= 2.1.4) - - GoogleToolboxForMac/NSDictionary+URLArguments (= 2.1.4) - - GoogleToolboxForMac/NSString+URLArguments (= 2.1.4) + - GoogleToolboxForMac/Core (2.1.3): + - GoogleToolboxForMac/Defines (= 2.1.3) + - GoogleToolboxForMac/DebugUtils (2.1.3): + - GoogleToolboxForMac/Defines (= 2.1.3) + - GoogleToolboxForMac/Defines (2.1.3) + - GoogleToolboxForMac/Logger (2.1.3): + - GoogleToolboxForMac/Defines (= 2.1.3) + - GoogleToolboxForMac/NSData+zlib (2.1.3): + - GoogleToolboxForMac/Defines (= 2.1.3) + - GoogleToolboxForMac/NSDictionary+URLArguments (2.1.3): + - GoogleToolboxForMac/DebugUtils (= 2.1.3) + - GoogleToolboxForMac/Defines (= 2.1.3) + - GoogleToolboxForMac/NSString+URLArguments (= 2.1.3) + - GoogleToolboxForMac/NSString+URLArguments (2.1.3) + - GoogleToolboxForMac/StringEncoding (2.1.3): + - GoogleToolboxForMac/Defines (= 2.1.3) + - GoogleToolboxForMac/URLBuilder (2.1.3): + - GoogleToolboxForMac/Core (= 2.1.3) + - GoogleToolboxForMac/Defines (= 2.1.3) + - GoogleToolboxForMac/NSDictionary+URLArguments (= 2.1.3) + - GoogleToolboxForMac/NSString+URLArguments (= 2.1.3) - gRPC (1.11.0): - gRPC-RxLibrary (= 1.11.0) - gRPC/Main (= 1.11.0) @@ -208,7 +208,7 @@ PODS: - React/Core - React/fishhook - React/RCTBlob - - RNFirebase (4.0.7): + - RNFirebase (4.1.0): - Firebase/Core - React - yoga (0.55.3.React) @@ -268,7 +268,7 @@ SPEC CHECKSUMS: Google-Mobile-Ads-SDK: 7404f68120ae8682afeb5af001fbf4aad731c78e GoogleAPIClientForREST: f7951c455df271bc6259b3ddb4073d0026475ccf GoogleSignIn: d9ef55b10f0aa401a5de2747f59b725e4b9732ac - GoogleToolboxForMac: 91c824d21e85b31c2aae9bb011c5027c9b4e738f + GoogleToolboxForMac: 2501e2ad72a52eb3dfe7bd9aee7dad11b858bd20 gRPC: 70703dc9ba31c72341fc7f37745cc1c379edee96 gRPC-Core: 164639cd8ae18ca8b65477fafb2efbaecf4f181a gRPC-ProtoRPC: bb5fddf3424aa4fad74d76736578a79fe40e244e @@ -278,10 +278,10 @@ SPEC CHECKSUMS: leveldb-library: 08cba283675b7ed2d99629a4bc5fd052cd2bb6a5 nanopb: 5601e6bca2dbf1ed831b519092ec110f66982ca3 Protobuf: 8a9838fba8dae3389230e1b7f8c104aa32389c03 - React: aa2040dbb6f317b95314968021bd2888816e03d5 - RNFirebase: 2b25fd2e60269f26bb0a76c71dcc942b35a77df0 - yoga: a23273df0088bf7f2bb7e5d7b00044ea57a2a54a + React: 573d89cf10312b17920df6328eaf9ab8059283bf + RNFirebase: 387fb46208f07da221cb3e815aaf680bb8f9e26e + yoga: 9403c2451c1b47d8cee3e4f1b6fd0ececc63839c PODFILE CHECKSUM: 582ceaad051470812ad9203e13b5ea8ad20c78ac -COCOAPODS: 1.4.0 +COCOAPODS: 1.3.1 diff --git a/bridge/ios/testing.xcodeproj/project.pbxproj b/bridge/ios/testing.xcodeproj/project.pbxproj index ae6883f8..344035b6 100644 --- a/bridge/ios/testing.xcodeproj/project.pbxproj +++ b/bridge/ios/testing.xcodeproj/project.pbxproj @@ -1029,15 +1029,11 @@ "${PODS_ROOT}/FirebaseInvites/Resources/GPPACLPickerResources.bundle", "${PODS_ROOT}/GTMOAuth2/Source/Touch/GTMOAuth2ViewTouch.xib", "${PODS_ROOT}/GoogleSignIn/Resources/GoogleSignIn.bundle", - "${PODS_CONFIGURATION_BUILD_DIR}/gRPC/gRPCCertificates.bundle", + "$PODS_CONFIGURATION_BUILD_DIR/gRPC/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GINInviteResources.bundle", - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GPPACLPickerResources.bundle", - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GTMOAuth2ViewTouch.nib", - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleSignIn.bundle", - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh;