Skip to main content

Add a project

What is a project?

A project can either repsent the whole website or application you are testing or just a component of it.

Tip

If your website or application is so big that each component has its own QAA team, we recommend creating projects for each of those components.

Info

Each project has its own commands and each project has access to shared commands.

This is done so that multiple teams dont interfere with each others commands (override Cypress command or create GIT conflict), but still be able to share commands like login, logout, openSidebar, etc.

Add a project

Currently we have an empty template, and we're going to add a project to work with.

We can do that with the following command:

$ npm run add-project
Info

You can add as many projects as you want.

It will ask you for two things:

  • Project name (lowercase)
  • Base URL
    • Recommendation is to enter your test environment(staging) URL
    • We see how to modify other environments later
Careful

The value you enter for the Project name will be used to create directories.

Recommendation is to enter the name in lowercase.

Enter your Project name and Base URL.

For the purpose of this tutorial we will enter the following data and refer to it in the next steps

Project NameBase URL
saucedemohttps://www.saucedemo.com/v1/index.html

Generated files

The add-project command from above will create the following structure and inject new code in a couple of files.

cypress/
- configs/
- saucedemo/ -> (Created)
- default.ts
- fixtures/
- saucedemo/ -> (Created)
- routes.json
- users.json
- e2e/
- saucedemo/ -> (Created)
- default.cy.ts
- support/
- e2e/
- saucedemo/ -> (Created)
- commands.ts
- index.ts
- commands.ts -> (Injected)
package.json -> (Injected - 6 commands for your project)

Run it

You can already run your project in open mode using the following command

$ npm run saucedemo-staging.open

or in headless mode

$ npm run saucedemo-staging

In the next step we will see how to set up our routes and users for different environments.