0.2.0 • Published 10 months ago

cypress-smart-logs v0.2.0

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months ago

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.

0.2.0

10 months ago

0.1.0

1 year ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago