Skip to content

Commit 723db12

Browse files
author
dtopuzov
committed
Update emulator tests
1 parent 7f223cc commit 723db12

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

tests/emulate/emulate_android.py

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,36 +38,28 @@ def setUp(self):
3838
Folder.cleanup('./TNS_App/platforms/android/build/outputs')
3939

4040
def tearDown(self):
41-
pass
41+
Emulator.stop_emulators()
4242

4343
@classmethod
4444
def tearDownClass(cls):
4545
Emulator.stop_emulators()
4646
Folder.cleanup('./TNS_App')
4747

48-
@unittest.skip("Skipped because of https://github.com/NativeScript/nativescript-cli/issues/352")
4948
def test_001_emulate_android_in_running_emulator(self):
5049

5150
Emulator.ensure_available()
52-
53-
Tns.create_app_platform_add(app_name="TNS_App",
54-
platform="android", framework_path=ANDROID_RUNTIME_PATH)
5551
output = run(TNS_PATH + " emulate android --path TNS_App --timeout 600 --justlaunch", timeout=660)
5652
assert "Project successfully prepared" in output
5753
assert "Project successfully built" in output
58-
59-
# Emulator can not be started without active UI
60-
if ('ACTIVE_UI' in os.environ) and ("YES" in os.environ['ACTIVE_UI']):
61-
assert "installing" in output
62-
assert "running" in output
63-
assert not "Starting Android emulator with image" in output
54+
assert "Successfully deployed on device with identifier 'emulator-5554'" in output
55+
assert not "Starting Android emulator with image" in output
6456

6557
# TODO: Get device id and verify files are deployed and process is
6658
# running on this device
6759

6860
def test_002_emulate_android_release(self):
6961

70-
output = run(TNS_PATH + " emulate android --avd Api19 " +
62+
output = run(TNS_PATH + " emulate android --device Api19 " +
7163
"--keyStorePath " + ANDROID_KEYSTORE_PATH +
7264
" --keyStorePassword " + ANDROID_KEYSTORE_PASS +
7365
" --keyStoreAlias " + ANDROID_KEYSTORE_ALIAS +
@@ -91,7 +83,7 @@ def test_200_emulate_android_inside_project_and_specify_emulator_name(self):
9183
current_dir = os.getcwd()
9284
os.chdir(os.path.join(current_dir, "TNS_App"))
9385
output = run(os.path.join("..", TNS_PATH) +
94-
" emulate android --avd Api19 --timeout 600 --justlaunch", timeout=660)
86+
" emulate android --device Api19 --timeout 600 --justlaunch", timeout=660)
9587
os.chdir(current_dir)
9688
assert "Project successfully prepared" in output
9789
assert "Project successfully built" in output
@@ -105,7 +97,7 @@ def test_200_emulate_android_inside_project_and_specify_emulator_name(self):
10597
def test_300_emulate_android_platform_not_added(self):
10698
Tns.create_app(app_name="TNSAppNoPlatform")
10799
output = run(TNS_PATH +
108-
" emulate android --avd Api19 --timeout 600 --justlaunch --path TNSAppNoPlatform",
100+
" emulate android --device Api19 --timeout 600 --justlaunch --path TNSAppNoPlatform",
109101
timeout=660)
110102
assert "Copying template files..." in output
111103
assert "Project successfully created." in output
@@ -125,12 +117,19 @@ def test_400_emulate_invalid_platform(self):
125117
assert "The input is not valid sub-command for 'emulate' command" in output
126118
assert "Usage" in output
127119

128-
@unittest.skip(
129-
"Skipped because of https://github.com/NativeScript/nativescript-cli/issues/289")
130120
def test_401_emulate_invalid_avd(self):
131121
output = run(TNS_PATH + \
132-
" emulate android --avd invaliddevice_id --path TNS_App --timeout 600 --justlaunch",
122+
" emulate android --device invaliddevice_id --path TNS_App --timeout 600 --justlaunch",
133123
timeout=660)
134-
# TODO: Modify assert when issue is fixed
135-
assert "'invalidPlatform' is not valid sub-command for 'emulate' command" in output
124+
assert not "Option --avd is no longer supported. Please use --device isntead!" in output
125+
assert "Cannot find device with name: invaliddevice_id" in output
126+
assert "Usage" in output
127+
128+
129+
def test_402_emulate_invalid_avd(self):
130+
output = run(TNS_PATH +
131+
" emulate android --avd invaliddevice_id --path TNS_App --timeout 600 --justlaunch",
132+
timeout=660)
133+
assert "Option --avd is no longer supported. Please use --device isntead!"
134+
assert "Cannot find device with name: invaliddevice_id" in output
136135
assert "Usage" in output

0 commit comments

Comments
 (0)