igniteram / appium-webdriverio-typescript

Test framework for automating mobile apps with appium using webdriverio & typescript!
MIT License
82 stars 58 forks source link

Unable to transpile #19

Open SrikanthTakkellapati opened 5 years ago

SrikanthTakkellapati commented 5 years ago

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 commented 5 years ago

Hi,

I see that the issue is fixed when I used 4.0.6

navaneetit09 commented 5 years ago

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 commented 5 years ago

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

npm run app-test

appium-webdriverio-tests@1.0.0 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! appium-webdriverio-tests@1.0.0 app-test: wdio ./config/wdio.app.config.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the appium-webdriverio-tests@1.0.0 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>

Fuun347 commented 4 years ago

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

Fuun347 commented 4 years ago

@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
    },
},
yashwanthkumar1796 commented 4 years ago

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 commented 4 years ago

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.

Fuun347 commented 4 years ago

@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.

yashwanthkumar1796 commented 4 years ago

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

Fuun347 commented 4 years ago

"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 commented 4 years ago

@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

yashwanthkumar1796 commented 4 years ago

@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! appium-webdriverio-tests@1.0.0 build: tsc npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the appium-webdriverio-tests@1.0.0 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 commented 4 years ago

@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 npm@6.9.0 3 info using node@v10.16.2 4 verbose run-script [ 'prebrowser-test', 'browser-test', 'postbrowser-test' ] 5 info lifecycle appium-webdriverio-tests@1.0.0~prebrowser-test: appium-webdriverio-tests@1.0.0 6 info lifecycle appium-webdriverio-tests@1.0.0~browser-test: appium-webdriverio-tests@1.0.0 7 verbose lifecycle appium-webdriverio-tests@1.0.0~browser-test: unsafe-perm in lifecycle true 8 verbose lifecycle appium-webdriverio-tests@1.0.0~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 appium-webdriverio-tests@1.0.0~browser-test: CWD: C:\Users\E01835\Desktop\Carnival\Automation\appium-webdriverio-typescript 10 silly lifecycle appium-webdriverio-tests@1.0.0~browser-test: Args: [ '/d /s /c', 'wdio ./config/wdio.browser.config.js' ] 11 silly lifecycle appium-webdriverio-tests@1.0.0~browser-test: Returned: code: 1 signal: null 12 info lifecycle appium-webdriverio-tests@1.0.0~browser-test: Failed to exec browser-test script 13 verbose stack Error: appium-webdriverio-tests@1.0.0 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 appium-webdriverio-tests@1.0.0 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 appium-webdriverio-tests@1.0.0 browser-test: wdio ./config/wdio.browser.config.js 22 error Exit status 1 23 error Failed at the appium-webdriverio-tests@1.0.0 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 ]

Fuun347 commented 4 years ago

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.

yashwanthkumar1796 commented 4 years ago

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

Fuun347 commented 4 years ago

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

igniteram commented 4 years ago

@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.

yashwanthkumar1796 commented 4 years ago

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