Automation Playground

Get started with testing

Follow our brief step-by-step guide to set up your environment and write your first test.

1
Before diving into the specifics of setting up your testing environment, we need to ensure you have the essential tools. This involves installing Node.js and npm, which are fundamental for managing JavaScript dependencies, and choosing a code editor that will streamline your development process.
💻 Node.js and npm (Node Package Manager):
Most JavaScript testing frameworks rely on Node.js. Download and install the latest LTS version from nodejs.org. npm is included with Node.js. Verify the installation in your terminal by running:
node -v && npm -v
📝 A Code Editor:
Visual Studio Code (VS Code) is highly recommended due to its rich features, extensions, and debugging capabilities. You can download it from code.visualstudio.com
2
With the necessary software installed, we can now set up your project. This involves creating a dedicated directory, initializing npm to manage your project's dependencies and installing Cypress.
🗂️ Create a Project Directory:
Create a new folder for your project (e.g., automation-playground) and navigate into it in your terminal:
mkdir automation-playground && cd automation-playground
🎬 Initialize npm:
npm init -y
(This creates a package.json file).
💿 Install Cypress:
npm install cypress --save-dev
3
We're nearing the end, let's finalize with a simple test. To ensure basic functionality, we'll visit a website and verify its title. And next steps? It's up to you... :)
📄 Create a new file
Create a new file in the cypress/e2e folder (e.g., visit_automation_playground.cy.js).
describe('Automation Playground - Page Title Test', () => {
   it('should verify the page title', () => {
      // This will navigate to automation playground page
      cy.visit('https://www.automation-playground.com');
   
      // Assertion of the page title
      cy.title().should('eq', 'Automation Playground');
   });
});
📖 Open Cypress Test Runner:
In your terminal run the command to open Cypress Test Runner:
npx cypress open
🚀 Run Your Test:
In the Cypress Test Runner, you'll see your test file (visit_automation_playground.cy.js).
Click on it to run the test.