Rayrun
← Back to videos

VSCode trick to write Playwright test block quicker | User Snippet | Playwright Tutorial - Part 84

Dah, nothing much just a quick tip that I mostly used.

In this video tutorial, the speaker demonstrates a shortcut in VS Code for writing code more efficiently. They explain that typically, an import statement is written followed by a test declaration, steps, and a callback function. However, with the help of user snippets, this process can be simplified.

The speaker shows how to create a custom user snippet for an import statement and a test block. They access the command palette, search for "user snippet," and navigate to the relevant TypeScript JSON file. Within the file, they create a description for the snippet, a prefix for easy selection, and the desired code to be generated. They use string interpolation and escape characters to format the snippet correctly.

After creating these snippets, the speaker demonstrates how to use them by typing the prefix and selecting the desired snippet. They show the generated code and highlight that customizing the snippets further, such as adding line breaks or tabs, is also possible.

In conclusion, this video tutorial teaches viewers how to utilize user snippets in VS Code to simplify and speed up their coding process. It offers step-by-step instructions for creating and using custom snippets for import statements and test blocks. The speaker emphasizes the efficiency and time-saving benefits of using these shortcuts.

Related Videos

Playing Your Tests Wright with VS Code
Playing Your Tests Wright with VS Code
#16 - ARIA and how Playwright is making use of it to identify UI controls?
#16 - ARIA and how Playwright is making use of it to identify UI controls?
Playwright - Set timeout, parallelisation and retries directly in your test files
Playwright - Set timeout, parallelisation and retries directly in your test files
Playwright VsCode Extension
Playwright VsCode Extension
TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.