---
title: "Discussion on \"Cypress Tip: In-Spec Functions\" | Hashnode"
description: "Discussion on \"Cypress Tip: In-Spec Functions\". Let's imagine you have a bunch of repeatable code in your Cypress tests:\nit('should do this thing', () => {\n  // ...\n  cy.get('#thisElement')\n    .then($el => {\n      // some unusual hackery here\n    })\n  // ...\n})\nit('should do that thing', () => {\n..."
url: "https://hashnode.com/posts/cypress-tip-in-spec-functions/601ad5d80394d00f62dc607f"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Cypress Tip: In-Spec Functions](https://iheartjs.hashnode.dev/cypress-tip-in-spec-functions?utm_source=hashnode&utm_medium=feed)

Let's imagine you have a bunch of repeatable code in your Cypress tests: it('should do this thing', () => { // ... cy.get('#thisElement') .then($el => { // some unusual hackery here }) // ... }) it('should do that thing', () => { ...

Feb 3, 2021 · 3 min read · iheartjs.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#testing](https://hashnode.com/tag/testing)

## Written by

[Mike C](https://hashnode.com/@iheartjsdev)

@iheartjsdev · Provo, Utah, USA

  
[View profile](https://hashnode.com/@iheartjsdev)

I <3 JS

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
