Cypress extension for vs code
setting | description | default |
---|---|---|
cypressHelper.commandForOpen |
command used for opening cypress | npx cypress open |
cypressHelper.commandForRun |
command used for running cypress | npx cypress run |
cypressHelper.customCommandsFolder |
path to folder with custom commands | cypress/support |
cypressHelper.typeDefinitionFile |
file to save generated custom commands | cypress/support/customCommands.d.ts |
cypressHelper.typeDefinitionExcludePatterns |
array of glob patterns that should be excluded from types generation | [**/*.ts ] |
cypressHelper.includeAnnotationForCommands |
include comments before custom command to type definition file | false |
cypressHelper.typeDefinitionOnSave |
generate type definitions file for custom commands on save | false |
cypressHelper.menuItems |
display menu items or lenses for commands | { "OpenCypress": true, "RunCypress": false, "GenerateCustomCommandTypes": true, "GoToCustomCommand": true, "FindCustomCommandReferences": true, "FindStepDefinitionReferences": true } |
cypressHelper.jqueryLocators |
configuration for jquery locators autocomplete | { "enabled": true, "commandsForAutocompletion": ["get", "find", "filter"], "includePatterns": [], "excludePatterns": [], "customAttributes": [], } |
cypressHelper.fixtureAutocompletionCommands |
cypress commands that accept fixture path as argument to add fixture path autocompletion | ["fixture"] |
cypressHelper.cucumberFixtureAutocompleteOnQuotes |
If you want fixture autocompletion in cucumber scenarios (using fixtures as parameters) you can enable it by setting true |
false |
cypressHelper.enableCommandReferenceProvider |
In case you have type definitions, native Find all References will return duplicates for commands. To avoid it set this parameter to false |
true |
cypressHelper.cucumberTagsAutocomplete |
Set enable: true for cucumber feature autocomplete on @ . Array of tags could be specified. Option to add cypress-allure-plugin tags. |
{ "enable": false, "tags": ["focus"], "allurePlugin": false } |
cypressHelper.reuseTerminalInstance |
By default executes commandForOpen in same terminal instance. To spawn new instance for each cypress opening set it to false |
true |
In case you want to be instantly redirected to definition file - click on custom command, and from editor menu select Cypress: Go to custom command definition
You can use native Go to Definition
and Peek Definition
- but usually it offers several results, so you should pick one by yourself.
If you are using just native editor menu items - you can disable Cypress: Go to custom command definition
in configuration cypressHelper.menuItems
by setting "GoToCustomCommand": false
How it works:
cypressHelper.customCommandsFolder
(cypress/support
by default).Cypress.Commands.add(%%detected_command%%)
is found - redirect.From editor menu select Cypress: Get custom command references
to choose from quick-pick menu or you can use native Find All References
and Peek References
to use left-panel tab.
You can disable editor Cypress: Get custom command references
item with configuration cypressHelper.menuItems
and "FindCustomCommandReferences": false
.
In case you have custom command .ts
definition file in your workspace - native methods will return duplicated results, so you can turn off extension references provider with configuration cypressHelper.enableCommandReferenceProvider: false
.
From command palette (⌘P) select Cypress: Find not used custom commands
Context menu item Cypress: Generate custom command types
or can also be configured to generate types on save, with cypressHelper.typeDefinitionOnSave
How it works:
customCommandsFolder
, typeDefinitionFile
, typeDefinitionExcludePatterns
, includeAnnotationForCommands
customCommandsFolder
, excepting typeDefinitionExcludePatterns
any
by default typeDefinitionFile
content to check how much commands changed to display messagetypeDefinitionFile
, in case includeAnnotationForCommands: true
also includes comment above commands. Please note that comment should be in JSDoc format (/**
), in other case only last comment is added. tsconfig.json
file, prompt to create it will be shown.From menu select Cypress: Get step definition references
to choose from quick-pick menu or you can use native Find All References
and Peek References
to use left-panel tab.
From command palette select command Cypress: Find not used Cucumber step definitions
cypressHelper.commandForOpen
configuration.only
/@focus
tag, or removing - click corresponding CodeLens. Also, you can just close terminal CypressOpen
to remove all only
tags from your file. cypressHelper.menuItems.OpenCypress
to false
cypressHelper.commandForOpen
;CypressOpen
;%%commandForOpen%% --config testFiles=%%spec%%
to terminal, where %%spec%%
is opened test file path; CypressOpen
is closed - deletes from opened test file all @focus
or .only
tags; Typing cy.fixture(
opens VS Code Completion interface with possible files and subfolders to select needed fixture file
To add your own commands that require fixture autocomplete for arguments - check configuration cypressHelper.fixtureAutocompletionCommands
If you are using cucumber and fixtures as parameters in your scenarios, you can enable autocomplete by setting cypressHelper.cucumberFixtureAutocompleteOnQuotes: true
Thanks to Josef Biehler for original fixture autocomplete idea
Go to definition and Peek definition options for feature files.
Works in cucumber feature files in scenario or examples table also.
Currently default fixtures path cypress/fixtures
supported only.
Autocompletion for aliases. Aliases will be selected from files in current folder.
Go to definition and Peek definition options available for aliases.
Aliases created in same folder files are supported only.
Typing @
in .feature
file shows autocompletion with tags from configuration cypressHelper.cucumberTagsAutocomplete.tags
- with focus
by default. In case you have cypress-allure-plugin just set cypressHelper.cucumberTagsAutocomplete.allurePlugin
and list of allure tags will be available.
From command palette select command Cypress: Create default tsconfig.json file
tsconfig could also be created when Cypress: Generate custom command types
is used.
Inside cy.type string or template literal argument just type {
which will trigger autocomplete for keypress event sequences
Configuration
true
.["get", "find", "filter"]
["**/support/locators/**"]
,default []
["**/support/locators/handler/**"]
,default []
["data-cy", "test-data"]
,default []
Usage
[
- list with attributes:
- list of jquery pseudo locators=
- list of matching strategies for attribute valuesCopyright 2019 90poe. This project is licensed under the Apache 2.0 License.