{"id":31309316,"url":"https://github.com/leojuriolli7/cypress-stripe-elements","last_synced_at":"2025-09-25T06:37:36.824Z","repository":{"id":312456490,"uuid":"1047567816","full_name":"leojuriolli7/cypress-stripe-elements","owner":"leojuriolli7","description":"Cypress Plugin for filling Stripe Elements inside an iframe.","archived":false,"fork":false,"pushed_at":"2025-08-30T18:45:46.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-30T19:31:35.224Z","etag":null,"topics":["cypress","e2e","plugin","stripe","stripe-elements","testing"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leojuriolli7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-30T17:53:51.000Z","updated_at":"2025-08-30T18:45:50.000Z","dependencies_parsed_at":"2025-08-30T19:31:37.689Z","dependency_job_id":"5bb10079-b6f7-4555-808c-78e303a332f4","html_url":"https://github.com/leojuriolli7/cypress-stripe-elements","commit_stats":null,"previous_names":["leojuriolli7/cypress-stripe-elements"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/leojuriolli7/cypress-stripe-elements","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leojuriolli7%2Fcypress-stripe-elements","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leojuriolli7%2Fcypress-stripe-elements/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leojuriolli7%2Fcypress-stripe-elements/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leojuriolli7%2Fcypress-stripe-elements/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leojuriolli7","download_url":"https://codeload.github.com/leojuriolli7/cypress-stripe-elements/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leojuriolli7%2Fcypress-stripe-elements/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276875170,"owners_count":25720241,"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","status":"online","status_checked_at":"2025-09-25T02:00:09.612Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","e2e","plugin","stripe","stripe-elements","testing"],"created_at":"2025-09-25T06:37:35.651Z","updated_at":"2025-09-25T06:37:36.815Z","avatar_url":"https://github.com/leojuriolli7.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cypress-stripe-elements\n\nA Cypress plugin that provides a command to easily fill Stripe Elements inputs within iframes. Without `cy.wait()` hacks or else.\n\n\u003cimg width=\"2568\" height=\"1228\" alt=\"cypress-stripe-elements\" src=\"https://github.com/user-attachments/assets/198f1d89-a0f6-406b-92d4-dbf31752f981\" /\u003e\n\n\n## Installation\n\n```bash\nnpm install --save-dev cypress-stripe-elements\n# or\nyarn add --dev cypress-stripe-elements\n# or\npnpm install --save-dev cypress-stripe-elements\n```\n\nSet `{ \"chromeWebSecurity\": false }` in your `cypress.config.js` file, or the plugin will not work:\n\n```js\nimport { defineConfig } from \"cypress\";\n\nexport default defineConfig({\n  e2e: {\n    chromeWebSecurity: false,\n  },\n});\n```\n\nImport the plugin in your Cypress support file:\n\n```js\n// cypress/support/e2e.js\nimport \"cypress-stripe-elements\";\n```\n\n### TypeScript\n\nIf you encounter type errors, make sure to include the following `types` in your `tsconfig.json` file:\n\n```json\n{\n  \"compilerOptions\": {\n    \"types\": [\"cypress\", \"cypress-stripe-elements\"]\n  }\n}\n```\n\n## Usage\n\nThis package provides a `cy.fillStripeElement(name, value)` command. It works with every Stripe Element that renders a text input.\n\n### How it works\n\nThe `fillStripeElement` command targets Stripe Elements inputs via their `name` attribute (e.g., `input[name=\"number\"]` for Credit Card number input). While some field names are typed for common PaymentElement fields (`number`, `cvc`, `expiry`) and LinkAuthenticationElement (`email`), you can pass any name string to support any text input field from Stripe's iframes.\n\n### Basic Usage\n\n```js\ncy.fillStripeElement(\"number\", \"4242424242424242\"); // Fill Credit Card number field\ncy.fillStripeElement(\"expiry\", \"0442\"); // Fill CC Expiry field\ncy.fillStripeElement(\"cvc\", \"424\");\ncy.fillStripeElement(\"email\", \"test@example.com\");\n```\n\n### Working with Multiple Iframes\n\nWhen you have multiple Stripe Elements on a page (e.g., PaymentElement + LinkAuthenticationElement), use Cypress's `within()` command to scope your interactions to the correct iframe:\n\n```js\n// E-mail input is in the LinkAuthenticationElement iframe\ncy.getBySelector(\"PaymentForm-LinkAuthenticationElement\").within(() =\u003e {\n  cy.fillStripeElement(\"email\", \"placeholder@mail.com\");\n});\n\n// Card inputs are in the PaymentElement iframe\ncy.getBySelector(\"PaymentForm-PaymentElement\").within(() =\u003e {\n  cy.fillStripeElement(\"number\", \"4242424242424242\");\n  cy.fillStripeElement(\"expiry\", \"0442\");\n  cy.fillStripeElement(\"cvc\", \"424\");\n});\n\ncy.getBySelector(\"PaymentForm-SubmitButton\").click();\n```\n\n### Complete Example\n\nGiven a form component like this:\n\n```tsx\n\u003cform onSubmit={handleSubmit} data-test=\"payment-form\"\u003e\n  \u003cdiv data-test=\"PaymentForm-LinkAuthenticationElement\"\u003e\n    \u003cLinkAuthenticationElement /\u003e\n  \u003c/div\u003e\n\n  \u003cdiv data-test=\"PaymentForm-PaymentElement\"\u003e\n    \u003cPaymentElement /\u003e\n  \u003c/div\u003e\n\n  \u003cbutton type=\"submit\" data-test=\"PaymentForm-SubmitButton\"\u003e\n    Submit\n  \u003c/button\u003e\n\u003c/form\u003e\n```\n\nYour Cypress test would look like:\n\n```js\ndescribe(\"Payment Form\", () =\u003e {\n  it(\"successfully fills payment information\", () =\u003e {\n    cy.visit(\"/payment\");\n\n    // Fill email in LinkAuthenticationElement\n    cy.getBySelector(\"PaymentForm-LinkElement\").within(() =\u003e {\n      cy.fillStripeElement(\"email\", \"test@example.com\");\n    });\n\n    // Fill card details in PaymentElement\n    cy.getBySelector(\"PaymentForm-PaymentElementContainer\").within(() =\u003e {\n      cy.fillStripeElement(\"number\", \"4242424242424242\");\n      cy.fillStripeElement(\"expiry\", \"0442\");\n      cy.fillStripeElement(\"cvc\", \"424\");\n    });\n\n    cy.getBySelector(\"PaymentForm-SubmitButton\").click();\n\n    // Assert success state\n    cy.contains(\"Payment successful\").should(\"be.visible\");\n  });\n});\n```\n\n## Credits\n\nThis library is based on and heavily inspired by [`cypress-plugin-stripe-elements`](https://github.com/dbalatero/cypress-plugin-stripe-elements) by [@dbalatero](https://github.com/dbalatero). The original library was unmaintained, and this version includes fixes for updated Stripe Element selectors and modern Cypress compatibility.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleojuriolli7%2Fcypress-stripe-elements","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleojuriolli7%2Fcypress-stripe-elements","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleojuriolli7%2Fcypress-stripe-elements/lists"}