testeiya 0.2.0 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +37 -175
- package/dist/prompt/context.js +79 -0
- package/dist/prompt/context.js.map +1 -0
- package/dist/prompt/index.js +56 -0
- package/dist/prompt/index.js.map +1 -0
- package/dist/prompt/print.js +22 -0
- package/dist/prompt/print.js.map +1 -0
- package/dist/prompt/project-info.js +2 -0
- package/dist/prompt/project-info.js.map +1 -0
- package/{src/prompt/system-prompt.ts → dist/prompt/system-prompt.js} +24 -21
- package/dist/prompt/system-prompt.js.map +1 -0
- package/dist/prompt/testomatio.js +264 -0
- package/dist/prompt/testomatio.js.map +1 -0
- package/dist/prompt/tools.js +49 -0
- package/dist/prompt/tools.js.map +1 -0
- package/dist/prompt/vocab.js +8 -0
- package/dist/prompt/vocab.js.map +1 -0
- package/dist/src/args.js +72 -0
- package/dist/src/args.js.map +1 -0
- package/dist/src/cli.js +61 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/env.js +69 -0
- package/dist/src/env.js.map +1 -0
- package/dist/src/mcp-extension.js +9 -0
- package/dist/src/mcp-extension.js.map +1 -0
- package/dist/src/mcp.js +139 -0
- package/dist/src/mcp.js.map +1 -0
- package/dist/src/model.js +66 -0
- package/dist/src/model.js.map +1 -0
- package/dist/src/result.js +41 -0
- package/dist/src/result.js.map +1 -0
- package/dist/src/run.js +199 -0
- package/dist/src/run.js.map +1 -0
- package/dist/src/session.js +77 -0
- package/dist/src/session.js.map +1 -0
- package/dist/vendor/mcp.js +14801 -0
- package/mcp-tools.json +2967 -0
- package/package.json +29 -41
- package/prompt/context.ts +101 -0
- package/prompt/index.ts +93 -0
- package/prompt/print.ts +23 -0
- package/prompt/project-info.ts +30 -0
- package/prompt/system-prompt.ts +173 -0
- package/{src/prompt → prompt}/testomatio.ts +119 -8
- package/{src/prompt → prompt}/tools.ts +30 -8
- package/prompt/vocab.ts +7 -0
- package/{skills.lock.json → skills/skills.lock.json} +11 -7
- package/skills/skills.yaml +34 -0
- package/models.catalog.json +0 -6963
- package/skills/codeceptjs/ci-fix-tests/SKILL.md +0 -120
- package/skills/codeceptjs/codeceptjs-auth/SKILL.md +0 -158
- package/skills/codeceptjs/codeceptjs-exploration/SKILL.md +0 -91
- package/skills/codeceptjs/codeceptjs-fundamentals/SKILL.md +0 -158
- package/skills/codeceptjs/codeceptjs-run-analysis/SKILL.md +0 -90
- package/skills/codeceptjs/debugging-codeceptjs-tests/SKILL.md +0 -234
- package/skills/codeceptjs/migrate-codeceptjs-4/SKILL.md +0 -110
- package/skills/codeceptjs/migrate-cypress-to-codeceptjs/SKILL.md +0 -306
- package/skills/codeceptjs/migrate-protractor-to-codeceptjs/SKILL.md +0 -352
- package/skills/codeceptjs/migrate-selenium-java-to-codeceptjs/SKILL.md +0 -472
- package/skills/codeceptjs/migrate-testcafe-to-codeceptjs/SKILL.md +0 -350
- package/skills/codeceptjs/refactoring-codeceptjs-tests/SKILL.md +0 -81
- package/skills/codeceptjs/writing-codeceptjs-tests/SKILL.md +0 -206
- package/skills/playwright-best-practices-skill/LICENSE.md +0 -7
- package/skills/playwright-best-practices-skill/README.md +0 -147
- package/skills/playwright-best-practices-skill/SKILL.md +0 -303
- package/skills/playwright-best-practices-skill/advanced/authentication-flows.md +0 -360
- package/skills/playwright-best-practices-skill/advanced/authentication.md +0 -871
- package/skills/playwright-best-practices-skill/advanced/clock-mocking.md +0 -364
- package/skills/playwright-best-practices-skill/advanced/mobile-testing.md +0 -409
- package/skills/playwright-best-practices-skill/advanced/multi-context.md +0 -288
- package/skills/playwright-best-practices-skill/advanced/multi-user.md +0 -393
- package/skills/playwright-best-practices-skill/advanced/network-advanced.md +0 -452
- package/skills/playwright-best-practices-skill/advanced/third-party.md +0 -464
- package/skills/playwright-best-practices-skill/architecture/pom-vs-fixtures.md +0 -363
- package/skills/playwright-best-practices-skill/architecture/test-architecture.md +0 -369
- package/skills/playwright-best-practices-skill/architecture/when-to-mock.md +0 -383
- package/skills/playwright-best-practices-skill/browser-apis/browser-apis.md +0 -391
- package/skills/playwright-best-practices-skill/browser-apis/iframes.md +0 -403
- package/skills/playwright-best-practices-skill/browser-apis/service-workers.md +0 -504
- package/skills/playwright-best-practices-skill/browser-apis/websockets.md +0 -403
- package/skills/playwright-best-practices-skill/core/annotations.md +0 -424
- package/skills/playwright-best-practices-skill/core/assertions-waiting.md +0 -361
- package/skills/playwright-best-practices-skill/core/configuration.md +0 -452
- package/skills/playwright-best-practices-skill/core/fixtures-hooks.md +0 -417
- package/skills/playwright-best-practices-skill/core/global-setup.md +0 -434
- package/skills/playwright-best-practices-skill/core/locators.md +0 -242
- package/skills/playwright-best-practices-skill/core/page-object-model.md +0 -315
- package/skills/playwright-best-practices-skill/core/projects-dependencies.md +0 -453
- package/skills/playwright-best-practices-skill/core/test-data.md +0 -492
- package/skills/playwright-best-practices-skill/core/test-suite-structure.md +0 -361
- package/skills/playwright-best-practices-skill/core/test-tags.md +0 -298
- package/skills/playwright-best-practices-skill/debugging/console-errors.md +0 -420
- package/skills/playwright-best-practices-skill/debugging/debugging.md +0 -504
- package/skills/playwright-best-practices-skill/debugging/error-testing.md +0 -360
- package/skills/playwright-best-practices-skill/debugging/flaky-tests.md +0 -496
- package/skills/playwright-best-practices-skill/frameworks/angular.md +0 -530
- package/skills/playwright-best-practices-skill/frameworks/nextjs.md +0 -469
- package/skills/playwright-best-practices-skill/frameworks/react.md +0 -531
- package/skills/playwright-best-practices-skill/frameworks/vue.md +0 -574
- package/skills/playwright-best-practices-skill/infrastructure-ci-cd/ci-cd.md +0 -468
- package/skills/playwright-best-practices-skill/infrastructure-ci-cd/docker.md +0 -283
- package/skills/playwright-best-practices-skill/infrastructure-ci-cd/github-actions.md +0 -546
- package/skills/playwright-best-practices-skill/infrastructure-ci-cd/gitlab.md +0 -397
- package/skills/playwright-best-practices-skill/infrastructure-ci-cd/other-providers.md +0 -521
- package/skills/playwright-best-practices-skill/infrastructure-ci-cd/parallel-sharding.md +0 -371
- package/skills/playwright-best-practices-skill/infrastructure-ci-cd/performance.md +0 -453
- package/skills/playwright-best-practices-skill/infrastructure-ci-cd/reporting.md +0 -424
- package/skills/playwright-best-practices-skill/infrastructure-ci-cd/test-coverage.md +0 -497
- package/skills/playwright-best-practices-skill/testing-patterns/accessibility.md +0 -359
- package/skills/playwright-best-practices-skill/testing-patterns/api-testing.md +0 -719
- package/skills/playwright-best-practices-skill/testing-patterns/browser-extensions.md +0 -506
- package/skills/playwright-best-practices-skill/testing-patterns/canvas-webgl.md +0 -493
- package/skills/playwright-best-practices-skill/testing-patterns/component-testing.md +0 -500
- package/skills/playwright-best-practices-skill/testing-patterns/drag-drop.md +0 -576
- package/skills/playwright-best-practices-skill/testing-patterns/electron.md +0 -509
- package/skills/playwright-best-practices-skill/testing-patterns/file-operations.md +0 -377
- package/skills/playwright-best-practices-skill/testing-patterns/file-upload-download.md +0 -562
- package/skills/playwright-best-practices-skill/testing-patterns/forms-validation.md +0 -561
- package/skills/playwright-best-practices-skill/testing-patterns/graphql-testing.md +0 -331
- package/skills/playwright-best-practices-skill/testing-patterns/i18n.md +0 -508
- package/skills/playwright-best-practices-skill/testing-patterns/performance-testing.md +0 -476
- package/skills/playwright-best-practices-skill/testing-patterns/security-testing.md +0 -430
- package/skills/playwright-best-practices-skill/testing-patterns/visual-regression.md +0 -634
- package/skills/playwright-cli/SKILL.md +0 -420
- package/skills/playwright-cli/references/element-attributes.md +0 -23
- package/skills/playwright-cli/references/playwright-tests.md +0 -39
- package/skills/playwright-cli/references/request-mocking.md +0 -87
- package/skills/playwright-cli/references/running-code.md +0 -241
- package/skills/playwright-cli/references/session-management.md +0 -225
- package/skills/playwright-cli/references/storage-state.md +0 -275
- package/skills/playwright-cli/references/test-generation.md +0 -433
- package/skills/playwright-cli/references/tracing.md +0 -139
- package/skills/playwright-cli/references/video-recording.md +0 -143
- package/skills/testeiya/README.md +0 -29
- package/skills/testeiya/answer-formatting/SKILL.md +0 -30
- package/skills/testeiya/check-cucumber/SKILL.md +0 -200
- package/skills/testeiya/check-tests/SKILL.md +0 -260
- package/skills/testeiya/manual-run-assistant/SKILL.md +0 -61
- package/skills/testeiya/testomatio-docs/INDEX.md +0 -175
- package/skills/testeiya/testomatio-docs/SKILL.md +0 -102
- package/skills/testeiya/testomatio-docs/docs/advanced/ai-powered-features/ai-agents.md +0 -144
- package/skills/testeiya/testomatio-docs/docs/advanced/ai-powered-features/ai-powered-features.md +0 -531
- package/skills/testeiya/testomatio-docs/docs/advanced/ai-powered-features/ai-requirements.md +0 -437
- package/skills/testeiya/testomatio-docs/docs/advanced/api-access/index.md +0 -191
- package/skills/testeiya/testomatio-docs/docs/advanced/branches-folder/index.md +0 -277
- package/skills/testeiya/testomatio-docs/docs/advanced/bulk-edit-folder/bulk-edit-demos.mdx +0 -39
- package/skills/testeiya/testomatio-docs/docs/advanced/bulk-edit-folder/bulk-edit-on-suite-and-test-level.md +0 -122
- package/skills/testeiya/testomatio-docs/docs/advanced/bulk-edit-folder/what-is-bulk-edit.md +0 -170
- package/skills/testeiya/testomatio-docs/docs/advanced/jira-plugin/branches.md +0 -53
- package/skills/testeiya/testomatio-docs/docs/advanced/jira-plugin/index.mdx +0 -98
- package/skills/testeiya/testomatio-docs/docs/advanced/jira-plugin/jira-issue.md +0 -151
- package/skills/testeiya/testomatio-docs/docs/advanced/jira-plugin/runs-and-reports.md +0 -377
- package/skills/testeiya/testomatio-docs/docs/advanced/jira-plugin/work-in-jira.md +0 -267
- package/skills/testeiya/testomatio-docs/docs/advanced/living-doc/index.md +0 -138
- package/skills/testeiya/testomatio-docs/docs/advanced/milestones/index.md +0 -220
- package/skills/testeiya/testomatio-docs/docs/advanced/shortcuts/index.md +0 -48
- package/skills/testeiya/testomatio-docs/docs/advanced/tags-labels/labels-and-custom-fields.md +0 -201
- package/skills/testeiya/testomatio-docs/docs/advanced/tags-labels/tags-or-labels.md +0 -94
- package/skills/testeiya/testomatio-docs/docs/advanced/tags-labels/tags.md +0 -243
- package/skills/testeiya/testomatio-docs/docs/advanced/test-artifacts/index.md +0 -135
- package/skills/testeiya/testomatio-docs/docs/advanced/tql/index.md +0 -394
- package/skills/testeiya/testomatio-docs/docs/getting-started/index.md +0 -290
- package/skills/testeiya/testomatio-docs/docs/integrations/continuous-integration/azure.md +0 -96
- package/skills/testeiya/testomatio-docs/docs/integrations/continuous-integration/bamboo.md +0 -94
- package/skills/testeiya/testomatio-docs/docs/integrations/continuous-integration/bitbucket.md +0 -106
- package/skills/testeiya/testomatio-docs/docs/integrations/continuous-integration/circle.md +0 -115
- package/skills/testeiya/testomatio-docs/docs/integrations/continuous-integration/github.md +0 -120
- package/skills/testeiya/testomatio-docs/docs/integrations/continuous-integration/gitlab.md +0 -88
- package/skills/testeiya/testomatio-docs/docs/integrations/continuous-integration/index.mdx +0 -151
- package/skills/testeiya/testomatio-docs/docs/integrations/continuous-integration/jenkins.md +0 -121
- package/skills/testeiya/testomatio-docs/docs/integrations/continuous-integration/teamcity.md +0 -96
- package/skills/testeiya/testomatio-docs/docs/integrations/issues-management/azure.md +0 -31
- package/skills/testeiya/testomatio-docs/docs/integrations/issues-management/clickup.md +0 -54
- package/skills/testeiya/testomatio-docs/docs/integrations/issues-management/confluence.md +0 -34
- package/skills/testeiya/testomatio-docs/docs/integrations/issues-management/github.md +0 -31
- package/skills/testeiya/testomatio-docs/docs/integrations/issues-management/gitlab.md +0 -93
- package/skills/testeiya/testomatio-docs/docs/integrations/issues-management/index.md +0 -131
- package/skills/testeiya/testomatio-docs/docs/integrations/issues-management/jira.md +0 -164
- package/skills/testeiya/testomatio-docs/docs/integrations/issues-management/linear.md +0 -29
- package/skills/testeiya/testomatio-docs/docs/integrations/issues-management/shortcut.md +0 -67
- package/skills/testeiya/testomatio-docs/docs/integrations/issues-management/youtrack.md +0 -94
- package/skills/testeiya/testomatio-docs/docs/integrations/report-notifications/azure-devops.md +0 -53
- package/skills/testeiya/testomatio-docs/docs/integrations/report-notifications/email.md +0 -71
- package/skills/testeiya/testomatio-docs/docs/integrations/report-notifications/jira.md +0 -52
- package/skills/testeiya/testomatio-docs/docs/integrations/report-notifications/ms-teams.md +0 -60
- package/skills/testeiya/testomatio-docs/docs/integrations/report-notifications/rules.md +0 -267
- package/skills/testeiya/testomatio-docs/docs/integrations/report-notifications/slack.md +0 -82
- package/skills/testeiya/testomatio-docs/docs/integrations/report-notifications/telegram.md +0 -73
- package/skills/testeiya/testomatio-docs/docs/integrations/scim-provisioning/index.mdx +0 -207
- package/skills/testeiya/testomatio-docs/docs/integrations/scim-provisioning/okta.md +0 -204
- package/skills/testeiya/testomatio-docs/docs/integrations/single-sign-on/azure.md +0 -95
- package/skills/testeiya/testomatio-docs/docs/integrations/single-sign-on/google.md +0 -75
- package/skills/testeiya/testomatio-docs/docs/integrations/single-sign-on/index.mdx +0 -33
- package/skills/testeiya/testomatio-docs/docs/integrations/single-sign-on/okta.md +0 -108
- package/skills/testeiya/testomatio-docs/docs/integrations/single-sign-on/saml.md +0 -66
- package/skills/testeiya/testomatio-docs/docs/legal/compliance/gdpr.md +0 -95
- package/skills/testeiya/testomatio-docs/docs/legal/compliance/index.mdx +0 -94
- package/skills/testeiya/testomatio-docs/docs/legal/compliance/privacy.md +0 -26
- package/skills/testeiya/testomatio-docs/docs/legal/compliance/terms.md +0 -32
- package/skills/testeiya/testomatio-docs/docs/legal/security/index.mdx +0 -242
- package/skills/testeiya/testomatio-docs/docs/legal/security/jira.md +0 -140
- package/skills/testeiya/testomatio-docs/docs/legal/security/subprocessors.md +0 -76
- package/skills/testeiya/testomatio-docs/docs/management/company/administration.md +0 -363
- package/skills/testeiya/testomatio-docs/docs/management/company/audit-log.md +0 -41
- package/skills/testeiya/testomatio-docs/docs/management/company/plan-features-comparison.md +0 -240
- package/skills/testeiya/testomatio-docs/docs/management/company/subscriptions.md +0 -326
- package/skills/testeiya/testomatio-docs/docs/management/company/trials.md +0 -75
- package/skills/testeiya/testomatio-docs/docs/management/company/users-and-permissions/accountant.md +0 -49
- package/skills/testeiya/testomatio-docs/docs/management/company/users-and-permissions/index.mdx +0 -285
- package/skills/testeiya/testomatio-docs/docs/management/company/users-and-permissions/read-only-user.md +0 -67
- package/skills/testeiya/testomatio-docs/docs/management/company/users-and-permissions/teams.md +0 -138
- package/skills/testeiya/testomatio-docs/docs/management/project/settings.md +0 -87
- package/skills/testeiya/testomatio-docs/docs/management/project/templates.md +0 -546
- package/skills/testeiya/testomatio-docs/docs/project/analytics/index.md +0 -326
- package/skills/testeiya/testomatio-docs/docs/project/import-export/export-tests/classical-tests-markdown-format.md +0 -386
- package/skills/testeiya/testomatio-docs/docs/project/import-export/export-tests/download-manual-tests-as-files.md +0 -378
- package/skills/testeiya/testomatio-docs/docs/project/import-export/export-tests/export-to-obsidian.md +0 -112
- package/skills/testeiya/testomatio-docs/docs/project/import-export/export-tests/export-to-spreadsheet.md +0 -127
- package/skills/testeiya/testomatio-docs/docs/project/import-export/import/auto-import.md +0 -63
- package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-Allure-TestOps.md +0 -49
- package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-QTest.md +0 -41
- package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-Qase.md +0 -39
- package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-Zephyr.md +0 -37
- package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-csv-xlsx.md +0 -117
- package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-cucumber.md +0 -93
- package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-qmetry.md +0 -44
- package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-source-code.md +0 -117
- package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-testcaselabs.md +0 -44
- package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-testmo.md +0 -47
- package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-testrail.md +0 -82
- package/skills/testeiya/testomatio-docs/docs/project/import-export/import/import-tests-from-xray.md +0 -55
- package/skills/testeiya/testomatio-docs/docs/project/plans/index.md +0 -334
- package/skills/testeiya/testomatio-docs/docs/project/pulse/index.md +0 -104
- package/skills/testeiya/testomatio-docs/docs/project/runs/archive-runs-and-groups.md +0 -176
- package/skills/testeiya/testomatio-docs/docs/project/runs/custom-statuses.md +0 -195
- package/skills/testeiya/testomatio-docs/docs/project/runs/environments.md +0 -203
- package/skills/testeiya/testomatio-docs/docs/project/runs/managing-runs.md +0 -455
- package/skills/testeiya/testomatio-docs/docs/project/runs/merge-strategies.md +0 -137
- package/skills/testeiya/testomatio-docs/docs/project/runs/reports.md +0 -329
- package/skills/testeiya/testomatio-docs/docs/project/runs/rungroups.md +0 -342
- package/skills/testeiya/testomatio-docs/docs/project/runs/running-automated-tests.md +0 -256
- package/skills/testeiya/testomatio-docs/docs/project/runs/running-manual-and-automated-tests.md +0 -331
- package/skills/testeiya/testomatio-docs/docs/project/runs/running-tests-manually.md +0 -633
- package/skills/testeiya/testomatio-docs/docs/project/runs/temporary-tests-notes.md +0 -223
- package/skills/testeiya/testomatio-docs/docs/project/steps-snippets/snippets.md +0 -68
- package/skills/testeiya/testomatio-docs/docs/project/steps-snippets/steps.md +0 -181
- package/skills/testeiya/testomatio-docs/docs/project/tests/bdd-test-case-editor.md +0 -98
- package/skills/testeiya/testomatio-docs/docs/project/tests/classical-test-case-editor.md +0 -354
- package/skills/testeiya/testomatio-docs/docs/project/tests/classical-vs-bdd.md +0 -169
- package/skills/testeiya/testomatio-docs/docs/project/tests/copy-and-move-your-tests.md +0 -156
- package/skills/testeiya/testomatio-docs/docs/project/tests/other-features-for-test-case-design.md +0 -412
- package/skills/testeiya/testomatio-docs/docs/project/tests/test-case-creation-and-editing.md +0 -527
- package/skills/testeiya/testomatio-docs/docs/support/index.md +0 -75
- package/skills/testeiya/testomatio-docs/docs/test-reporting/artifacts.md +0 -388
- package/skills/testeiya/testomatio-docs/docs/test-reporting/cli.md +0 -215
- package/skills/testeiya/testomatio-docs/docs/test-reporting/configuration.md +0 -247
- package/skills/testeiya/testomatio-docs/docs/test-reporting/frameworks.md +0 -490
- package/skills/testeiya/testomatio-docs/docs/test-reporting/functions.md +0 -144
- package/skills/testeiya/testomatio-docs/docs/test-reporting/index.mdx +0 -48
- package/skills/testeiya/testomatio-docs/docs/test-reporting/junit.md +0 -248
- package/skills/testeiya/testomatio-docs/docs/test-reporting/logger.md +0 -138
- package/skills/testeiya/testomatio-docs/docs/test-reporting/php.md +0 -77
- package/skills/testeiya/testomatio-docs/docs/test-reporting/pipes/bitbucket.md +0 -72
- package/skills/testeiya/testomatio-docs/docs/test-reporting/pipes/csv.md +0 -23
- package/skills/testeiya/testomatio-docs/docs/test-reporting/pipes/debug.md +0 -18
- package/skills/testeiya/testomatio-docs/docs/test-reporting/pipes/github.md +0 -63
- package/skills/testeiya/testomatio-docs/docs/test-reporting/pipes/gitlab.md +0 -29
- package/skills/testeiya/testomatio-docs/docs/test-reporting/pipes/html.md +0 -80
- package/skills/testeiya/testomatio-docs/docs/test-reporting/pipes/index.mdx +0 -57
- package/skills/testeiya/testomatio-docs/docs/test-reporting/pipes/testomatio.md +0 -331
- package/skills/testeiya/testomatio-docs/docs/test-reporting/python.md +0 -229
- package/skills/testeiya/testomatio-docs/docs/test-reporting/workflows.md +0 -325
- package/skills/testeiya/testomatio-docs/docs/tutorials/Interacting-via-API.md +0 -159
- package/skills/testeiya/testomatio-docs/docs/tutorials/Manual-Testing-Classic.md +0 -164
- package/skills/testeiya/testomatio-docs/docs/tutorials/Set-Up-Read-Only-Access.md +0 -85
- package/skills/testeiya/testomatio-docs/docs/tutorials/Using-AI-in-Testing.md +0 -163
- package/skills/testeiya/testomatio-docs/docs/tutorials/Working-with-Jira.md +0 -125
- package/skills/testeiya/testomatio-docs/docs/tutorials/java.md +0 -478
- package/skills/testeiya/testomatio-docs/docs/tutorials/playwright.md +0 -207
- package/skills/testeiya/testomatio-docs/docs/tutorials/webdriver.md +0 -218
- package/skills/testeiya/testomatio-docs/docs.lock.json +0 -6
- package/skills/testeiya/testomatio-reporter/SKILL.md +0 -307
- package/skills/testomatio/explorbot/explorbot-fundamentals/SKILL.md +0 -88
- package/skills/testomatio/explorbot/explorbot-plan/SKILL.md +0 -95
- package/skills/testomatio/explorbot/explorbot-setup/SKILL.md +0 -334
- package/skills/testomatio/test-automation/automate-manual-test-cases/CLAUDE.md +0 -56
- package/skills/testomatio/test-automation/automate-manual-test-cases/SKILL.md +0 -242
- package/skills/testomatio/test-automation/automate-manual-test-cases/references/CODECEPTJS_BEST_PRACTICES.md +0 -182
- package/skills/testomatio/test-automation/automate-manual-test-cases/references/FINAL_SUMMARY_TEMPLATE.md +0 -22
- package/skills/testomatio/test-automation/automate-manual-test-cases/references/PLAYWRIGHT_BEST_PRACTICES.md +0 -90
- package/skills/testomatio/test-automation/automate-manual-test-cases/references/POM_BEST_PRACTICES.md +0 -53
- package/skills/testomatio/test-automation/automate-manual-test-cases/references/TEST_DATA_MANAGEMENT.md +0 -52
- package/skills/testomatio/test-automation/debug-fix-failed-flaky-autotests/SKILL.md +0 -107
- package/skills/testomatio/test-automation/debug-fix-failed-flaky-autotests/references/DEBUGGING_QUICK_REFERENCE.md +0 -113
- package/skills/testomatio/test-automation/qa-automation-test-consolidation/SKILL.md +0 -29
- package/skills/testomatio/test-automation/run-tests-with-testomatio-reporter/SKILL.md +0 -151
- package/skills/testomatio/test-automation/setup-pr-testing/SKILL.md +0 -199
- package/skills/testomatio/test-automation/testomat-allure-adapter/SKILL.md +0 -289
- package/skills/testomatio/test-management/detect-duplicate-test-cases/SKILL.md +0 -86
- package/skills/testomatio/test-management/detect-duplicate-test-cases/references/DUPLICATE_INSTRUCTIONS.md +0 -54
- package/skills/testomatio/test-management/improve-test-cases/SKILL.md +0 -114
- package/skills/testomatio/test-management/improve-test-cases/references/TESTOMAT_MARKDOWN_EXAMPLE.md +0 -66
- package/skills/testomatio/test-management/pull-request-diff-analyzer/SKILL.md +0 -141
- package/skills/testomatio/test-management/qa-e2e-tests-reporting/SKILL.md +0 -354
- package/skills/testomatio/test-management/qa-e2e-tests-reporting/references/TESTOMATIO_ARTIFACTS.md +0 -82
- package/skills/testomatio/test-management/qa-e2e-tests-reporting/references/TESTOMATIO_HTML_REPORT.md +0 -37
- package/skills/testomatio/test-management/qa-e2e-tests-reporting/references/TESTOMATIO_REPORTERS_CONFIG.md +0 -118
- package/skills/testomatio/test-management/qa-pr-requirements-analyzer/SKILL.md +0 -149
- package/skills/testomatio/test-management/qa-pr-requirements-analyzer/references/summary-example.md +0 -54
- package/skills/testomatio/test-management/qa-requirement-reviewer/SKILL.md +0 -126
- package/skills/testomatio/test-management/qa-requirement-reviewer/references/requirements_reviewer_examples.md +0 -128
- package/skills/testomatio/test-management/qa-test-code-coverage/SKILL.md +0 -174
- package/skills/testomatio/test-management/qa-test-code-coverage/references/COVERAGE_FILE_FORMAT.md +0 -138
- package/skills/testomatio/test-management/qa-test-code-coverage/references/E2E_FRAMEWORKS.md +0 -65
- package/skills/testomatio/test-management/qa-test-code-coverage/scripts/check-coverage.mjs +0 -40
- package/skills/testomatio/test-management/qa-thinking/SKILL.md +0 -36
- package/skills/testomatio/test-management/qa-write-test-cases/SKILL.md +0 -267
- package/skills/testomatio/test-management/qa-write-test-cases/references/test-case-format.md +0 -387
- package/skills/testomatio/test-management/qa-write-test-cases/references/testomat-tms-guide.md +0 -72
- package/skills/testomatio/test-management/qa-write-test-cases/references/writing-rule.md +0 -159
- package/skills/testomatio/test-management/scan-automation-project/SKILL.md +0 -152
- package/skills/testomatio/test-management/sync-test-cases-with-tms/SKILL.md +0 -107
- package/skills/testomatio/test-management/sync-test-cases-with-tms/references/TESTOMATIO_CLI.md +0 -140
- package/skills/testomatio/test-management/testomatio-mcp/SKILL.md +0 -182
- package/skills/testomatio/test-management/testomatio-mcp/references/MCP_SETUP.md +0 -169
- package/skills.yaml +0 -21
- package/src/ai-debug.ts +0 -188
- package/src/api/agent-get.ts +0 -22
- package/src/api/agent-start.ts +0 -384
- package/src/api/client-log.ts +0 -29
- package/src/api/context.ts +0 -332
- package/src/api/debug-layout.ts +0 -47
- package/src/api/debug-report.ts +0 -29
- package/src/api/debug-snapshot.ts +0 -30
- package/src/api/debug-stream.ts +0 -52
- package/src/api/files-delete.ts +0 -184
- package/src/api/files-read.ts +0 -41
- package/src/api/files-rename.ts +0 -99
- package/src/api/files-tree.ts +0 -292
- package/src/api/files-write.ts +0 -41
- package/src/api/mcp.ts +0 -603
- package/src/api/memory.ts +0 -69
- package/src/api/open-external.ts +0 -39
- package/src/api/playwright-cli.ts +0 -606
- package/src/api/providers.ts +0 -457
- package/src/api/read-env-token.ts +0 -33
- package/src/api/sessions.ts +0 -79
- package/src/api/settings.ts +0 -120
- package/src/api/skills.ts +0 -58
- package/src/api/testomatio-attachment.ts +0 -89
- package/src/api/testomatio-auth.ts +0 -284
- package/src/api/testomatio-proxy.ts +0 -197
- package/src/api/testomatio-run-stats.ts +0 -81
- package/src/api/testomatio-target.ts +0 -225
- package/src/api/testomatio-transcription.ts +0 -82
- package/src/api/workspace-search.ts +0 -96
- package/src/api/workspace-sync.ts +0 -151
- package/src/api/workspace.ts +0 -165
- package/src/app-server.ts +0 -556
- package/src/bridge.ts +0 -251
- package/src/check-tests.ts +0 -156
- package/src/cli.ts +0 -17
- package/src/commands.ts +0 -244
- package/src/config.ts +0 -183
- package/src/connection.ts +0 -658
- package/src/context-store.ts +0 -265
- package/src/debug-bus.ts +0 -405
- package/src/extensions/tool-gate.ts +0 -220
- package/src/extensions/webui/ask-channel.ts +0 -52
- package/src/extensions/webui/index.ts +0 -184
- package/src/extensions/webui/tools/ask-question.ts +0 -88
- package/src/extensions/webui/tools/query-result.ts +0 -79
- package/src/extensions/webui/tools/render-chart.ts +0 -53
- package/src/extensions/webui/tools/render-item.ts +0 -61
- package/src/extensions/webui/tools/render-list.ts +0 -170
- package/src/extensions/webui/tools/render-result.ts +0 -85
- package/src/extensions/webui/tools/render-tree.ts +0 -71
- package/src/extensions/webui/tools/ui-widget.ts +0 -54
- package/src/extensions/webui/tools/widget-result.ts +0 -13
- package/src/extensions/webui/widget-channel.ts +0 -50
- package/src/file-log.ts +0 -196
- package/src/git-tracked.ts +0 -68
- package/src/gitignore.ts +0 -53
- package/src/json-store.ts +0 -43
- package/src/load-env.ts +0 -70
- package/src/loader-style.ts +0 -96
- package/src/main.ts +0 -140
- package/src/mcp-catalog.ts +0 -96
- package/src/models-catalog.ts +0 -72
- package/src/permissions.ts +0 -120
- package/src/project-dir.ts +0 -189
- package/src/project-info.ts +0 -108
- package/src/prompt/app-ui.ts +0 -59
- package/src/prompt/browser.ts +0 -27
- package/src/prompt/index.ts +0 -62
- package/src/server-info.ts +0 -62
- package/src/session-factory.ts +0 -442
- package/src/session-store.ts +0 -115
- package/src/shell-env.ts +0 -45
- package/src/skills.ts +0 -163
- package/src/sync-snapshot.ts +0 -140
- package/src/telemetry.ts +0 -239
- package/src/testomatio-auth.ts +0 -299
- package/src/testomatio.ts +0 -98
- package/src/theme.ts +0 -30
- package/src/user-env.ts +0 -94
- package/src/welcome.ts +0 -127
- package/src/workspace/safe-path.ts +0 -85
- package/src/workspace/test-md.ts +0 -70
- package/src/workspace-model.ts +0 -440
- package/testeiya.config.json +0 -14
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: migrate-testcafe-to-codeceptjs
|
|
3
|
-
description: "Port a TestCafe test suite to CodeceptJS 4. Trigger when the project contains `.testcaferc.{json,js,ts,cjs}`, `testcafe` in `devDependencies`, test files that import from `testcafe` (`Selector`, `ClientFunction`, `Role`, `RequestMock`, `RequestHook`, `RequestLogger`, `t` from a test signature), top-level `fixture('X').page(...)` + `test('y', async t => { ... })` blocks, `Selector(...)` chains (`.withText`, `.withAttribute`, `.nth`, `.find`, `.filter`, `.parent`, `.child`, `.sibling`), `await t.click(...)` / `t.typeText(...)` patterns, `t.useRole(...)`, `t.addRequestHooks(...)`, `t.eval(...)`, `ClientFunction(...)`, TestCafe Studio recordings, or a `tests/` directory matching `*.test.{js,ts}` whose contents start with `fixture(...)`. Walks the port end-to-end: inventory shared logic (TestCafe page-object-style modules, `Role` definitions, `ClientFunction` factories, `RequestMock` factories, custom Test Controller actions, fixture hooks), install CodeceptJS with the Playwright helper alongside TestCafe, port the config, split shared helpers into `WebExtra` (browser-driven via Playwright `page` — `ClientFunction` / `t.eval` ports here as `page.evaluate`) and `ApiExtras` (HTTP via REST helper, never `browserContext.request.*`), port TestCafe page objects to CodeceptJS page objects without inventing assertion/one-liner wrappers, replace `Selector(...)` chains with semantic strings / ARIA / `locate()` / `{ css }`, **strip excess `await` from every action call** (CodeceptJS auto-queues — `await` is only for grabs), convert specs (handing off to `writing-codeceptjs-tests`), replace `Role` + `t.useRole` with the `auth` plugin, swap `RequestMock` for `I.mockRoute`, fold `t.expect(sel.X).Y(...)` chains into `I.see*` / `ExpectHelper` / `codeceptjs/assertions`, then decommission TestCafe."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Migrate TestCafe → CodeceptJS 4
|
|
7
|
-
|
|
8
|
-
TestCafe and CodeceptJS share a lot at the surface — both expose a single test-controller verb-set (`t.*` / `I.*`), both have lazy chainable selectors, both ship with role-based auth and screenshot/video support. The migration is mostly mechanical, but three foundational differences drive the work:
|
|
9
|
-
|
|
10
|
-
1. **CodeceptJS does not need `await` on actions.** The recorder auto-queues every `I.*` call. TestCafe forces `await` on every action (`await t.click(...)`); CodeceptJS forbids it on actions and reserves it for grabs (`await I.grabTextFrom(...)`). **This is the single biggest mechanical edit during spec conversion** — strip every `await` from before `I.click`, `I.fillField`, `I.see*`, `I.waitFor*`, and page-object method calls that return void.
|
|
11
|
-
2. **Helpers, not a bundled proxy.** TestCafe runs as an HTTP/HTTPS proxy that injects automation into pages; CodeceptJS dispatches `I.*` to a configured helper. **Playwright recommended** — closest feel, fastest, supports all three engines (Chromium / Firefox / WebKit) the same way TestCafe did.
|
|
12
|
-
3. **First-class abstractions.** Page objects, multi-user `session(...)`, the `auth` plugin, custom helpers, and the `customLocator` plugin are built in. TestCafe projects accumulate ad-hoc versions of these (Selector-property classes, `Role` factories, `ClientFunction` factories) — the migration consolidates them onto framework idioms.
|
|
13
|
-
|
|
14
|
-
Authoritative references: `node_modules/codeceptjs/docs/basics.md`, `locators.md`, `playwright.md`, `custom-helpers.md`, `pageobjects.md`.
|
|
15
|
-
|
|
16
|
-
## When to trigger
|
|
17
|
-
|
|
18
|
-
Any of:
|
|
19
|
-
|
|
20
|
-
- `.testcaferc.{json,js,ts,cjs}` at the repo root.
|
|
21
|
-
- `testcafe` listed in `devDependencies`.
|
|
22
|
-
- Imports from `testcafe` (`Selector`, `ClientFunction`, `Role`, `RequestMock`, `RequestHook`, `RequestLogger`).
|
|
23
|
-
- Test files with top-level `fixture('X').page(...)` + `test('y', async t => { ... })`.
|
|
24
|
-
- Code uses `Selector(...).withText(...)` / `.withAttribute(...)` / `.nth(...)` / `.find(...)` / `.filter(...)` chains, `t.useRole(...)`, `t.addRequestHooks(...)`, `t.eval(...)`, or `ClientFunction(...)`.
|
|
25
|
-
- A `tests/` directory of `*.test.{js,ts}` whose contents start with `fixture(...)`.
|
|
26
|
-
- The user says "migrate / port / convert from TestCafe".
|
|
27
|
-
|
|
28
|
-
## What does not migrate
|
|
29
|
-
|
|
30
|
-
Be honest up-front:
|
|
31
|
-
|
|
32
|
-
- **Proxy-based architecture** — TestCafe runs as a man-in-the-middle proxy and rewrites pages to inject its driver. CodeceptJS uses Playwright (CDP) or WebDriver. The trade-off: lose driverless setup, gain Playwright's speed and ergonomics. Rare TLS / CORS tricks that relied on the proxy will need rethinking.
|
|
33
|
-
- **TestCafe Studio recordings** — UI-recorded tests must be re-authored. Use the `writing-codeceptjs-tests` MCP scaffold-and-pause mode to recreate them against the live browser.
|
|
34
|
-
- **TestCafe `RequestHook` / `RequestLogger`** — replaced piecewise: hooks → `I.mockRoute()`; loggers → `page.on('request' | 'response')` inside `WebExtra` if you really need a transcript, or anchor on UI outcomes instead.
|
|
35
|
-
- **`disablePageCaching`, `quarantineMode` finer tuning** — Playwright handles caching per context; quarantine maps roughly to `retry: N` but lacks the same heuristics.
|
|
36
|
-
- **Mobile testing via `testcafe-browser-provider-*` packages** — use Playwright's mobile emulation (`devices['iPhone 13']`) or the `Appium` helper for real devices.
|
|
37
|
-
- **TestCafe Cloud / Dashboard** — replaced by `@testomatio/reporter` or another CodeceptJS-compatible reporter.
|
|
38
|
-
|
|
39
|
-
## Workflow
|
|
40
|
-
|
|
41
|
-
Run phases in order. Commit at each boundary so any regression is bisectable.
|
|
42
|
-
|
|
43
|
-
### 1. Inventory the TestCafe project
|
|
44
|
-
|
|
45
|
-
Before touching anything, build a picture. Two passes.
|
|
46
|
-
|
|
47
|
-
**Shape of the project** — grep / `wc -l` for cost predictors:
|
|
48
|
-
|
|
49
|
-
- `.testcaferc.{json,js,ts,cjs}` — which keys are in use (`browsers`, `src`, `concurrency`, `selectorTimeout`, `assertionTimeout`, `pageLoadTimeout`, `screenshots`, `videoPath`, `clientScripts`, `quarantineMode`, `stopOnFirstFail`, `reporter`)
|
|
50
|
-
- test file count + glob (TestCafe has no required suffix; commonly `*.test.{js,ts}` or anything under `tests/`)
|
|
51
|
-
- count occurrences of `Selector(`, `ClientFunction(`, `Role(`, `RequestMock(`, `t.useRole(`, `t.eval(`, `t.addRequestHooks(`, `.withText(`, `.withAttribute(`, `.nth(`, `.find(`, `.filter(`, `.parent(`, `.child(`, `.sibling(` — each maps to a known replacement pattern
|
|
52
|
-
|
|
53
|
-
**Shared logic** — TestCafe projects accumulate four kinds of shared abstractions even without framework support:
|
|
54
|
-
|
|
55
|
-
- **Page-object-style modules** — classes whose properties are `Selector(...)` references and whose methods drive `t.*`. Usually under `tests/page-objects/`, `tests/pages/`, or `<feature>.po.{js,ts}`. Port directly to CodeceptJS page objects.
|
|
56
|
-
- **`Role` definitions** — every `const admin = Role('https://x/login', async t => { ... })`. These are TestCafe's session-cached login flows; their replacement is the **`auth` plugin** (phase 8).
|
|
57
|
-
- **`ClientFunction` factories** — `const getURL = ClientFunction(() => window.location.href)`. Each becomes a method on `WebExtra` using `page.evaluate`.
|
|
58
|
-
- **`RequestMock` factories / hook files** — `RequestMock().onRequestTo('/api/x').respond(...)`. Each becomes an `I.mockRoute(...)` call, either inline in tests or wrapped on `WebExtra` if reused widely.
|
|
59
|
-
- **Fixture hooks** — `fixture(...).beforeEach(...)` / `.before(...)` / `.after(...)`. Become CodeceptJS `Before` / `BeforeSuite` hooks in the corresponding test file.
|
|
60
|
-
- **Custom Test Controller methods** — projects sometimes extend `t` via mixins; treat them as helper methods and split UI vs HTTP into `WebExtra` / `ApiExtras`.
|
|
61
|
-
|
|
62
|
-
Produce a short inventory: every shared abstraction with its current location and planned CodeceptJS destination. The user reviews before any code is written.
|
|
63
|
-
|
|
64
|
-
### 2. Install CodeceptJS alongside TestCafe
|
|
65
|
-
|
|
66
|
-
`npx codeceptjs init` and pick the **Playwright** helper. Playwright covers the same three engines TestCafe supported (Chromium / Firefox / WebKit) with one config. Do not remove TestCafe yet — both run in parallel through the migration.
|
|
67
|
-
|
|
68
|
-
### 3. Port the config
|
|
69
|
-
|
|
70
|
-
Map `.testcaferc.{json,js}` keys → `codecept.conf.{js,ts}`:
|
|
71
|
-
|
|
72
|
-
| TestCafe | CodeceptJS 4 (`Playwright` helper) |
|
|
73
|
-
|---|---|
|
|
74
|
-
| `browsers: ['chrome']` / `['firefox']` / `['safari']` | `helpers.Playwright.browser: 'chromium'` / `'firefox'` / `'webkit'` |
|
|
75
|
-
| `browsers: ['chrome:headless']` | `helpers.Playwright.show: false` (or rely on `setHeadlessWhen(CI)`) |
|
|
76
|
-
| `src: ['tests/**/*.test.js']` | `tests: './tests/**/*_test.{js,ts}'` |
|
|
77
|
-
| fixture `.page('https://x')` | `helpers.Playwright.url: 'https://x'` |
|
|
78
|
-
| `selectorTimeout` / `assertionTimeout` | `helpers.Playwright.waitForTimeout` |
|
|
79
|
-
| `pageLoadTimeout` | `helpers.Playwright.timeout` |
|
|
80
|
-
| `concurrency: N` | CLI: `npx codeceptjs run-workers N` |
|
|
81
|
-
| `screenshots.path` / `videoPath` | top-level `output: './output'` |
|
|
82
|
-
| `screenshots.takeOnFails: true` | plugin `screenshot` with `on: 'fail'` |
|
|
83
|
-
| `videoPath` set | `helpers.Playwright.video: true` |
|
|
84
|
-
| `clientScripts: ['inject.js']` | `WebExtra` method using `page.addInitScript`, or `bootstrap()` |
|
|
85
|
-
| `quarantineMode` | top-level `retry: N` |
|
|
86
|
-
| `stopOnFirstFail: true` | CLI: `--bail` |
|
|
87
|
-
| `reporter: 'spec'` | drop (Mocha default) or plugin |
|
|
88
|
-
| `hostname` / `port` (proxy) | drop — Playwright manages |
|
|
89
|
-
|
|
90
|
-
### 4. Port shared abstractions
|
|
91
|
-
|
|
92
|
-
This is the bedrock. Do it before any spec rewrite — every spec rewrite shrinks because the verbs it needs (`I.doSmth(...)`) already exist.
|
|
93
|
-
|
|
94
|
-
**Hard rule for shared helper code.** Every reusable browser / HTTP function becomes a method on a custom CodeceptJS helper. **Split across two helpers by the kind of operation** — they have different access patterns and different correct APIs:
|
|
95
|
-
|
|
96
|
-
- **`WebExtra`** (`lib/helpers/WebExtra.js`) for **browser-driven** operations — anything that needs the open page, DOM, init scripts, storage, network-response waits. **This is where every `ClientFunction` and `t.eval` body lands, as `page.evaluate(...)`.** Reaches `this.helpers['Playwright'].page` / `.browserContext`.
|
|
97
|
-
- **`ApiExtras`** (`lib/helpers/ApiExtras.js`) for **pure HTTP** operations — programmatic login, seed/teardown data, CRUD against an API. Reaches `this.helpers['REST']` (or `GraphQL`). See `node_modules/codeceptjs/docs/api.md` for REST helper configuration.
|
|
98
|
-
|
|
99
|
-
Register both helpers under `helpers` in `codecept.conf.{js,ts}`.
|
|
100
|
-
|
|
101
|
-
**Never call `this.helpers['Playwright'].browserContext.request.*` for API work.** That bypasses the REST + `JSONResponse` stack — no step logging, no `I.seeResponseCodeIsSuccessful` assertions, no shared headers. If the API needs the same auth as the browser, share cookies once at the top of the config:
|
|
102
|
-
|
|
103
|
-
```js
|
|
104
|
-
import { setSharedCookies } from '@codeceptjs/configure'
|
|
105
|
-
setSharedCookies()
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
…or set `defaultHeaders` on the REST helper for token-based auth, or use `I.amBearerAuthenticated(secret(token))` per test. All three patterns are covered in `api.md`.
|
|
109
|
-
|
|
110
|
-
**WebExtra example** — `ClientFunction` ports here:
|
|
111
|
-
|
|
112
|
-
```js
|
|
113
|
-
import Helper from '@codeceptjs/helper'
|
|
114
|
-
|
|
115
|
-
export default class WebExtra extends Helper {
|
|
116
|
-
async grabLocationHref() {
|
|
117
|
-
const { page } = this.helpers['Playwright']
|
|
118
|
-
return page.evaluate(() => window.location.href)
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
async setLocalStorage(key, value) {
|
|
122
|
-
const { page } = this.helpers['Playwright']
|
|
123
|
-
await page.evaluate(([k, v]) => localStorage.setItem(k, v), [key, value])
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
async injectClientScript(path) {
|
|
127
|
-
const { page } = this.helpers['Playwright']
|
|
128
|
-
await page.addInitScript({ path })
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
**ApiExtras example** — `RequestMock` for *real* HTTP calls (seeding test data, not mocking responses) goes here:
|
|
134
|
-
|
|
135
|
-
```js
|
|
136
|
-
import Helper from '@codeceptjs/helper'
|
|
137
|
-
|
|
138
|
-
export default class ApiExtras extends Helper {
|
|
139
|
-
async loginViaApi(email, password) {
|
|
140
|
-
const REST = this.helpers['REST']
|
|
141
|
-
await REST.sendPostRequest('/api/auth/login', { email, password })
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
async seedUser(user) {
|
|
145
|
-
const REST = this.helpers['REST']
|
|
146
|
-
const { data } = await REST.sendPostRequest('/api/users', user)
|
|
147
|
-
return data
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
For **request mocking** (`RequestMock().onRequestTo(...).respond(...)`), see phase 10 — that uses `I.mockRoute` (Playwright), not `ApiExtras`.
|
|
153
|
-
|
|
154
|
-
**Helper code style** — applies to both:
|
|
155
|
-
|
|
156
|
-
- All `import` statements at the **top of the file**. Never `const fs = await import('node:fs/promises')` inside a method.
|
|
157
|
-
- Use built-in assertions (`I.seeResponseCodeIsSuccessful` for API, `I.seeElement` for browser), `ExpectHelper`, or factories from `codeceptjs/assertions` — **never** `if (cond) throw new Error('...')`. Failures must render as proper assertion errors. See `node_modules/codeceptjs/docs/assertions.md`.
|
|
158
|
-
|
|
159
|
-
**Other destinations** from the phase 1 inventory:
|
|
160
|
-
|
|
161
|
-
- **TestCafe page-object-style module** → CodeceptJS **page object class** under `pages/`. **Port conservatively** — keep only the methods the original module had; do not invent new wrappers during migration. `Selector(...)` properties (`this.usernameField = Selector('#user')`) become locator-string fields (`fields = { usernameField: '#user' }`); methods rewrite with `const { I } = inject()` at the top, calling `I.fillField`, `I.click`, and any `I.*` verb the `WebExtra` / `ApiExtras` helpers now contribute. Strip the `async t =>` plumbing — methods receive their args directly. Register under `include` in `codecept.conf.{js,ts}` so the page object auto-injects into Scenarios.
|
|
162
|
-
|
|
163
|
-
Page-object anti-patterns to avoid (unless the original TestCafe module already had them):
|
|
164
|
-
- **Assertion methods** (`checkTitle() { I.seeElement(...) }`) — page objects are action verbs (`fillForm`, `submitOrder`); let assertions live in the test.
|
|
165
|
-
- **One-liner wrappers** around a single `I.click` / `I.see*` / `I.grabTextFrom` — the wrapper buys nothing over calling `I.*` from the test.
|
|
166
|
-
- **Methods used by only one test** — leave the steps in the test.
|
|
167
|
-
- **`if (cond) throw new Error(...)`** in any method — use `I.see*`, `I.seeNumberOfElements`, `ExpectHelper`, or `codeceptjs/assertions` factories instead.
|
|
168
|
-
|
|
169
|
-
- **Shared `Selector` constants** → fields on the relevant page object. No free-floating `selectors.{js,ts}`.
|
|
170
|
-
- **`Role` definitions** → `auth` plugin role definitions (phase 8). If the `Role` body called the UI to log in, port it as a `WebExtra` method first; if it hit the API, port it as `ApiExtras`. The `auth` plugin then calls that method.
|
|
171
|
-
- **Pure utility modules** that don't touch the browser → plain ES modules, imported where needed.
|
|
172
|
-
|
|
173
|
-
Sanity-check before moving on: `npx codeceptjs check -c <config>` must pass, and `npx codeceptjs list -c <config>` must show every ported helper method as an `I.*` action contributed by `WebExtra` or `ApiExtras`.
|
|
174
|
-
|
|
175
|
-
### 5. Convert spec files
|
|
176
|
-
|
|
177
|
-
One file at a time, leaning on the abstractions from phase 4. Hand off the per-spec work to the **`writing-codeceptjs-tests`** skill — it drives the live browser via MCP and verifies each step before committing.
|
|
178
|
-
|
|
179
|
-
| TestCafe | CodeceptJS 4 |
|
|
180
|
-
|---|---|
|
|
181
|
-
| File `*.test.{js,ts}` | `*_test.{js,ts}` |
|
|
182
|
-
| `fixture('X').page('/x')` | `Feature('X')` at top + `Before(({ I }) => I.amOnPage('/x'))` |
|
|
183
|
-
| `test('y', async t => { ... })` | `Scenario('y', ({ I }) => { ... })` — drop `async t =>`, take `({ I, … })` from the test signature |
|
|
184
|
-
| `.beforeEach(async t => { ... })` | `Before(({ I }) => { ... })` |
|
|
185
|
-
| `.afterEach(async t => { ... })` | `After(({ I }) => { ... })` |
|
|
186
|
-
| `.before(...)` / `.after(...)` | `BeforeSuite(...)` / `AfterSuite(...)` |
|
|
187
|
-
| `t.navigateTo('/x')` | `I.amOnPage('/x')` |
|
|
188
|
-
| `await loginPage.login(u, p)` | `loginPage.login(u, p)` — no `await` on void page-object methods |
|
|
189
|
-
|
|
190
|
-
**Strip excess `await`** — this is the single biggest mechanical edit. TestCafe required `await` on every action; CodeceptJS forbids it on actions and reserves it for grabs. Convention:
|
|
191
|
-
|
|
192
|
-
```js
|
|
193
|
-
I.click('Save') // no await
|
|
194
|
-
I.fillField('Email', 'u@t.com') // no await
|
|
195
|
-
I.see('Saved') // no await
|
|
196
|
-
I.waitForElement('.toast', 3) // no await
|
|
197
|
-
const text = await I.grabTextFrom('h1') // await — grabs return data
|
|
198
|
-
const ok = await tryTo(() => I.click('Accept')) // await — effects can return values
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
If a step in the original used `t.ctx.foo = ...` to thread state through one test, store it in a plain `let` declared in the Scenario callback. `t.fixtureCtx` (suite-wide state) becomes a module-level variable, or a `BeforeSuite`-populated object.
|
|
202
|
-
|
|
203
|
-
**Iteration** — in tests, page objects, and helpers, use **`for...of`** for any loop containing `I.*` calls. Never `Array.prototype.forEach`. `.forEach` swallows the iteration callback's return — an `await` inside it does not block the outer function, and the recorder may queue steps out of order or finish the Scenario before the loop is done. `for...of` keeps the loop sequential and lets you add `await` later without rewriting:
|
|
204
|
-
|
|
205
|
-
```js
|
|
206
|
-
for (const sort of testSort) {
|
|
207
|
-
I.click(locate(this.filterFormLabel).withText(sort))
|
|
208
|
-
}
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
```js
|
|
212
|
-
for (const row of await I.grabWebElements('.row')) {
|
|
213
|
-
const text = await row.getText()
|
|
214
|
-
I.expectNotEmpty(text)
|
|
215
|
-
}
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
**Dry-run as you go.** After each batch of converted specs, run:
|
|
219
|
-
|
|
220
|
-
```bash
|
|
221
|
-
npx codeceptjs dry-run --steps -c <config>
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
It loads every scenario, resolves every `I.*` call against the configured helpers, and prints the step list — all without launching a browser. Typos, missing imports, page objects not registered under `include`, and `I.*` verbs that don't exist on `WebExtra` / `ApiExtras` all surface here in seconds. Fix anything that fails before running a real test.
|
|
225
|
-
|
|
226
|
-
**Then run the whole batch for real.** Dry-run proves specs parse and resolve — not that they pass. As soon as a batch is dry-run clean, run it against the browser:
|
|
227
|
-
|
|
228
|
-
```bash
|
|
229
|
-
npx codeceptjs run --steps -c <config>
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
First real runs after a migration almost always have failures — locator drift, timing the source framework hid behind its own retry, auth/session differences, data assumptions. **This is expected; fixing it is part of the migration, not a follow-up task.** When a test fails, **invoke the `debugging-codeceptjs-tests` skill and fix it on the fly** — it breakpoints the failing step, inspects the live page via MCP, finds the working locator/wait, and commits the verified fix. Do not bulk-rewrite specs blind, and do not mask failures with `retry`. Drive every failure to a real fix before starting the next batch. A batch is "done" when it runs green, not when it dry-runs clean.
|
|
233
|
-
|
|
234
|
-
### 6. Locator preference
|
|
235
|
-
|
|
236
|
-
CodeceptJS priority — pick the highest that fits. TestCafe's lazy chainable `Selector` lines up well with CodeceptJS's `locate()` builder, but most chains shrink considerably because semantic strings cover what `.withText` was doing.
|
|
237
|
-
|
|
238
|
-
1. **Semantic strings** — button text, label, placeholder, link text: `I.click('Save')`, `I.fillField('Email', 'u@t.com')`. Covers `Selector('button').withText('Save')` cleanly.
|
|
239
|
-
2. **ARIA roles** — `I.click({ role: 'button', name: 'Sign In' })`. Strong default for modern apps.
|
|
240
|
-
3. **`locate()` builder** — `I.click(locate('.row').withText('Acme').inside('table'))`. Direct equivalent of TestCafe `Selector('.row').withText('Acme').find('.btn')` style chains.
|
|
241
|
-
4. **CSS / XPath / attribute objects** — `{ id: 'foo' }`, `{ name: 'email' }`, `{ css: '[data-test=submit]' }`, `{ xpath: '//div[@id="x"]' }`. Fallback.
|
|
242
|
-
|
|
243
|
-
| TestCafe Selector chain | CodeceptJS 4 |
|
|
244
|
-
|---|---|
|
|
245
|
-
| `Selector('.btn')` | `'.btn'` |
|
|
246
|
-
| `Selector('button').withText('Submit')` | `'Submit'` (semantic) or `locate('button').withText('Submit')` |
|
|
247
|
-
| `Selector('button').withExactText('Submit')` | `locate('button').withTextEquals('Submit')` — or assert via `I.seeTextEquals('Submit', 'button')` |
|
|
248
|
-
| `Selector('input').withAttribute('name', 'email')` | `{ name: 'email' }` |
|
|
249
|
-
| `Selector('input').withAttribute('data-test', /^submit/)` | `{ css: 'input[data-test^="submit"]' }` |
|
|
250
|
-
| `Selector('.row').nth(0)` | `step.opts({ elementIndex: 1 })` |
|
|
251
|
-
| `Selector('.row').nth(-1)` | `step.opts({ elementIndex: 'last' })` |
|
|
252
|
-
| `Selector('.row').find('.btn')` | `locate('.btn').inside('.row')` — or context arg `I.click('.btn', '.row')` |
|
|
253
|
-
| `Selector('.parent').child('.kid')` | `locate('.kid').inside('.parent')` |
|
|
254
|
-
| `Selector('.row').filter('.active')` | `locate('.row').withClass('active')` |
|
|
255
|
-
| `Selector('button').parent('.toolbar')` | n/a one-liner; restructure as `I.click('button', '.toolbar')` |
|
|
256
|
-
| `Selector(t => t.foo)` (function selectors) | method on `WebExtra` using `page.locator` / `page.evaluate` |
|
|
257
|
-
| custom `t.fixtureCtx.selector = Selector(...)` | page-object field |
|
|
258
|
-
|
|
259
|
-
`step.opts(...)` comes from `import step from 'codeceptjs/steps'`.
|
|
260
|
-
|
|
261
|
-
### 7. Actions, assertions, grabs
|
|
262
|
-
|
|
263
|
-
TestCafe's Test Controller (`t`) and CodeceptJS's actor (`I`) line up closely — most actions are a verb rename. The big edits are dropping `await` from actions, collapsing `t.expect(sel.X).Y(...)` chains into single `I.see*` calls, and rewriting `t.eval` / `ClientFunction` into helper methods.
|
|
264
|
-
|
|
265
|
-
| TestCafe | CodeceptJS 4 |
|
|
266
|
-
|---|---|
|
|
267
|
-
| `await t.click(sel)` | `I.click(sel)` |
|
|
268
|
-
| `await t.typeText(sel, 'x')` | `I.fillField(sel, 'x')` (clears by default — same as TestCafe with `replace: true`) |
|
|
269
|
-
| `await t.typeText(sel, 'x', { replace: false })` | `I.appendField(sel, 'x')` |
|
|
270
|
-
| `await t.pressKey('enter')` | `I.pressKey('Enter')` |
|
|
271
|
-
| `await t.hover(sel)` | `I.moveCursorTo(sel)` |
|
|
272
|
-
| `await t.dragToElement(sel, target)` | `I.dragAndDrop(sel, target)` |
|
|
273
|
-
| `await t.takeScreenshot('x.png')` | `I.saveScreenshot('x.png')` |
|
|
274
|
-
| `await t.takeElementScreenshot(sel, 'x.png')` | `I.saveElementScreenshot(sel, 'x.png')` |
|
|
275
|
-
| `await t.resizeWindow(W, H)` | `I.resizeWindow(W, H)` |
|
|
276
|
-
| `await t.maximizeWindow()` | `I.resizeWindow('maximize')` |
|
|
277
|
-
| `await t.setNativeDialogHandler(fn)` | `I.acceptPopup()` / `I.cancelPopup()` per dialog |
|
|
278
|
-
| `await t.switchToIframe(sel)` | `within({ frame: sel }, () => { ... })` |
|
|
279
|
-
| `await t.switchToMainWindow()` | (end of `within` block) |
|
|
280
|
-
| `await t.openWindow(url)` | `session('w2', () => I.amOnPage(url))` |
|
|
281
|
-
| `await t.eval(() => document.title)` | `await I.executeScript(() => document.title)` — or method on `WebExtra` |
|
|
282
|
-
| `ClientFunction(() => window.location.href)()` | `await I.grabCurrentUrl()` (or `webExtra.grabLocationHref()` from phase 4) |
|
|
283
|
-
| `await t.wait(N)` (N ms) | `I.wait(N / 1000)` — CodeceptJS uses **seconds**; avoid in committed tests |
|
|
284
|
-
| `await t.getBrowserConsoleMessages()` | `await I.grabBrowserLogs()` |
|
|
285
|
-
| `await t.expect(sel.innerText).eql('X')` | `I.seeTextEquals('X', sel)` — or `I.see('X', sel)` for "contains" |
|
|
286
|
-
| `await t.expect(sel.innerText).contains('X')` | `I.see('X', sel)` |
|
|
287
|
-
| `await t.expect(sel.value).eql('X')` | `I.seeInField(sel, 'X')` |
|
|
288
|
-
| `await t.expect(sel.checked).ok()` | `I.seeCheckboxIsChecked(sel)` |
|
|
289
|
-
| `await t.expect(sel.classNames).contains('active')` | `I.seeElementHasClass(sel, 'active')` |
|
|
290
|
-
| `await t.expect(sel.exists).ok()` | `I.seeElementInDOM(sel)` |
|
|
291
|
-
| `await t.expect(sel.exists).notOk()` | `I.dontSeeElementInDOM(sel)` |
|
|
292
|
-
| `await t.expect(sel.visible).ok()` | `I.seeElement(sel)` |
|
|
293
|
-
| `await t.expect(sel.visible).notOk()` | `I.dontSeeElement(sel)` |
|
|
294
|
-
| `await t.expect(sel.count).eql(N)` | `I.seeNumberOfElements(sel, N)` |
|
|
295
|
-
| `await t.expect(value).eql(expected)` | `const v = await I.grabXxxFrom(...); I.expectEqual(v, expected)` (ExpectHelper) |
|
|
296
|
-
| `await sel.innerText` (grab) | `await I.grabTextFrom(sel)` |
|
|
297
|
-
| `await sel.getAttribute('data-id')` | `await I.grabAttributeFrom(sel, 'data-id')` |
|
|
298
|
-
| `await sel.count` (grab) | `await I.grabNumberOfVisibleElements(sel)` |
|
|
299
|
-
|
|
300
|
-
`await` only on grabs. Plain actions queue automatically.
|
|
301
|
-
|
|
302
|
-
### 8. Sessions and auth
|
|
303
|
-
|
|
304
|
-
`Role(url, async t => { ... })` + `t.useRole(role)` → the **`auth` plugin**. Hand off to **`codeceptjs-auth`** for the setup walk-through. The plugin caches the post-login cookie/storage state and replays it per test, which is exactly what `Role` does in TestCafe. If phase 4 already ported the `Role` body into `ApiExtras` as `I.loginViaApi(...)` or into `WebExtra` as `I.login(...)`, the `auth` plugin's role definition just calls it.
|
|
305
|
-
|
|
306
|
-
For multi-user scenarios (TestCafe handled this via multiple roles + `t.useRole` swaps), use `session(...)` from `codeceptjs/effects`.
|
|
307
|
-
|
|
308
|
-
### 9. Fixtures, requests, tasks
|
|
309
|
-
|
|
310
|
-
| TestCafe | CodeceptJS 4 |
|
|
311
|
-
|---|---|
|
|
312
|
-
| `import users from './fixtures/users.json'` | `import users from './fixtures/users.json' with { type: 'json' }` |
|
|
313
|
-
| `t.request(...)` (TestCafe 1.20+) | `await I.sendPostRequest(...)` via the **REST helper**; wrap reusable flows in the `ApiExtras` helper from phase 4 |
|
|
314
|
-
| `clientScripts` (inject JS per page) | `helpers.Playwright.bootstrap` (per-context init script) or `WebExtra` method using `page.addInitScript` |
|
|
315
|
-
| Test data via `fixture('X').meta(...)` | `Scenario(..., { tag: '@x' })` plus a constants module |
|
|
316
|
-
|
|
317
|
-
REST helper auth: `setSharedCookies()` from `@codeceptjs/configure` shares the browser session with REST so the same user is logged in on both sides; alternatively set `defaultHeaders` for static tokens or `I.amBearerAuthenticated(secret(token))` per test. See `node_modules/codeceptjs/docs/api.md`.
|
|
318
|
-
|
|
319
|
-
### 10. Network mocking
|
|
320
|
-
|
|
321
|
-
`RequestMock().onRequestTo(url).respond(body, status, headers)` → `I.mockRoute(url, route => route.fulfill({ status, headers, body }))` (Playwright). `RequestHook` subclasses become route handlers too. Disable with `I.stopMockingRoute(url)`. For request *logging* (`RequestLogger`), there is no direct equivalent — anchor assertions on UI outcomes (`I.waitForText`, `I.see`) or, if you really need a request transcript for the test, attach `page.on('request' | 'response')` inside a `WebExtra` method. See `node_modules/codeceptjs/docs/playwright.md` § Mocking Network Requests.
|
|
322
|
-
|
|
323
|
-
### 11. Decommission TestCafe
|
|
324
|
-
|
|
325
|
-
Only after every spec is ported and CI is green: delete `.testcaferc.{json,js,ts,cjs}`, drop `testcafe` from `devDependencies` (plus any `testcafe-browser-provider-*`, `testcafe-reporter-*`, `testcafe-react-selectors`, `testcafe-vue-selectors` add-ons), remove the TestCafe CI jobs, uninstall any standalone TestCafe binary.
|
|
326
|
-
|
|
327
|
-
## Verify
|
|
328
|
-
|
|
329
|
-
1. `npx codeceptjs check -c <config>` — config + helper + plugin sanity.
|
|
330
|
-
2. `npx codeceptjs list -c <config>` — every ported helper method appears as an `I.*` action from `WebExtra` or `ApiExtras`; every page object's methods appear.
|
|
331
|
-
3. `npx codeceptjs dry-run --steps -c <config>` — every Scenario loads.
|
|
332
|
-
4. Full run: `npx codeceptjs run --steps -c <config>`. Failures are expected on first runs — drive each to a fix via the **`debugging-codeceptjs-tests`** skill (not `retry`, not blind rewrites). The migration is complete only when the whole converted suite is green.
|
|
333
|
-
5. Hand off to **`codeceptjs-run-analysis`** to inspect `output/trace_*/` artifacts (requires the `aiTrace` plugin enabled).
|
|
334
|
-
6. `grep -rE "\\bfixture\\(|\\btest\\(|Selector\\(|ClientFunction\\(|\\bRole\\(|t\\.click\\(|t\\.typeText\\(" tests/` — empty before deleting the original TestCafe directory.
|
|
335
|
-
|
|
336
|
-
## Pointers
|
|
337
|
-
|
|
338
|
-
- `node_modules/codeceptjs/docs/basics.md` — `I.*` vocabulary, locators, assertions, the `await` rule (the rule TestCafe users have to *un*-learn)
|
|
339
|
-
- `node_modules/codeceptjs/docs/playwright.md` — recommended helper; `mockRoute` for `RequestMock`; `evaluate` for `ClientFunction` / `t.eval` ports
|
|
340
|
-
- `node_modules/codeceptjs/docs/locators.md` — semantic / ARIA / `locate()` builder (replaces TestCafe Selector chains)
|
|
341
|
-
- `node_modules/codeceptjs/docs/custom-helpers.md` — `WebExtra` / `ApiExtras` patterns (extending `Helper`, reaching `this.helpers['Playwright']` / `this.helpers['REST']`)
|
|
342
|
-
- `node_modules/codeceptjs/docs/api.md` — REST / GraphQL configuration, `setSharedCookies()`, `defaultHeaders`, `JSONResponse` assertions, Zod schemas
|
|
343
|
-
- `node_modules/codeceptjs/docs/assertions.md` — built-in `see*` assertions, `ExpectHelper`, `codeceptjs/assertions` factories (use these instead of `if (cond) throw new Error(...)`)
|
|
344
|
-
- `node_modules/codeceptjs/docs/pageobjects.md` — porting TestCafe Selector-based page objects
|
|
345
|
-
- `node_modules/codeceptjs/docs/sessions.md`, `auth.md` — replaces `Role` + `t.useRole`
|
|
346
|
-
- `node_modules/codeceptjs/docs/effects.md` — `tryTo`, `retryTo`, `within` (replaces `t.switchToIframe`)
|
|
347
|
-
- `writing-codeceptjs-tests` — per-spec rewrite playbook (drive via MCP, learn locators, commit verified steps)
|
|
348
|
-
- `debugging-codeceptjs-tests` — **use on every failing test from the first full run** (breakpoint, inspect live page via MCP, fix on the fly)
|
|
349
|
-
- `codeceptjs-auth` — replace `Role` + `t.useRole`
|
|
350
|
-
- `codeceptjs-fundamentals` — run **after** migration to confirm the new setup is wired correctly
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: refactoring-codeceptjs-tests
|
|
3
|
-
description: Use when refactoring CodeceptJS 4 tests — cleaning up duplication, extracting page objects, taming long locators, moving raw JS into custom helpers. Works targeted (one test or file) or global (whole tests directory). Always proposes changes before applying. Trigger on phrases like "refactor my tests", "clean up", "extract page object", "this test is too long", "deduplicate", or when reviewing test files for quality.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Refactoring CodeceptJS 4 Tests
|
|
7
|
-
|
|
8
|
-
Test suites rot in three predictable ways: duplicate UI flows copy-pasted across files, fat locators repeated everywhere, and raw JS escaping into Scenarios. The fix for each is moving the pattern to its proper home — page object, custom helper, or the `auth` plugin — without changing test behaviour.
|
|
9
|
-
|
|
10
|
-
This skill works **targeted** (refactor one test or file the user named) or **global** (sweep the whole tests directory). Either way it **proposes changes first** and applies after approval, in reviewable batches.
|
|
11
|
-
|
|
12
|
-
## Workflow
|
|
13
|
-
|
|
14
|
-
### 1. Read the project (fundamentals)
|
|
15
|
-
Run the **codeceptjs-fundamentals** skill. You need: registered page objects (keys under `include`), the actor file (`custom_steps.js` or similar), any custom helpers already configured, and the `auth` plugin's user list. Without this you don't know where extractions land.
|
|
16
|
-
|
|
17
|
-
### 2. Pick scope
|
|
18
|
-
- **Targeted** — a file or Scenario the user named. Read it once, propose, apply.
|
|
19
|
-
- **Global** — the configured `tests` glob. Treat as a multi-pass cycle: inventory → propose grouped → approve → apply a batch → re-run affected Scenarios → next batch. Never one big edit.
|
|
20
|
-
|
|
21
|
-
### 3. Inventory the target
|
|
22
|
-
Read the test(s). Note:
|
|
23
|
-
- Repeated `I.*` sequences across 2+ Scenarios.
|
|
24
|
-
- Locator strings used in 2+ places, or single locators that span multiple lines / deep XPath / nested CSS.
|
|
25
|
-
- `I.executeScript` blocks beyond one statement.
|
|
26
|
-
- `usePlaywrightTo` / `usePuppeteerTo` / `useWebDriverTo` blocks doing business work (not inspection).
|
|
27
|
-
- Hardcoded credentials, URLs, magic strings.
|
|
28
|
-
- `I.wait(N)` raw-seconds calls and `await` on plain action steps — fix while you're there.
|
|
29
|
-
|
|
30
|
-
### 4. Duplicate UI flows → page object methods
|
|
31
|
-
Sequences like login form fill, modal-confirm, search-then-click, table-row-edit. Extract to a method named for the user's intent: `loginPage.signIn(email, pass)`, `searchBar.searchFor(term)`, `cartPage.removeItem(name)`. Add to the existing PO when one fits the area; otherwise create a new PO and register it under `include` in the config. Apply the **rule of three** — wait for the second occurrence before extracting; one-off code shouldn't be abstracted.
|
|
32
|
-
|
|
33
|
-
### 5. Fat locators → `locate()` in page objects
|
|
34
|
-
Multi-line XPath, deeply nested CSS, or repeated locator strings. Convert to the `locate(...)` builder, leaning on the new 4.x DSL methods (`withClass`, `withoutClass`, `and`, `andNot`, plus `withText`, `inside`, `withDescendant`). Used once → keep `locate()` inline at the call site. Used 2+ times → store as a named page-object field with `.as('description')` so failures point at a meaningful name.
|
|
35
|
-
|
|
36
|
-
### 6. Raw JS → custom helper
|
|
37
|
-
Big `I.executeScript(...)` blocks, `usePlaywrightTo` doing real DOM walking or business logic, hand-rolled fetches inside a Scenario. Move into a method on a custom helper. Register the helper under `helpers` in the config alongside built-ins. **Critical rule from fundamentals**: inside a custom helper, `I` does **not** exist — compose with another helper via `this.helpers['<Name>']` (e.g. `this.helpers['Playwright'].page.evaluate(...)`, `this.helpers['REST'].sendGetRequest(...)`). Tests stay in the `I.*` vocabulary; helpers expose the new capability.
|
|
38
|
-
|
|
39
|
-
### 7. Special case — login duplication
|
|
40
|
-
If the duplicated UI flow is login, **don't build a `loginPage.signIn` method**. Hand off to the **codeceptjs-auth** skill — that's what the `auth` plugin exists for. Page objects for login flows are a common smell when the project should be using session reuse.
|
|
41
|
-
|
|
42
|
-
### 8. Cross-page flows (optional)
|
|
43
|
-
Site-wide actions used across many Features — `I.acceptCookies()`, `I.goToBilling()`, `I.dismissNotification()` — belong in the actor (`custom_steps.js`), not a single page's PO. The actor is the right home when no single page owns the action.
|
|
44
|
-
|
|
45
|
-
### 9. Propose, then apply
|
|
46
|
-
Group proposals by destination file (`pages/loginPage.js`, `helpers/DbHelper.js`, `tests/checkout_test.js`). Show the user the list before editing. In global mode, get explicit approval and work in batches — three to five files at a time. After each batch, run the affected Scenarios:
|
|
47
|
-
```bash
|
|
48
|
-
npx codeceptjs run --grep '<scenario or feature>' --steps
|
|
49
|
-
```
|
|
50
|
-
Hand the result to **codeceptjs-run-analysis** — confirm every affected scenario still passes and no failure shifted to a new step. Refactors that don't run aren't refactors — they're guesses.
|
|
51
|
-
|
|
52
|
-
## Decision tree
|
|
53
|
-
|
|
54
|
-
| Pattern | Where it goes |
|
|
55
|
-
|---|---|
|
|
56
|
-
| UI flow on one page | Method on that page's PO |
|
|
57
|
-
| UI flow spanning pages, site-wide | Actor (`custom_steps.js`) |
|
|
58
|
-
| Login | `auth` plugin (see `codeceptjs-auth`) |
|
|
59
|
-
| Long locator used once | `locate()` inline |
|
|
60
|
-
| Long locator used 2+ times | `locate()` stored as a PO field |
|
|
61
|
-
| Raw browser API / file system / DB / mail | Custom helper |
|
|
62
|
-
| Test-data setup hitting an API | REST helper + Data Object |
|
|
63
|
-
|
|
64
|
-
## Things to avoid
|
|
65
|
-
|
|
66
|
-
- Refactoring without re-running the affected Scenarios afterwards.
|
|
67
|
-
- Extracting a flow that's only used once — wait for the second occurrence.
|
|
68
|
-
- Renaming PO methods or fields without grepping for every caller first.
|
|
69
|
-
- Moving code to a custom helper when a page object would do.
|
|
70
|
-
- Squashing distinct flows into one method (`loginPage.do(thing)` is a smell).
|
|
71
|
-
- Touching Scenario names or tags — CI pipelines and `--grep` filters reference them.
|
|
72
|
-
- Mass-applying changes in global mode without batching and re-running.
|
|
73
|
-
|
|
74
|
-
## Pointers
|
|
75
|
-
|
|
76
|
-
- `node_modules/codeceptjs/docs/pageobjects.md` — class-based POs, `inject()`, lifecycle hooks
|
|
77
|
-
- `node_modules/codeceptjs/docs/custom-helpers.md` — extending `Helper`, the `this.helpers[...]` rule
|
|
78
|
-
- `node_modules/codeceptjs/docs/locators.md` — `locate()` builder + 4.x DSL methods
|
|
79
|
-
- `node_modules/codeceptjs/docs/best.md` — broader test-organisation guidance
|
|
80
|
-
- `codeceptjs-fundamentals` skill — DI, `inject()`, the `I`-unreachable-from-helpers rule
|
|
81
|
-
- `codeceptjs-auth` skill — for login deduplication
|