{"id":22275702,"url":"https://github.com/deepsquare-io/cypress-iframe","last_synced_at":"2025-07-28T16:32:25.787Z","repository":{"id":45319109,"uuid":"442849185","full_name":"deepsquare-io/cypress-iframe","owner":"deepsquare-io","description":"Adds iframe support to Cypress","archived":false,"fork":false,"pushed_at":"2023-08-03T05:33:06.000Z","size":255,"stargazers_count":3,"open_issues_count":6,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-13T18:54:57.808Z","etag":null,"topics":["command","cypress","e2e","iframe","test"],"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/deepsquare-io.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}},"created_at":"2021-12-29T17:51:18.000Z","updated_at":"2022-09-22T06:56:22.000Z","dependencies_parsed_at":"2022-08-28T13:52:16.238Z","dependency_job_id":null,"html_url":"https://github.com/deepsquare-io/cypress-iframe","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepsquare-io%2Fcypress-iframe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepsquare-io%2Fcypress-iframe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepsquare-io%2Fcypress-iframe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepsquare-io%2Fcypress-iframe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deepsquare-io","download_url":"https://codeload.github.com/deepsquare-io/cypress-iframe/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227932626,"owners_count":17843136,"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":["command","cypress","e2e","iframe","test"],"created_at":"2024-12-03T14:11:44.569Z","updated_at":"2024-12-03T14:11:45.229Z","avatar_url":"https://github.com/deepsquare-io.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cypress iframe\n\n[![GitHub license](https://img.shields.io/github/license/deepsquare-io/cypress-iframe?style=flat-square)](https://github.com/deepsquare-io/cypress-iframe/blob/main/LICENSE)\n[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/deepsquare-io/cypress-iframe/Test?label=tests\u0026logo=cypress\u0026style=flat-square)](https://github.com/deepsquare-io/cypress-iframe/actions/workflows/test.yml)\n[![npm latest version](https://img.shields.io/npm/v/@deepsquare/cypress-iframe?style=flat-square)](https://www.npmjs.com/package/@deepsquare/cypress-iframe)\n\nThis packages adds iframe support to [Cypress](https://www.cypress.io/).\n\nThis repository is a fork of [`cypress-iframe`](https://gitlab.com/kgroat/cypress-iframe), originally created\nby [Kevin Groat](https://www.kgroat.dev/) ([kgroat](https://gitlab.com/kgroat)).\n\n## Installation\n\n```bash\nnpm install -D @deepsquare/cypress-iframe\n# or\nyarn add -D @deepsquare/cypress-iframe\n# or\npnpm install -D @deepsquare/cypress-iframe\n```\n\nIn your `cypress/support/commands.js` file, add the following:\n\n```js\nimport '@deepsquare/cypress-iframe';\n\n// or\nrequire('@deepsquare/cypress-iframe');\n```\n\nIf you're using TypeScript with cypress, and have not overridden the `types` or `typeRoots` in your tsc compiler\noptions, then everything should work.\n\nIf you have overridden them, or if it otherwise doesn't work out-of-the-box, you will also either want to:\n\n1. Add `///\u003creference types=\"cypress-iframe\" /\u003e` to the top of your cypress tests in which you use the commands\n1. Add a `globals.d.ts` in the root of your `cypress` directory and add `///\u003creference types=\"cypress-iframe\" /\u003e` to it\n\n## Usage\n\nYou can now use the three included commands.\n\n### `frameLoaded`\n\nThis command checks that an iframe has loaded onto the page\n\nExample:\n\n```js\n// This will verify that the iframe is loaded to any page other than 'about:blank'\ncy.frameLoaded();\n\n// This will verify that the iframe is loaded to any url containing the given path part\ncy.frameLoaded({ url: 'https://google.com' });\ncy.frameLoaded({ url: '/join' });\ncy.frameLoaded({ url: '?some=query' });\ncy.frameLoaded({ url: '#/hash/path' });\n\n// You can also give it a selector to check that a specific iframe has loaded\ncy.frameLoaded('#my-frame');\ncy.frameLoaded('#my-frame', { url: '/join' });\n```\n\n### `iframe`\n\nThis will cause subsequent commands to be executed inside of the given iframe\n\nExample:\n\n```js\n// This will verify that the iframe is loaded to any page other than 'about:blank'\ncy.iframe().find('.some-button').should('be.visible').click();\ncy.iframe().contains('Some hidden element').should('not.be.visible');\ncy.find('#outside-iframe').click(); // this will be executed outside the iframe\n\n// You can also give it a selector to find elements inside of a specific iframe\ncy.iframe('#my-frame').find('.some-button').should('be.visible').click();\ncy.iframe('#my-second-frame').contains('Some hidden element').should('not.be.visible');\n```\n\n### `enter`\n\nThis can be used to execute a group of commands within an iframe\n\nExample:\n\n```js\n// This will verify that the iframe is loaded to any page other than 'about:blank'\ncy.enter().then((getBody) =\u003e {\n  getBody().find('.some-button').should('be.visible').click();\n  getBody().contains('Some hidden element').should('not.be.visible');\n});\n\n// You can also give it a selector to find elements inside of a specific iframe\ncy.enter('#my-iframe').then((getBody) =\u003e {\n  getBody().find('.some-button').should('be.visible').click();\n  getBody().contains('Some hidden element').should('not.be.visible');\n});\n```\n\n## Caveat\n\nCypress does not take snapshots of dom state inside of iframes. Therefore, even if you are using this library, in your\ntests, when you hover over commands executed within an iframe, a placeholder will be displayed rather than the actual\ncontents of the iframe when the command was executed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepsquare-io%2Fcypress-iframe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeepsquare-io%2Fcypress-iframe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepsquare-io%2Fcypress-iframe/lists"}