Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/konghayao/cypress-template
It's a cypress template including action recording, assertion codegen, virtual test and multi environment presets!
https://github.com/konghayao/cypress-template
assertions codegen cypress multi-environment testing-tools visualtesting
Last synced: about 2 months ago
JSON representation
It's a cypress template including action recording, assertion codegen, virtual test and multi environment presets!
- Host: GitHub
- URL: https://github.com/konghayao/cypress-template
- Owner: KonghaYao
- Created: 2024-03-08T06:42:33.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-03-08T07:10:41.000Z (11 months ago)
- Last Synced: 2024-10-21T04:15:37.767Z (3 months ago)
- Topics: assertions, codegen, cypress, multi-environment, testing-tools, visualtesting
- Language: JavaScript
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cypress Test Template
## Test Like a Human: Click and Copy, We'll Generate the Rest!
## Getting Start
1. init repo
```sh
git lfs installnpm 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
```
2. Add System tag
```js
// scripts/start.js
/** 环境配置 */
const config = {
// system tag
ui: {
// environment tag
dev: 'https://localhost:6066',
uat: 'https://uat.example.com',
},
};
```3. implement login method in `cypress/support/e2e.js`
You can create a default login username and password in `.env` file.
```js
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,
},
);
};
```4. Start System
```sh
pnpm e2e --system=ui.dev # start system
```