Skip to main content

Generating the POM File

After adding or removing the desired POM elements, you can download the POM class file containing these elements.

To Generate the POM File

  1. Assign a meaningful name to the POM class.

  2. Click Create POM.

  3. Select one of the following options:

    • Copy POM

      Copies the POM class code to your clipboard.

    • Copy Autoheal Data

      Copies the autoheal JSON data to your clipboard.

    • Download All

      Downloads a zip file containing the POM class and Autohealing code.

Copying the Code to your Cypress Framework

Once you have generated the code, you need to copy it to your Cypress framework.

  1. Unzip the generated code downloaded to your Download folder.
  2. Copy and paste the file yourPOMClassNamePOM.cy.js into a folder in your framework, for example, ./cypress/testgenai/POMs.
  3. Copy and paste the file <testDataId>-PreflightCyPOM_AutohealData.json into your ./cypress/autoheal folder.

You can manually create a test in your ./cypress/e2e folder or whichever folder contains your tests using this generated POM class. Below is a code snippet using a generated POM class file.

import YourWebAppLoginPOM from '../POMs/YourWebAppLoginPOM';

describe('Simple login test', () => {
it('Performs login using POM', () => {
cy.viewport(1440, 900);
let loginPage = new YourWebAppLoginPOM();
loginPage.visit();
loginPage.typePassword('test');
loginPage.typeEmailAddress('test@test.com');
loginPage.clickSignIn();
loginPage
.getErrorMessage()
.should('contain.text', 'Invalid email or password');
loginPage.clickForgotYourPassword();
cy.autoheal();
});
});