realm / aws-devicefarm

Github action for triggering runs on AWS devicefarm
MIT License
17 stars 10 forks source link

It throws an error "Value '' at 'appArn' failed to satisfy constraint" #8

Open espekkaya opened 1 year ago

espekkaya commented 1 year ago

The following code throws an error as Error: ValidationException: 2 validation errors detected: Value '' at 'appArn' failed to satisfy constraint: Member must satisfy regular expression pattern: ^arn:.+; Value '' at 'appArn' failed to satisfy constraint: Member must have length greater than or equal to 32

But when I add app_arn: ${{ secrets.AWS_PROJECT_ARN }}, the error is gone.

I look out the code, and this param is not required.

      - name: Schedule test run with mixed data
        uses: realm/aws-devicefarm/test-application@master
        id: schedule-run
        with:
          name: schedule-run
          project_arn: ${{ secrets.AWS_PROJECT_ARN }}
          app_arn: ${{ secrets.AWS_PROJECT_ARN }}
          device_pool_arn: ${{ secrets.AWS_DEVICE_POOL_ARN }}
          test_type: APPIUM_WEB_NODE
          test_package_file: ch-e2e-tests.zip
          test_package_type: APPIUM_WEB_NODE_TEST_PACKAGE
          test_spec_file: ./conf/aws/android-web.yml
          test_spec_type: APPIUM_WEB_NODE_TEST_SPEC
          file_artifacts: |
            Test spec file.yml
            Customer Artifacts.zip
          remote_src: true
bwachter commented 1 year ago

Parameter validation there isn't implemented yet, see the comment at https://github.com/realm/aws-devicefarm/blob/master/test-application/index.js#L46

In the code you posted you've dropped the app_file parameter pointing to an Android package - you either need to provide the path to an apk file, or upload the apk file and provide the ARN of that upload. I'd expect specifying the project ARN as you did there will throw an error later on in the test run.

So far we're mostly ignoring the appium stuff - our Android app has tests embedded. Your example looks like you are actually running appium tests. If you have something working there please provide stripped down test data so I can add proper support for it.

espekkaya commented 1 year ago

Hi @bwachter , I tested test cases on the device browser (such as chrome) at the device farm, so I haven't added any apk or IPA files which is why I'm getting error.

Here is my capabilities on webdriverio:

config.capabilities = [
    {
        // The defaults you need to have in your config
        platformName: 'Android',
        browserName: 'chrome',
        maxInstances: 1,
        // For W3C the appium capabilities need to have an extension prefix
        // http://appium.io/docs/en/writing-running-appium/caps/
        // This is `appium:` for all Appium Capabilities which can be found here
        'appium:deviceName': process.env.DEVICEFARM_DEVICE_NAME,
        'appium:platformVersion': process.env.DEVICEFARM_DEVICE_OS_VERSION,
        'appium:chromedriverExecutable': process.env.DEVICEFARM_CHROMEDRIVER_EXECUTABLE,
        'appium:orientation': 'PORTRAIT',
        'appium:automationName': 'UiAutomator2',
        'appium:newCommandTimeout': 240,
        'goog:chromeOptions': {
            // @ts-ignore
            w3c: false,
        },
    },
];
bwachter commented 1 year ago

Can you fork this repository, and try a few things?

I believe if you remove appArn from https://github.com/realm/aws-devicefarm/blob/master/lib/schedule-run.js#L128 it should work without specifying that parameter - assuming AWS lets you do a run without any application, which I'm not sure about.