@applitools/testgenai-cypress
v0.8.4
Published
Applitools TestGenAI enables both technical and non-technical team members to expand test coverage effectively. This inclusivity allows non-technical participants to engage in test automation, helping to distribute the workload more efficiently across the
Downloads
78
Maintainers
Readme
Applitools TestGenAI Plugin for Cypress
Applitools TestGenAI enables both technical and non-technical team members to expand test coverage effectively. This inclusivity allows non-technical participants to engage in test automation, helping to distribute the workload more efficiently across the team.
Advantages of TestGenAI:
- Time-savings: It swiftly records user actions, generating test cases without the need to write manual code for each step.
- Self-Healing and Robust Tests: The tool automates mundane tasks like filling in forms and provides amenities that improve the overall quality of the generated test code, making tests more robust and easier to maintain over time.
- Modern Test Coverage: Quickly create modern test coverage in code using Cypress, which includes industry best practices and allows easy migration from existing test implementations, such as Selenium, to Cypress.
- Facilitates non-developers involvement in test automation, effectively distributing the test creation workload.
- Automatic reusable variable generation.
- Page Object Model generation to make code more efficient and tests more readable.
If you have any questions, please visit our documentation or contact us at [email protected]
Installation
You can install the TestGenAI plugin using the following command:
npm install @applitools/testgenai-cypress
Configuration
Automatic Configuration
You can automatically configure the TestGenAI plugin by running the following command:
npx @applitools/testgenai-cypress init
Manual Configuration
If you encountered an error with the automatic configuration or prefer to configure the plugin manually, you can follow the steps below:
- Add following import to your
cypress/support/e2e.js
file
import '@applitools/testgenai-cypress/commands'
- Add following import to your
cypress.config.js
file
const { testGenAICypressTasksSetup } = require("@applitools/testgenai-cypress/tasks");
- Call the
testGenAICypressTasksSetup
function in thee2e
setupNodeEvents configuration in yourcypress.config.js
file
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
testGenAICypressTasksSetup(on)
},
},
});
- Configure the plugin in your
cypress.config.js
file withenv.applitoolsTestGenAI
object
module.exports = defineConfig({
env: {
applitoolsTestGenAI: {
autohealDataFolders: ['cypress/testgenai/autoheal']
}
},
});
- Add a folder named
testgenai
inside the cypress directory with two folders inside of it namedautoheal
andPOMs
. The final output should be./cypress/testgenai/autoheal
and./cypress/testgenai/POMs
.
Configuration
You can configure the TestGenAI plugin through the env.applitoolsTestGenAI
object in your cypress.config.js
file.
Example
module.exports = defineConfig({
env: {
applitoolsTestGenAI: {
autohealDataFolders: ['cypress/testgenai/autoheal'],
waitForNetworkCalls: {
isEnabled: false
},
allowObscuredElements: false
}
},
});
Configuration Options
| Property | Default | Description |
|-------------------------------------------------|-------------|--------------------------------------------------------------------------------------------------|
| isEnabled
| true | Disable/enable the Preflight Cypress plugin. |
| waitForNetworkCalls.isEnabled
| true | Wait for network calls to finish before continuing test. |
| waitForNetworkCalls.idle
| 2000 (ms) | Wait for network calls to be idle before continuing test. |
| waitForNetworkCalls.timeout
| 60000 (ms) | Maximum wait time for network calls to finish before continuing test. |
| autohealDataFolders
| [] | A list of directory paths to the autoheal folder. |
| selectorGeneratorOptions.excludedAttributeTypes
| [] | This is a list of selector attributes you wish to exclude in self-healing. |
| selectorGeneratorOptions.excludedAttributeValueKeywords
| [] | A list of selector attributes containing keywords you wish to exclude in self-healing. |
| selectorGeneratorOptions.includedAttributeTypes
| [] | A list of selector attributes you prefer to include in self-healing. |
| generateFixedTests
| true | Generate auto-healed tests. |
| getElementTimeout
| 60000 (ms) | Maximum time to wait for an element to appear. |
| ifExistsTimeout
| 3000 (ms) | Maximum time to wait for an element to exist. |
| allowObscuredElements
| true | Allow obscured elements. |
| waitToDisappear.searchElementTimeout
| 10000 (ms) | Maximum time to wait for an element to appear before waiting for it to disappear. |
| waitToDisappear.timeout
| 90000 (ms) | Maximum time to wait for an element to disappear. |
| debug.fileLogEnabled
| false | Enable debug logging and generate a log file in the debug folder. |
| debug.recordTestRun
| false | Enable debug recording of test execution and generates a zip file in the debug folder. |