Coder Social home page Coder Social logo

nachtneblovak / cypress-smart-logs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from keeema/cypress-smart-logs

0.0 0.0 0.0 93 KB

Cypress plugin allowing to add additional information to logs and configure the output.

License: MIT License

TypeScript 89.41% JavaScript 10.59%

cypress-smart-logs's Introduction

cypress-smart-logs

Cypress plugin allowing to add additional information to logs and configure the output.

Setup plugin

Change your cypress/plugins/index.ts

/// <reference types="cypress" />

import smartLogs = require("cypress-smart-logs/plugin");

module.exports = (on: Cypress.PluginEvents, config: Cypress.ConfigOptions) => {
  smartLogs.install(on, config);
};

Register commands

Change your cypress/support/index.ts

/// <reference types="." />

import "cypress-smart-logs/commands";

// use this construct to add new warning type
Cypress.SmartLogs.setLogType("WARNING", {
  format: "*",
  target: { openMode: ["file", "window"], runMode: ["file"] },
  pairedCommands: ["custom"],
});

// this custom commands is bound to WARNING log type
Cypress.Commands.add("custom", () => {
  Cypress.log({});
});

and add type defs to cypress/support/index.d.ts

/// <reference types="cypress-smart-logs" />

declare namespace Cypress {
  interface ILogTypes {
    WARNING: ILogTypeConfig;
  }

  interface Chainable<Subject> {
    custom(): Cypress.Chainable<void>;
  }
}

Additional settings

Logs are by default saved only for failed cases. In run mode are window logs disabled.

Additional configuration can be defined in Cypress.SmartLogs.Config object.

cypress-smart-logs's People

Contributors

keeema avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.