Code Monkey home page Code Monkey logo

Comments (14)

vadimperkin avatar vadimperkin commented on August 23, 2024 5

Does someone found the solution?
Nothing helps: type:module, renaming to cjs or mjs, adding babel and adding to wdio,conf.js require: [babel/register]. Always the same problem with "import" statement, but when I hover on "import" I can see a pop-up hint, so it means Node can read some imported file/function, but not able to run. In the whole internet so far I don't find any answer. Please, if you somehow resolve this issue, reply to this!
Thanks in advance.

from appium-boilerplate.

Ricardinh0 avatar Ricardinh0 commented on August 23, 2024 2

Having a babel.config.js setup helped me get over this. See WebdriverIO for details.

from appium-boilerplate.

wswebcreation avatar wswebcreation commented on August 23, 2024

Hi @ggiunta

Yes, this is a ES6 support thing, when are you having this? With the current project, or when you do some modifications? The project should work out if the box because it uses Babel to solve this.

from appium-boilerplate.

ggiunta avatar ggiunta commented on August 23, 2024

I just cloned the repo, followed instructions and run the tests with the Android cmd. Did not change a thing

from appium-boilerplate.

wswebcreation avatar wswebcreation commented on August 23, 2024

@ggiunta

Sorry for my late response, the diff might be in the supported NodeJS env, I need to dig into it, haven't got the time today. It works with Node 10 and 12 on my machine so for as far I can see it not an issue with the boilerplate itself but more an environmental issue. Can you also test it with an older version of Node?

I'll get back to you with my results when I have some more time

from appium-boilerplate.

erwinheitzman avatar erwinheitzman commented on August 23, 2024

If the import isn't recognized it will complain about the syntax, in this specific case however it looks like an import is used on a file for which it cannot find any modules to import @wswebcreation

from appium-boilerplate.

wswebcreation avatar wswebcreation commented on August 23, 2024

@ggiunta

I've been running this with Node v13.8.0 and with v10.18.1 and I get this result

➜  appium-boilerplate git:(master) npm run android.app -- --spec=/tests/specs/app.forms.spec.js

> [email protected] android.app /Users/wimselles/Sauce/Git/appium-boilerplate
> wdio ./config/wdio.android.app.conf.js "--spec=/tests/specs/app.forms.spec.js"


Execution of 1 spec files started at 2020-02-09T07:21:42.737Z

[0-0] RUNNING in Android - /tests/specs/app.forms.spec.js
[0-0] PASSED in Android - /tests/specs/app.forms.spec.js

 "spec" Reporter:
------------------------------------------------------------------
[emulator-5554 LINUX 8.1.0 #0-0] Spec: /Users/wimselles/Sauce/Git/appium-boilerplate/tests/specs/app.forms.spec.js
[emulator-5554 LINUX 8.1.0 #0-0] Running: emulator-5554 on LINUX 8.1.0 executing /Users/wimselles/Sauce/Git/appium-boilerplate/apps/Android-NativeDemoApp-0.2.1.apk
[emulator-5554 LINUX 8.1.0 #0-0] Session ID: 266d8280-cc89-41af-aff4-85f8bd0fc41e
[emulator-5554 LINUX 8.1.0 #0-0]
[emulator-5554 LINUX 8.1.0 #0-0] WebdriverIO and Appium, interacting with form elements,
[emulator-5554 LINUX 8.1.0 #0-0]    ✓ should be able type in the input and validate the text
[emulator-5554 LINUX 8.1.0 #0-0]    ✓ should be able turn on and off the switch
[emulator-5554 LINUX 8.1.0 #0-0]    ✓ should be able select a value from the select element
[emulator-5554 LINUX 8.1.0 #0-0]    ✓ should be able to open the alert and close it with all 3 buttons
[emulator-5554 LINUX 8.1.0 #0-0]    ✓ should be able to determine that the inactive button is inactive
[emulator-5554 LINUX 8.1.0 #0-0]
[emulator-5554 LINUX 8.1.0 #0-0] 5 passing (17.4s)


Spec Files:      1 passed, 1 total (100% completed) in 00:00:24 

To be honest, I don't know where this error is coming from, what happens if you run this with logLevel=debug, can you post the logs here?
Secondly you mention that you didn't change the cloned project but by default it takes Android 8.1, are you sure you didn't make any changes?

from appium-boilerplate.

wswebcreation avatar wswebcreation commented on August 23, 2024

Closing due to inactivity

from appium-boilerplate.

peterpham avatar peterpham commented on August 23, 2024

I got the same error running on Node v13.12.0

cd ./examples/pageobject
npm test

throw error

Execution of 1 spec files started at 2020-04-13T23:54:42.128Z

[0-0] RUNNING in chrome - /specs/dynamic.spec.js
[0-0]  Error:  Cannot use import statement outside a module
[0-0] FAILED in chrome - /specs/dynamic.spec.js

Spec Files:	 0 passed, 1 failed, 1 total (100% completed) in 00:00:03 

npm ERR! Test failed.  See above for more details.

from appium-boilerplate.

wswebcreation avatar wswebcreation commented on August 23, 2024

@peterpham

Can you create a new issue and provide an example, as mentioned, I can't reproduce it, this might even be a coding issue in your own framework

from appium-boilerplate.

peterpham avatar peterpham commented on August 23, 2024

Thanks. I added as new issue #72

from appium-boilerplate.

mittalri avatar mittalri commented on August 23, 2024

I am getting error while trying to start Appium in java code.
AppiumDriverLocalService service;
AppiumServiceBuilder builder = new AppiumServiceBuilder();
builder.withIPAddress("127.0.0.1");
builder.usingPort(Integer.parseInt("4723"));
builder.withAppiumJS(new File("C:\Users\Ritesh Mittal\AppData\Roaming\npm\node_modules\appium\lib\appium.js"));

	service = AppiumDriverLocalService.buildService(builder);
	service.start();
	System.out.println("Appium Service Started ");

Error
C:\Users\Ritesh Mittal\AppData\Roaming\npm\node_modules\appium\lib\appium.js:1
import _ from 'lodash';
^^^^^^

SyntaxError: Cannot use import statement outside a module

from appium-boilerplate.

YungTosti avatar YungTosti commented on August 23, 2024

Having the same issue...

from appium-boilerplate.

mph6083 avatar mph6083 commented on August 23, 2024

having the same issue

from appium-boilerplate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.