# CodeceptJS

Last updated on : 21 Jan 2025

## Overview

This guide helps you set up and run automated tests using CodeceptJS with Pcloudy on real devices and browsers (including Playwright and Selenium support). Whether you're testing native, hybrid, or web apps, this sample project provides a ready-to-use framework.

## Project Repository

[GitHub - CodeceptJS Sample Project](https://github.com/pankyopkey/pCloudy-sample-projects/tree/master/CodeceptJS)

## Prerequisites

* Ensure Node.js version 16+ is installed.
* User should be registered on the Pcloudy platform.

## Installation

1. Clone or download the project.
2. Open a terminal in the root directory of the project.
3. Run the following command to install dependencies:

```bash title="Terminal"
npm install
```

4. Update the configuration as needed in: `config/pcloudy.config.js`

## Configuration Options

### 1. For Device Native/Hybrid App

Update the necessary capabilities in the `pcloudy.config.js` file under the capabilities section for your native or hybrid app.

![ConceptjswithDevice](https://www.pcloudy.com/docs/img/conceptjs/codeceptjs-native-app-capabilities-pcloudy.png)

### 2. For Device Browser (iOS/Android)

Set the appropriate configuration for mobile browser testing (Chrome for Android, Safari for iOS).

![ConceptjswithDevice](https://www.pcloudy.com/docs/img/conceptjs/codeceptjs-browser-testing-pcloudy-ios-android.png)

### 3. For Playwright

Ensure browser context and platform details are correctly configured in the Playwright section of the config file.

![ConceptjswithDevice](https://www.pcloudy.com/docs/img/conceptjs/codeceptjs-playwright-configuration-pcloudy.png)

### 4. For Selenium Browser

Add Selenium WebDriver details and browser settings as required.

![ConceptjswithDevice](https://www.pcloudy.com/docs/img/conceptjs/codeceptjs-selenium-browser-setup-pcloudy.png)

## Running the Tests

### 1. For Real Devices (Native/Hybrid/Browser)

* iOS:

```bash title="Terminal"
npm run ios
```

* Android:

```bash title="Terminal"
npm run android
```

### 2. For Playwright / Selenium

```bash title="Terminal"
npm run test
```
