Circle CI
  • 11 Oct 2023
  • 2 Minutes to read
  • Dark
    Light

Circle CI

  • Dark
    Light

Article Summary

CircleCI Integration With pCloudy

CircleCI enables you to carry out automated testing on your code before merging any changes. You can incorporate various testing tools and frameworks like Mocha, Jest, pytest, XCTest, JUnit, Selenium, and more. In the event of failed tests, CircleCI provides access to test output data for debugging purposes. By storing your test data within CircleCI, you can leverage Test Insights and parallelism capabilities to identify ways to optimize your pipelines further.

pCloudy has integrated CircleCI so that every commit is automatically passed through the automated pipeline before it is pushed to the relevant feature branch. With pCloudy, you can carry out automated testing of your Native and Web applications, ensuring that your development code functions seamlessly across a comprehensive online Appium grid comprising over 5000+ device-browser combinations that operate on the cloud.

Prerequisites

In order to conduct Mocha tests using pCloudy, you must have the following prerequisites in place:

Global Dependencies

  • A Git or GitHub repository
    You must first download and install node.js and node package manager or npm. For installation of node.js using homebrew, execute the given command in your terminal:
$ brew install node 

In case you already have npm installed, it is advisable to update it to the most recent version. You can do this by running the following command in your terminal:

$ npm install npm@latest -g

Integrating pCloudy With CircleCI

To incorporate pCloudy with CircleCI, you must include the configuration file within the .circleci/config.yml directory in your feature branch on GitHub, and specify all the required configurations to conduct the tests. With every commit, CircleCI will execute the build (#config.yml), while simultaneously running the test on pCloudy My Active Sessions.
It is essential to set up your repository with CircleCI to enable the running of build steps.

Below is the sample config file for Integration with Mocha-sample-test :

.circleci/config.yml this directory should be added in the root directory of the branch
And below is the content for config.yml to run the build for test

version: 2  # Specifies the version of CircleCI being used.

jobs:
  build:
    name: pCloudy  # Specifies the name of the job as "pCloudy".
    docker:
      - image: cimg/node:20.0.0  # Defines a Docker image (cimg/node:20.0.0) for the job to run within.
    steps:
      - checkout  # Check out the source code.
      - run: npm install  # Installs dependencies using npm.
      - run: npm run android  # Executes the "npm run android" command.

The given code shows the desired capabilities needed to execute the Sample-test.

capabilities = {
        "browserName": "",
        "pCloudy_Username": "Enter-Email",
        "pCloudy_ApiKey": "Enter API-Key",
        "pCloudy_ApplicationName": "pCloudyAppiumDemo.apk",
        "pCloudy_DurationInMinutes": "10",
        "pCloudy_DeviceFullName": "GOOGLE_Pixel2XL_Android_11.0.0_d22ac",
        "platformName": "Android",
        "automationName": "uiautomator2",
        "newCommandTimeout": "600",
        "launchTimeout": "90000",
        "appPackage": "com.pcloudy.appiumdemo",
        "appActivity": "com.ba.mobile.LaunchActivity",
        "pCloudy_EnableVideo" : "true", # optional
    };

The "pCloudy_Username" and "pCloudy_ApiKey" fields can be customized as per the user's credentials.

Parallel Test

Use the parallel-Test-code to run the parallel test build . Once you have done this, you will need to specify the desired capabilities required to execute the Sample-test. .

commonCapabilities: {
              browserName: "",
              pCloudy_Username:"Enter-Email",
              pCloudy_ApiKey: "Enter API KEY",
              pCloudy_ApplicationName: "pCloudyAppiumDemo.apk",
              pCloudy_DurationInMinutes: "10",
              platformName: "Android",
              automationName: "uiautomator2",
              newCommandTimeout: "600",
              launchTimeout : "90000",
              appPackage: "com.pcloudy.appiumdemo",
              appActivity: "com.ba.mobile.LaunchActivity",
              pCloudy_EnableVideo : "true",
        },
        multiCapabilities: [
          {
              "pCloudy_DeviceFullName": "GOOGLE_Pixel7Pro_Android_13.0.0_dbf82",
          },
          {
              "pCloudy_DeviceFullName": "MOTOROLA_Edge30Ultra_Android_12.0.0_15b11",
          }

The commonCapabilities field contains properties such as browserName, pCloudy_Username, and pCloudy_ApiKey, which need to be customized as per your credentials. In the multiCapabilities field, you can add as many devices as you require by specifying the pCloudy_DeviceFullName property for each device. This will enable you to execute the Sample-test on multiple device-browser combinations in parallel, leveraging the benefits of pCloudy's cloud-based testing infrastructure.


Was this article helpful?

What's Next