1
1
import { AppiumDriver , createDriver , SearchOptions } from "nativescript-dev-appium" ;
2
- import { isSauceLab , runType , capabilitiesName } from "nativescript-dev-appium/lib/parser" ;
2
+ import { isSauceLab , runType } from "nativescript-dev-appium/lib/parser" ;
3
3
import { expect } from "chai" ;
4
4
5
5
const isSauceRun = isSauceLab ;
@@ -30,22 +30,21 @@ describe("Imagepicker", async function () {
30
30
// await driver.driver.resetApp();
31
31
const pickSingleButtonText = "Pick Single" ;
32
32
let confirmButtonText = isAndroid ? "Allow" : "OK" ;
33
- let uploadPicVerification = "image 0" ;
34
33
35
- const pickSingleButton = await driver . findElementByText ( pickSingleButtonText , SearchOptions . contains ) ;
34
+ let pickSingleButton = await driver . findElementByText ( pickSingleButtonText , SearchOptions . contains ) ;
36
35
await pickSingleButton . click ( ) ;
37
36
const confirmButton = await driver . findElementByText ( confirmButtonText ) ;
38
37
await confirmButton . click ( ) ;
39
38
40
39
if ( isAndroid ) {
41
40
const imagesFolderXpath = await driver . elementHelper . getXPathByText ( imagesFolderName , SearchOptions . contains ) ;
42
41
await driver . driver . sleep ( 3000 ) ;
43
- const imagesFolder = await driver . driver . elementByXPathIfExists ( imagesFolderXpath , 10000 ) ;
42
+ let imagesFolder = await driver . driver . elementByXPathIfExists ( imagesFolderXpath , 10000 ) ;
44
43
45
44
if ( isSauceRun && imagesFolder ) {
46
45
await imagesFolder . click ( ) ;
47
- const downloadFolder = await driver . findElementByClassName ( driver . locators . image ) ;
48
- await downloadFolder . click ( ) ;
46
+ imagesFolder = await driver . findElementByClassName ( driver . locators . image ) ;
47
+ await imagesFolder . click ( ) ;
49
48
}
50
49
} else {
51
50
const cameraRollFolder = await driver . findElementByText ( imagesFolderNameIos ) ;
@@ -55,7 +54,10 @@ describe("Imagepicker", async function () {
55
54
const pickedImage = await driver . findElementByClassName ( driver . locators . image ) ;
56
55
await pickedImage . click ( ) ;
57
56
58
- const result = await driver . findElementByText ( uploadPicVerification , SearchOptions . contains ) ;
57
+ pickSingleButton = await driver . findElementByText ( pickSingleButtonText , SearchOptions . contains ) ;
58
+ expect ( pickSingleButton ) . to . exist ;
59
+
60
+ const result = await driver . findElementByClassName ( driver . locators . image ) ;
59
61
expect ( result ) . to . exist ;
60
62
} ) ;
61
63
0 commit comments