Skip to content

Commit 01ea81f

Browse files
Vasil ChimevVasil Chimev
Vasil Chimev
authored and
Vasil Chimev
committed
Add CocoaPods Tests.
1 parent 6ef8b21 commit 01ea81f

File tree

1 file changed

+103
-7
lines changed

1 file changed

+103
-7
lines changed

tests/plugins_osx_pods.py

+103-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import unittest
22

33
from helpers._os_lib import CleanupFolder, runAUT, FileExists
4-
from helpers._tns_lib import Build, iosRuntimePath, \
4+
from helpers._tns_lib import Build, iosRuntimeSymlinkPath, \
55
tnsPath, CreateProject, PlatformAdd, Prepare
66

77
class Plugins_OSX_Pods(unittest.TestCase):
@@ -14,10 +14,10 @@ def setUp(self):
1414
print "#####"
1515
print ""
1616

17-
CleanupFolder('./TNS_App');
17+
CleanupFolder('./TNS_App')
1818

1919
def tearDown(self):
20-
CleanupFolder('./TNS_App');
20+
pass
2121

2222
def test_001_PluginAdd_Pod_GoogleMaps_Before_PlatformAdd_iOS(self):
2323
CreateProject(projName="TNS_App");
@@ -33,7 +33,7 @@ def test_001_PluginAdd_Pod_GoogleMaps_Before_PlatformAdd_iOS(self):
3333
assert ("dependencies" in output)
3434
assert ("googlesdk" in output)
3535

36-
PlatformAdd(platform="ios", frameworkPath=iosRuntimePath, path="TNS_App")
36+
PlatformAdd(platform="ios", frameworkPath=iosRuntimeSymlinkPath, path="TNS_App")
3737
output = Prepare(platform="ios", path="TNS_App")
3838
assert ("Installing pods..." in output)
3939
assert ("Successfully prepared plugin googlesdk for ios." in output)
@@ -52,7 +52,7 @@ def test_001_PluginAdd_Pod_GoogleMaps_Before_PlatformAdd_iOS(self):
5252

5353
def test_002_PluginAdd_Pod_GoogleMaps_After_PlatformAdd_iOS(self):
5454
CreateProject(projName="TNS_App");
55-
PlatformAdd(platform="ios", frameworkPath=iosRuntimePath, path="TNS_App")
55+
PlatformAdd(platform="ios", frameworkPath=iosRuntimeSymlinkPath, path="TNS_App")
5656

5757
output = runAUT(tnsPath + " plugin add QA-TestApps/CocoaPods/googlesdk --path TNS_App")
5858
assert ("TNS_App/node_modules/googlesdk" in output)
@@ -77,9 +77,105 @@ def test_002_PluginAdd_Pod_GoogleMaps_After_PlatformAdd_iOS(self):
7777
output = runAUT("cat TNS_App/platforms/ios/TNSApp.xcworkspace/contents.xcworkspacedata")
7878
assert ("location = \"group:TNSApp.xcodeproj\">" in output)
7979
assert ("location = \"group:Pods/Pods.xcodeproj\">" in output)
80+
assert FileExists("TNS_App/platforms/ios/Pods/Pods.xcodeproj")
81+
82+
def test_003_PluginAdd_MultiplePods(self):
83+
CreateProject(projName="TNS_App");
84+
PlatformAdd(platform="ios", frameworkPath=iosRuntimeSymlinkPath, path="TNS_App")
85+
86+
output = runAUT(tnsPath + " plugin add QA-TestApps/CocoaPods/carousel --path TNS_App")
87+
assert ("TNS_App/node_modules/carousel" in output)
88+
assert ("Successfully installed plugin carousel." in output)
89+
assert FileExists("TNS_App/node_modules/carousel/package.json")
90+
assert FileExists("TNS_App/node_modules/carousel/platforms/ios/Podfile")
91+
92+
output = runAUT("cat TNS_App/package.json")
93+
assert ("carousel" in output)
94+
95+
output = runAUT(tnsPath + " plugin add QA-TestApps/CocoaPods/keychain --path TNS_App")
96+
assert ("TNS_App/node_modules/keychain" in output)
97+
assert ("Successfully installed plugin keychain." in output)
98+
assert FileExists("TNS_App/node_modules/keychain/package.json")
99+
assert FileExists("TNS_App/node_modules/keychain/platforms/ios/Podfile")
100+
101+
output = runAUT("cat TNS_App/package.json")
102+
assert ("keychain" in output)
103+
104+
output = Build(platform="ios", path="TNS_App")
105+
assert ("Installing pods..." in output)
106+
assert ("Successfully prepared plugin carousel for ios." in output)
107+
assert ("Successfully prepared plugin keychain for ios." in output)
80108

109+
output = runAUT("cat TNS_App/platforms/ios/Podfile")
110+
assert ("pod 'iCarousel'" in output)
111+
assert ("pod 'AFNetworking'" in output)
112+
assert ("pod 'UICKeyChainStore'" in output)
113+
114+
output = runAUT("cat TNS_App/platforms/ios/TNSApp.xcworkspace/contents.xcworkspacedata")
115+
assert ("location = \"group:TNSApp.xcodeproj\">" in output)
116+
assert ("location = \"group:Pods/Pods.xcodeproj\">" in output)
81117
assert FileExists("TNS_App/platforms/ios/Pods/Pods.xcodeproj")
82118

119+
def test_004_Prepare_Install_Pods(self):
120+
CreateProject(projName="TNS_App");
121+
PlatformAdd(platform="ios", frameworkPath=iosRuntimeSymlinkPath, path="TNS_App")
122+
123+
runAUT("cp QA-TestApps/CocoaPods/carousel/platforms/ios/Podfile TNS_App/platforms/ios")
124+
output = Build(platform="ios", path="TNS_App")
125+
assert ("Creating project scheme..." in output)
126+
assert ("Installing pods..." in output)
127+
128+
output = runAUT("cat TNS_App/platforms/ios/Podfile")
129+
assert ("pod 'iCarousel'" in output)
130+
assert ("pod 'AFNetworking'" in output)
131+
132+
output = runAUT("cat TNS_App/platforms/ios/TNSApp.xcworkspace/contents.xcworkspacedata")
133+
assert ("location = \"group:TNSApp.xcodeproj\">" in output)
134+
assert ("location = \"group:Pods/Pods.xcodeproj\">" in output)
135+
assert FileExists("TNS_App/platforms/ios/Pods/Pods.xcodeproj")
136+
137+
def test_401_PluginAdd_InvalidPod(self):
138+
CreateProject(projName="TNS_App");
139+
PlatformAdd(platform="ios", frameworkPath=iosRuntimeSymlinkPath, path="TNS_App")
140+
141+
output = runAUT(tnsPath + " plugin add QA-TestApps/CocoaPods/invalidpod --path TNS_App")
142+
assert ("TNS_App/node_modules/invalidpod" in output)
143+
assert ("Successfully installed plugin invalidpod." in output)
144+
assert FileExists("TNS_App/node_modules/invalidpod/package.json")
145+
assert FileExists("TNS_App/node_modules/invalidpod/platforms/ios/Podfile")
146+
147+
output = runAUT("cat TNS_App/package.json")
148+
assert ("invalidpod" in output)
149+
150+
output = Prepare(platform="ios", path="TNS_App", assertSuccess=False)
151+
assert ("Installing pods..." in output)
152+
assert ("Processing node_modules failed. Error:Error: Command failed: /bin/sh -c pod install" in output)
153+
154+
output = runAUT("cat TNS_App/platforms/ios/Podfile")
155+
assert ("pod 'InvalidPod'" in output)
156+
157+
assert not FileExists("TNS_App/platforms/ios/TNSApp.xcworkspace")
158+
assert not FileExists("TNS_App/platforms/ios/Pods/Pods.xcodeproj")
159+
160+
def test_402_PluginAdd_InvalidPodFile(self):
161+
CreateProject(projName="TNS_App");
162+
PlatformAdd(platform="ios", frameworkPath=iosRuntimeSymlinkPath, path="TNS_App")
163+
164+
output = runAUT(tnsPath + " plugin add QA-TestApps/CocoaPods/invalidpodfile --path TNS_App")
165+
assert ("TNS_App/node_modules/invalidpodfile" in output)
166+
assert ("Successfully installed plugin invalidpodfile." in output)
167+
assert FileExists("TNS_App/node_modules/invalidpodfile/package.json")
168+
assert FileExists("TNS_App/node_modules/invalidpodfile/platforms/ios/Podfile")
169+
170+
output = runAUT("cat TNS_App/package.json")
171+
assert ("invalidpodfile" in output)
172+
173+
output = Prepare(platform="ios", path="TNS_App", assertSuccess=False)
174+
assert ("Installing pods..." in output)
175+
assert ("Processing node_modules failed. Error:Error: Command failed: /bin/sh -c pod install" in output)
176+
177+
output = runAUT("cat TNS_App/platforms/ios/Podfile")
178+
assert ("pod UICKeyChainStore" in output)
83179

84-
# def test_401_PluginAdd_InvalidPod(self):
85-
# pass
180+
assert not FileExists("TNS_App/platforms/ios/TNSApp.xcworkspace")
181+
assert not FileExists("TNS_App/platforms/ios/Pods/Pods.xcodeproj")

0 commit comments

Comments
 (0)