appium-webdriverio-typescript icon indicating copy to clipboard operation
appium-webdriverio-typescript copied to clipboard

Unable to transpile

Open SrikanthTakkellapati opened this issue 6 years ago • 18 comments

Hi,

When I try to transpile, I get the following errors,

node_modules/@types/chai/index.d.ts:121:9 - error TS8020: JSDoc types can only be used inside documentation comments. 121 any?, // actual value ~~~~ node_modules/@types/chai/index.d.ts:122:9 - error TS8020: JSDoc types can only be used inside documentation comments.

122 boolean? // showDiff ~~~~~~~~ node_modules/@types/chai/index.d.ts:126:16 - error TS2370: A rest parameter must be of an array type. 126 assert(...args: AssertionArgs): void; ~~~~~~~~~~~~~~~~~~~~~~

Could this please be helped??

Thanks, Srikanth T.

SrikanthTakkellapati avatar Sep 26 '19 19:09 SrikanthTakkellapati

Hi,

I see that the issue is fixed when I used 4.0.6

SrikanthTakkellapati avatar Sep 27 '19 16:09 SrikanthTakkellapati

Hi, I am also facing same issue. Could you please explain how we can fix it. What is meaning of 4.0.6

Thanks Navaneet Kumar

navaneetit09 avatar Nov 05 '19 07:11 navaneetit09

after fixing above errors, now i am getting error as below when i ran " npm run app-test"

npm run app-test

[email protected] app-test C:\Users\navkumar13\Desktop\appium-webdriverio-typescript-master wdio ./config/wdio.app.config.js

<<< NATIVE APP TESTS STARTED >>> events.js:174 throw er; // Unhandled 'error' event ^

Error: spawn appium ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19) at onErrorNT (internal/child_process.js:415:16) at process._tickCallback (internal/process/next_tick.js:63:19) at Function.Module.runMain (internal/modules/cjs/loader.js:757:11) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3) Emitted 'error' event at: at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12) at onErrorNT (internal/child_process.js:415:16) [... lines matching original stack trace ...] at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] app-test: wdio ./config/wdio.app.config.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] app-test script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\navkumar13\AppData\Roaming\npm-cache_logs\2019-11-05T10_22_00_638Z-debug.log PS C:\Users\navkumar13\Desktop\appium-webdriverio-typescript-master>

navaneetit09 avatar Nov 05 '19 10:11 navaneetit09

@navaneetit09 currently I am getting the same issue. I've been trying to figure where exactly it's coming from.

Fuun347 avatar Nov 21 '19 02:11 Fuun347

@navaneetit09 I assume you moved on from this project, but I was able to fix the issue by changing the configuration as seen before. I am able to run tests now. I also changed the old and deprecated libraries to their newer equivalents.

capabilities: [
    {
        appiumVersion: '1.8.1',                 // Appium module version
        platformName: 'Android',
        app: './app-apk/app.apk',          // Path to your native app
        platformVersion: '9',              // Android platform version of the device
        waitforTimeout: waitforTimeout,
        commandTimeout: commandTimeout,
        deviceName: 'Pixel XL',
        newCommandTimeout: 30 * 60000,
    }
],

services: ['appium'],
appium: {
    args: {
        platformName: "Android",
        platformVersion: "9",
        deviceName: "Pixel XL",
        automationName: "UiAutomator2",
        app: "./app-apk/app.apk",
        address: host,
        port: port,
        commandTimeout: commandTimeout,
        sessionOverride: true,
        debugLogSpacing: true
    },
},

Fuun347 avatar Nov 27 '19 01:11 Fuun347

Hi, I am also facing same issue. Could you please explain how we can fix it. What is meaning of 4.0.6

Thanks Navaneet Kumar

Hi, May know what is this change, Thanks

yashwanthkumar1796 avatar Dec 14 '19 23:12 yashwanthkumar1796

Hi, I am also facing same issue. Could you please explain how we can fix it. What is meaning of 4.0.6 Thanks Navaneet Kumar

Hi, May know what is this change, Thanks

@Fuun347 Could you please help me with this.

yashwanthkumar1796 avatar Dec 14 '19 23:12 yashwanthkumar1796

@yashwanthkumar1796 not sure what 4.0.6 refers to. What I was forced to do myself is make a new framework from scratch. There are so many issues with this one. Most of the wdio libraries used are unsupported, so if you plan on using this framework, go and manually replace them with their new versions. The config is also very outdated so you might need to change some parts of it as well. The snippet above is from my config and it's for wdio and appium.

Fuun347 avatar Dec 15 '19 00:12 Fuun347

@Fuun347 could you may be share your package.json, thanks

yashwanthkumar1796 avatar Dec 15 '19 00:12 yashwanthkumar1796

"dependencies": { "@wdio/appium-service": "^5.16.5", "@wdio/cli": "^5.16.7", "@wdio/cucumber-framework": "^5.16.6", "@wdio/local-runner": "^5.16.8", "@wdio/reporter": "^5.15.2", "appium": "^1.15.1", "appium-uiautomator2-driver": "^1.39.0", "chai": "^4.2.0", "chai-as-promised": "^7.1.1", "cmake-js": "^6.0.0", "cucumber": "^6.0.5", "cucumber-html-reporter": "^5.0.2", "fs-extra": "^8.1.0", "multiple-cucumber-html-reporter": "^1.13.1", "nodemailer": "^6.3.1", "request-promise-native": "^1.0.8", "wdio-cucumberjs-json-reporter": "^1.1.2", "webdriver": "^5.16.7", "webdriverio": "^5.16.8", "windows-build-tools": "^5.2.2" }, "devDependencies": { "@types/chai": "^4.2.5", "@types/chai-as-promised": "^7.1.2", "@types/cucumber": "^6.0.0", "@types/fs-extra": "^8.0.1", "@types/node": "^12.12.11", "@types/nodemailer": "^6.2.2", "@types/request-promise-native": "^1.0.17", "ts-node": "^8.5.2", "tsconfig-paths": "^3.9.0", "typescript": "^3.7.2" }

Fuun347 avatar Dec 15 '19 00:12 Fuun347

@yashwanthkumar1796 a number of the libraries are going unused, haven't had the budged to clean up yet the framework properly, or to add all the features I'd like

Fuun347 avatar Dec 15 '19 00:12 Fuun347

@Fuun347 Even after updating the pacakge.json, iam getting more errors:

pages/appiumPage.ts:7:54 - error TS2339: Property 'element' does not exist on type 'BrowserObject'.

7 public get searchTextBox(): any { return browser.element('input[type="search"]'); } ~~~~~~~

pages/appiumPage.ts:8:53 - error TS2339: Property 'element' does not exist on type 'BrowserObject'.

8 public get searchButton(): any { return browser.element('button[aria-label="Google Search"]'); } ~~~~~~~

pages/appiumPage.ts:9:48 - error TS2339: Property 'waitForVisible' does not exist on type 'BrowserObject'.

9 public get results(): any { return browser.waitForVisible('#ires #rso', 5000); } ~~~~~~~~~~~~~~

pages/appiumPage.ts:10:50 - error TS2339: Property 'element' does not exist on type 'BrowserObject'.

10 public get firstLink(): any { return browser.element('#rso > div:nth-child(1) > div > div > div > div:nth-child(1) > div > a'); } ~~~~~~~

pages/appiumPage.ts:14:51 - error TS2339: Property 'element' does not exist on type 'BrowserObject'.

14 public get linkButton(): any { return browser.element('body > nav.navbar.navbar-inverse.navbar-static-top button'); } ~~~~~~~

pages/appiumPage.ts:15:53 - error TS2339: Property 'element' does not exist on type 'BrowserObject'.

15 public get tutorialLink(): any { return browser.element('#bs-example-navbar-collapse-1 > ul > li:nth-child(7) > a'); } ~~~~~~~

pages/appiumPage.ts:16:50 - error TS2339: Property 'element' does not exist on type 'BrowserObject'.

16 public get firstBook(): any { return browser.element('#readmeMarkdown > div:nth-child(1) > a.resource-title'); } ~~~~~~~

pages/appiumPage.ts:17:61 - error TS2339: Property 'element' does not exist on type 'BrowserObject'.

17 public get androidTutorialTitle(): any { return browser.element('#native-android-automation').getText(); } ~~~~~~~

stepDefinitions/calcSteps.ts:14:27 - error TS2339: Property 'getText' does not exist on type 'BrowserObject'.

14 const title = browser.getText('android.widget.TextView'); ~~~~~~~

stepDefinitions/calcSteps.ts:19:13 - error TS2339: Property 'click' does not exist on type 'BrowserObject'.

19 browser.click(calc.calcDigitSelector(num1)); ~~~~~

stepDefinitions/calcSteps.ts:20:13 - error TS2339: Property 'click' does not exist on type 'BrowserObject'.

20 browser.click(calc.addOperator); ~~~~~

stepDefinitions/calcSteps.ts:21:13 - error TS2339: Property 'click' does not exist on type 'BrowserObject'.

21 browser.click(calc.calcDigitSelector(num2)); ~~~~~

stepDefinitions/calcSteps.ts:22:13 - error TS2339: Property 'click' does not exist on type 'BrowserObject'.

22 browser.click(calc.equalOperator); ~~~~~

stepDefinitions/calcSteps.ts:26:13 - error TS2339: Property 'click' does not exist on type 'BrowserObject'.

26 browser.click(calc.calcDigitSelector(num1)); ~~~~~

stepDefinitions/calcSteps.ts:27:13 - error TS2339: Property 'click' does not exist on type 'BrowserObject'.

27 browser.click(calc.subtractOperator); ~~~~~

stepDefinitions/calcSteps.ts:28:13 - error TS2339: Property 'click' does not exist on type 'BrowserObject'.

28 browser.click(calc.calcDigitSelector(num2)); ~~~~~

stepDefinitions/calcSteps.ts:29:13 - error TS2339: Property 'click' does not exist on type 'BrowserObject'.

29 browser.click(calc.equalOperator); ~~~~~

stepDefinitions/calcSteps.ts:33:13 - error TS2339: Property 'click' does not exist on type 'BrowserObject'.

33 browser.click(calc.calcDigitSelector(num1)); ~~~~~

stepDefinitions/calcSteps.ts:34:13 - error TS2339: Property 'click' does not exist on type 'BrowserObject'.

34 browser.click(calc.multiplyOperator); ~~~~~

stepDefinitions/calcSteps.ts:35:13 - error TS2339: Property 'click' does not exist on type 'BrowserObject'.

35 browser.click(calc.calcDigitSelector(num2)); ~~~~~

stepDefinitions/calcSteps.ts:36:13 - error TS2339: Property 'click' does not exist on type 'BrowserObject'.

36 browser.click(calc.equalOperator); ~~~~~

stepDefinitions/calcSteps.ts:40:13 - error TS2339: Property 'click' does not exist on type 'BrowserObject'.

40 browser.click(calc.calcDigitSelector(num1)); ~~~~~

stepDefinitions/calcSteps.ts:41:13 - error TS2339: Property 'click' does not exist on type 'BrowserObject'.

41 browser.click(calc.divisionOperator); ~~~~~

stepDefinitions/calcSteps.ts:42:13 - error TS2339: Property 'click' does not exist on type 'BrowserObject'.

42 browser.click(calc.calcDigitSelector(num2)); ~~~~~

stepDefinitions/calcSteps.ts:43:13 - error TS2339: Property 'click' does not exist on type 'BrowserObject'.

43 browser.click(calc.equalOperator); ~~~~~

stepDefinitions/calcSteps.ts:47:13 - error TS2339: Property 'click' does not exist on type 'BrowserObject'.

47 browser.click(calc.clearOperator); ~~~~~

stepDefinitions/calcSteps.ts:51:27 - error TS2339: Property 'getText' does not exist on type 'BrowserObject'.

51 return expect(browser.getText(calc.outputText)).to.contain(result); ~~~~~~~

stepDefinitions/calcSteps.ts:55:27 - error TS2339: Property 'getText' does not exist on type 'BrowserObject'.

55 return expect(browser.getText(calc.outputText)).to.equal(''); ~~~~~~~

Found 28 errors.

npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! [email protected] build: tsc npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the [email protected] build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\E01835\AppData\Roaming\npm-cache_logs\2019-12-15T09_28_28_167Z-debug.log

yashwanthkumar1796 avatar Dec 15 '19 09:12 yashwanthkumar1796

@Fuun347 I have fixed the above mentioned by updating the new function btut when i run npm run browser-test, i get the following error

0 info it worked if it ends with ok 1 verbose cli [ 'C:\Program Files\nodejs\node.exe', 1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js', 1 verbose cli 'run', 1 verbose cli 'browser-test' ] 2 info using [email protected] 3 info using [email protected] 4 verbose run-script [ 'prebrowser-test', 'browser-test', 'postbrowser-test' ] 5 info lifecycle [email protected]~prebrowser-test: [email protected] 6 info lifecycle [email protected]~browser-test: [email protected] 7 verbose lifecycle [email protected]~browser-test: unsafe-perm in lifecycle true 8 verbose lifecycle [email protected]~browser-test: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\E01835\Desktop\Carnival\Automation\appium-webdriverio-typescript\node_modules.bin;C:\Program Files (x86)\RSA SecurID Token Common;C:\Program Files\RSA SecurID Token Common;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Windows Resource Kits\Tools;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files\Java\jdk1.8.0_121\bin;C:\Users\E01835\AppData\Roaming\npm;C:\Users\E01835\Desktop\android\tools\bin;C:\Users\E01835\Desktop\android\platform-tools;C:\Program Files\RSA SecurID Token Common;C:\Users\E01835\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files\MariaDB 10.2\bin;C:\Program Files\Java\jdk1.8.0_121\bin;C:\Users\E01835\Desktop\android\tools\bin;C:\Users\E01835\Desktop\android\platform-tools;C:\Users\E01835\Desktop\android; 9 verbose lifecycle [email protected]~browser-test: CWD: C:\Users\E01835\Desktop\Carnival\Automation\appium-webdriverio-typescript 10 silly lifecycle [email protected]~browser-test: Args: [ '/d /s /c', 'wdio ./config/wdio.browser.config.js' ] 11 silly lifecycle [email protected]~browser-test: Returned: code: 1 signal: null 12 info lifecycle [email protected]~browser-test: Failed to exec browser-test script 13 verbose stack Error: [email protected] browser-test: wdio ./config/wdio.browser.config.js 13 verbose stack Exit status 1 13 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16) 13 verbose stack at EventEmitter.emit (events.js:198:13) 13 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:198:13) 13 verbose stack at maybeClose (internal/child_process.js:982:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) 14 verbose pkgid [email protected] 15 verbose cwd C:\Users\E01835\Desktop\Carnival\Automation\appium-webdriverio-typescript 16 verbose Windows_NT 10.0.18362 17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "browser-test" 18 verbose node v10.16.2 19 verbose npm v6.9.0 20 error code ELIFECYCLE 21 error errno 1 22 error [email protected] browser-test: wdio ./config/wdio.browser.config.js 22 error Exit status 1 23 error Failed at the [email protected] browser-test script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 1, true ]

yashwanthkumar1796 avatar Dec 15 '19 09:12 yashwanthkumar1796

I'm not really sure why you are getting this error. One of my theories is that you're lacking a driver for the browser as my framework is specifically built and setup for mobile automation rather than browser testing. I have a separate protractor based framework I made for browser testing. I never intended the use of a browser, so the config will differ and might require different libraries.

Fuun347 avatar Dec 15 '19 18:12 Fuun347

@Fuun347 Can you suggest me some repo or example where some has done automation of website on apps using appium.

yashwanthkumar1796 avatar Dec 16 '19 10:12 yashwanthkumar1796

@yashwanthkumar1796 sadly no. What I need I make myself.

Fuun347 avatar Dec 16 '19 18:12 Fuun347

@yashwanthkumar1796 @Fuun347 It's unfortunate due to my work commitments I could not give time for updating the framework.If anyone is willing to send a PR I would be more than happy to guide. Also I will try to find some time in coming holidays to update this framework.

igniteram avatar Dec 17 '19 18:12 igniteram

@igniteram it would be very helpful if you could achieve web app testing on mobiles, Thanks

yashwanthkumar1796 avatar Dec 18 '19 05:12 yashwanthkumar1796