{"id":25480231,"url":"https://github.com/siddharth23/cypress-postgres","last_synced_at":"2025-04-09T16:44:27.192Z","repository":{"id":42631963,"uuid":"285901671","full_name":"siddharth23/cypress-postgres","owner":"siddharth23","description":"Use this plugin to query Postgres database and use response in cypress tests","archived":false,"fork":false,"pushed_at":"2023-03-09T05:47:38.000Z","size":15,"stargazers_count":7,"open_issues_count":5,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T16:33:16.221Z","etag":null,"topics":["cypress","cypress-plugin","cypress-tests","postgres","postgres-database","postgresql","postgresql-database","queryresponse","sql-query"],"latest_commit_sha":null,"homepage":"https://github.com/siddharth23/cypress-postgres","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/siddharth23.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-07T19:02:01.000Z","updated_at":"2024-09-25T20:04:25.000Z","dependencies_parsed_at":"2024-06-20T00:02:20.142Z","dependency_job_id":"dae22f6a-f182-405e-9dd2-cc683d1ef3e2","html_url":"https://github.com/siddharth23/cypress-postgres","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddharth23%2Fcypress-postgres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddharth23%2Fcypress-postgres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddharth23%2Fcypress-postgres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddharth23%2Fcypress-postgres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/siddharth23","download_url":"https://codeload.github.com/siddharth23/cypress-postgres/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248069781,"owners_count":21042702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cypress","cypress-plugin","cypress-tests","postgres","postgres-database","postgresql","postgresql-database","queryresponse","sql-query"],"created_at":"2025-02-18T15:38:48.158Z","updated_at":"2025-04-09T16:44:27.172Z","avatar_url":"https://github.com/siddharth23.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cypress POSTGRES\n\nTest sql query to your postgres database in cypress tests\n\nUse this plugin to query postgres database and use response in cypress tests\n\n# Installation\n* Run below command in terminal to install the cypress postgres\n```bash\nnpm i -D cypress-postgres\n\n```\n* Open your `cypress/plugins/index.js` file and register a new task\n```\nmodule.exports = on =\u003e {\n    on(\"task\", {\n        dbQuery:(query)=\u003e require(\"cypress-postgres\")(query.query,query.connection)\n    });\n};\n```\n\n# How to use it\n\nTo query postgres database follow below steps-\n* Add postgres database connection details in cypress.json file. Details like-\n```\n\"db\":\n{\"user\": \"postgres\",\n\"host\": \"localhost\",\n\"database\": \"postgres\",\n\"password\": \"*****\",\n\"port\":5432\n}\n```\n\n* Use dbQuery task in your tests to query postgres database like below-\n```\ncy.task(\"dbQuery\", {\"query\":\"your sql query\"}).then(queryResponse =\u003e {\n  expect(queryResponse).to.equal(\"[{Your expected query result}]\")\n});\n```\n* If you need to query multiple database you can also pass the connection from scripts like below-\n* Create connection in your scripts-\n```\nlet connection={\"user\": \"postgres\",\n\"host\": \"localhost\",\n\"database\": \"postgres\",\n\"password\": \"*****\",\n\"port\":5432\n}\n```\n* And use this in your test scripts like below-\n```\n  cy.task(\"dbQuery\", {\"query\":\"your sql query\",\"connection\":connection}).then(queryResponse =\u003e {\n            expect(queryResponse).to.equal(\"[{Your expected query result}]\")\n        });\n```\n## Contributors\n\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore --\u003e\n\u003ctable\u003e\u003ctr\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"https://www.linkedin.com/in/siddharth-kala-575ba6175/\"\u003e\u003cimg src=\"https://media-exp1.licdn.com/dms/image/C4E03AQFSKgEAqprkcA/profile-displayphoto-shrink_400_400/0?e=1602115200\u0026amp;v=beta\u0026amp;t=dXeAXbqHe7MyENd7o8zdH_bbAFdffnAdVx3rsQkygjg\" width=\"100px;\" alt=\"Siddharth Kala\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eSiddharth Kala\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/siddharth23/cypress-postgres.git\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/siddharth23/cypress-postgres.git\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddharth23%2Fcypress-postgres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiddharth23%2Fcypress-postgres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddharth23%2Fcypress-postgres/lists"}