Gitlab CI
  • 11 Nov 2024
  • 2 Minutes to read
  • Dark
    Light

Gitlab CI

  • Dark
    Light

Article summary

Overview

GitLab provides a platform to host codebase, collaborate on code, and manage issues. It also includes built-in GitLab CI/CD for continuous building, testing, and deploying of applications. We can create projects in GitLab that can be set as public, internal, or private, as per our requirement. There is no limit on the number of private projects we can create in GitLab

Integrating pCloudy with GitLab Pipelines allows you to conduct testing of web and native applications on 5000 device-browser combinations through an Appium server located on pCloudy cloud servers. To achieve this, you only need to establish a connection between your pCloudy account and GitLab Pipelines, which enables you to initiate tests on pCloudy from GitLab Pipelines.

Prerequisites

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

Global Dependencies

  • A GitLab 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
    

Steps to Integrate pCloudy With GitLab

  1. Sign up for a GitLab account.
  2. Upload the Mocha-Test-code to your repository in GitLab.
  3. Create a new .gitlab-ci.yml file in the root directory of your repository to set up a build for your project.
  4. Add the script to run the build for the Mocha-Test-code.
image: node:20

pCloudy:
  script:
    # Install dependencies
    - npm install
    # Run tests on Android
    - npm run android
  1. With every commit, GitLab will execute the build (#.gitlab-ci.yml), while simultaneously running the test on pCloudy My Active Sessions.

Note that these steps are essential for setting up the integration between pCloudy and GitLab Pipeline. By following these steps, you can leverage the benefits of pCloudy's cloud-based testing infrastructure and run your Mocha-Test-code on multiple device-browser combinations. This can help you identify issues early in the development process and improve the overall quality of your code.

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

To enable parallel testing, you need to upload the parallel-Test-code to your GitLab repository. 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