Skip to content

TheRemjx01/autobot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

autobot

A project of some useful cypress stuff you may love

@TODO: graphql request plugins

raw-sql-plugin

Usage:

In cypress.env.json, add your database connection config. Here is the example, please replace with your db config

{
  "databaseOptions": {
    "host": "localhost",
    "user": "john.doe",
    "database": "hello.world",
    "password": "my.p@ssword",
    "client": "mysql2"
  }
}

In plugins/index.js of your project, add these line:

const { rawSqlHandler } = require('@theremjx01/autobot');

module.exports = (on, config) => {
    // ... other plugins event 
    on('task', {
        rawSQL(args) {
          return rawSQLHandler(on, config)(args);
        },
        //... other task
    });
}

In your test file, example: demo.spec.js, use this command to call use rawSQL:

describe('demo test', () => {
    it('should be able to call rawsql', () => {
        cy.task('rawSQL', 'SELECT * FROM demo_table').then(sqlRes => {
            // handle result    
        }).catch(sqlErr => {
            // handle error
        });
    });
})

About

Some cool cypress plugins you may need

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published