Test Project Initialization

This article provides instructions on how to run Cypress tests on a specific project for a specific client's partition. It covers steps for setting up the project URL, configuring local credentials, creating a workspace for tests, and managing test data.

Setting up a Cypress project within Pricefx typically involve the following steps:

  • Connect to Pricefx Studio: Start by connecting your development environment to a Pricefx partition. This is essential for accessing Pricefx-specific functionalities and configurations.

  • Configure Development Environment: Open your project in an Integrated Development Environment (IDE) like IntelliJ IDEA. Here, you might need to configure the project to connect with Pricefx services and APIs.

  • Add Framework Support: For projects that use Maven, you would add framework support for Maven in your IDE. This might involve configuring Maven profiles and plugins specific to Pricefx.

  • Fetch Logic from Server: If you're incorporating TDD4C (Test-Driven Development for Configuration) logic, use Pricefx Studio or packaging tools to fetch logic from the server, which could be necessary for testing within the Pricefx environment.

  • Version Control Setup: If your project is under version control with Git, you would set up the project by cloning from the repository and ensuring all necessary configuration files are present, such as config.json for connection details and pom.xml for Maven dependencies.

  • Cypress Installation: Install Cypress as a dev dependency in your project using npm or yarn, ensuring it's added to your package.json file.

  • Cypress Configuration: Configure Cypress by setting up the cypress.json file with any necessary settings, such as base URLs, timeouts, or environment variables that are specific to the Pricefx environment.

  • Writing Tests: Write Cypress tests in .spec.js files within the "integration" folder of your Cypress setup. These tests should interact with the Pricefx application as they would with any web application.

  • Running Tests: Run your Cypress tests using the Cypress Test Runner to ensure that your Pricefx configurations and interactions work as expected.

LEARN MORE: To learn more about project setup, then use these links:

Set Project URL

  • change URL for your project in cypress.config.js

cypress.config.js
  • baseUrl

    • URL for a react version of the price fx application with “modules“ at the end

    • example for a demo partition: baseUrl: 'https://demo-eu.demo1.pricefx.com/app/modules/',

  • apiUrl

    • URL for api commands

    • example for a demo partiton: apiUrl: 'https://demo-eu.demo1.pricefx.com/pricefx/',

  • emberBaseUrl

    • URL for ember version

    • example for a demo partition: emberBaseUrl: 'https://demo-eu.demo1.pricefx.com/app/',

 

 

Setup local credentials

  • needed for using cypress and login to specific partition

  • update file \cypress\fixtures\testUsersUtils.js

  • change placeholders for your real credentials

    • example:

      • username: testUser

      • partition: michelin-dev

      • password: askjdkj29292?

testUsersUtils.js
  • do not deploy real credentials to the git (there are masked variables linked to placeholders)

  • placeholders refer to the file gitlab-ci.yml and real values are stored in Git lab settings (CI/CD Settings)

 

Create workspace for your tests

  • start on your local computer (starting point is already cloned repository e2e-automation)

  • work according projects rules

  • after approval from solution architect or project manager

    • you can create a new branch in project repository

    • schedule automation pipeline for cypress tests according defined rules (every night, week, release, merge…..)

Data management

  • the most harder part of test automation

  • make sure no one will change data for the test run

  • prepare data before the test run

  • clean data after the test run as much as possible