Skip to content
/ Cypress-Template Public template

It's a cypress template including action recording, assertion codegen, virtual test and multi environment presets!

Notifications You must be signed in to change notification settings

KonghaYao/Cypress-Template

Repository files navigation

Cypress Test Template

Test Like a Human: Click and Copy, We'll Generate the Rest!

Getting Start

  1. init repo
git lfs install

npm config set sharp_binary_host "https://npmmirror.com/mirrors/sharp"
npm config set sharp_libvips_binary_host "https://npmmirror.com/mirrors/sharp-libvips"

pnpm i

pnpm e2e --system=ui.dev # start system
  1. Add System tag
// scripts/start.js
/** 环境配置 */
const config = {
    // system tag
    ui: {
        // environment tag
        dev: 'https://localhost:6066',
        uat: 'https://uat.example.com',
    },
};
  1. implement login method in cypress/support/e2e.js

You can create a default login username and password in .env file.

export const login = (username, password) => {
    username = username || Cypress.env('USERNAME');
    password = password || Cypress.env('PASSWORD');
    cy.session(
        username,
        () => {
            cy.on('uncaught:exception', (err, runnable) => {
                // returning false here prevents Cypress from
                // failing the test
                return false;
            });
            // Place write a process to login
            // cy.visit('https://example.login.com/login?service=' + Cypress.env('BASE'));

            // cy.get('#username').type(username);
            // cy.get('#password').type(password);
            // cy.get('.login-button').click();
        },
        {
            cacheAcrossSpecs: true,
        },
    );
};
  1. Start System
pnpm e2e --system=ui.dev # start system

About

It's a cypress template including action recording, assertion codegen, virtual test and multi environment presets!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published