Giter Site home page Giter Site logo

siddharth23 / cypress-postgres Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 10.0 15 KB

Use this plugin to query Postgres database and use response in cypress tests

Home Page: https://github.com/siddharth23/cypress-postgres

JavaScript 97.87% HTML 2.13%
cypress cypress-plugin postgres postgres-database postgresql postgresql-database cypress-tests queryresponse sql-query

cypress-postgres's People

Contributors

jorgesartori avatar kawadesoni avatar siddharth23 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

cypress-postgres's Issues

Support for multiple database tables

I have an SQL query which needs a INNER JOIN between two database tables.
Is this something that can be supported?

I understand there is a connection parameter to support different tables but putting two connection in a single parameter, how is that possible?

cy.task("dbQuery", {"query":"your sql query","connection":connection}) with something like cy.task("dbQuery", {"query":"your sql query","connection":connection1 and connection2})

Creating a duplicate database object for the same connection

After repeatedly running a test with a call to cy.task("dbQuery"... I get warnings:

WARNING: Creating a duplicate database object for the same connection.
    at module.exports (e2e-tests/node_modules/cypress-postgres/cypress/plugins/index.js:21:14)
    at dbQuery (/e2e-tests/cypress/plugins/index.js:24:29)
    at invoke (/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/task.js:41:14)

Is it to do with the way dbQuery task is added in plugins? Any advice?

pass multiple dburi

Hi ,
is there any way , i can pass the databaseUri to connect and query.
with this setup i can connect a single database instance only

New Cypress (v10.x.x) configuration does not work with this file setup (cypress.json)

In Cypress > plugins > index.js the path is set to cypress.json, which was the default config for Cypress up until they released major version 10 in June 2022.

Now they have a new file setup where cypress.json is not supported, and cypress.json is renamed to cypress.config.js. This results in the module / task for cypress-postgres not being found as it looks in the wrong path. It may be temporarily resolved with local changes, but in pipelines doing npm install every time to run the script, it will need to be changed in the plugin itself.

Docs are here for more information:
https://docs.cypress.io/guides/references/configuration#Configuration-File

Task can't find configuration file when it is in a different folder

I'm using cypress-postgres together with Quasar.
I want to have different configuration files in different folders but, when I try to run the tests, it says:

cy.task('dbQuery') failed with the following error:

Cannot find module '/../cypress.json'
Require stack:
- /.../node_modules/cypress-postgres/cypress/plugins/index.js
- /.../test/cypress/plugins/index.ts 

This is what I have inside my plugins/index.ts

const pluginConfig: Cypress.PluginConfig = (on, config) => {
    on('task', {
        dbQuery: (query) => {
            require('cypress-postgres')(query.query, query.connection)
        }
    })
}

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.