{"id":28089516,"url":"https://github.com/songyu-wang/cypress-plugin-playwright","last_synced_at":"2025-05-13T12:59:25.603Z","repository":{"id":59019839,"uuid":"535008716","full_name":"Songyu-Wang/cypress-plugin-playwright","owner":"Songyu-Wang","description":"This Cypress plugin allows you to run playwright code within cypress runner","archived":false,"fork":false,"pushed_at":"2022-10-31T22:49:56.000Z","size":86,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-19T06:20:20.388Z","etag":null,"topics":["cypress","e2e","javascript","playwright","test-automation","testing"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/cypress-plugin-playwright","language":"JavaScript","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/Songyu-Wang.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":"2022-09-10T13:37:03.000Z","updated_at":"2025-01-10T14:24:41.000Z","dependencies_parsed_at":"2023-01-20T16:34:45.236Z","dependency_job_id":null,"html_url":"https://github.com/Songyu-Wang/cypress-plugin-playwright","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Songyu-Wang%2Fcypress-plugin-playwright","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Songyu-Wang%2Fcypress-plugin-playwright/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Songyu-Wang%2Fcypress-plugin-playwright/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Songyu-Wang%2Fcypress-plugin-playwright/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Songyu-Wang","download_url":"https://codeload.github.com/Songyu-Wang/cypress-plugin-playwright/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253948407,"owners_count":21988953,"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","e2e","javascript","playwright","test-automation","testing"],"created_at":"2025-05-13T12:59:24.870Z","updated_at":"2025-05-13T12:59:25.593Z","avatar_url":"https://github.com/Songyu-Wang.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cypress-plugin-playwright\n\nWarning ⚠️: This repo is mainly used for POC. It lacks so many utilities. Do not attempt to use it directly as it is. \nIt is possible that I may come back to this and redo this the right way, but I highly doubt it. \n\nThis Cypress plugin allows you to run playwright code within the cypress runner using the same chromium-family instance started by cypress. It is inspired by https://github.com/microsoft/playwright/issues/17056 to work around some cypress limitations and awkward ideologies \n\nThis plugin does not assume your cypress and/or playwright versions. Install them separately\n\nIf you are using `cypress\u003c10.0.0`, you will have to reverse migrate the code below,\nsee https://docs.cypress.io/guides/references/migration-guide#Migrating-to-Cypress-version-10-0\n\n## Install\n\n```\nnpm i cypress-plugin-playwright\n```\n\n```javascript\n// cypress.config.js\n\n\nimport {defineConfig} from 'cypress';\nimport playwrightPlugin from \"cypress-plugin-playwright/playwrightPlugin.js\";\n\nexport default defineConfig({\n    // ...\n    e2e: {\n        setupNodeEvents(on, config) {\n            // ...\n            playwrightPlugin(on, config);\n            // ...\n        },\n        // ...\n    },\n    // ...\n});\n```\n\n## Test Example\n\nBelow demonstrated a mixed it block with cypress and playwright.\nIf you are using this plugin seriously, you probably want to add a wrapper to the `cy.task()` to simplify the syntax\n\n```javascript\n// test.cy.js\n\ndescribe('Run Playwright code with Cypress', () =\u003e {\n    it('passes', () =\u003e {\n        cy.visit('https://example.cypress.io');\n\n        async function playwrightCodeBlock(frame) {\n            const locator = frame.locator('a:has-text(\"screenshot\")');\n            await locator.scrollIntoViewIfNeeded();\n            await locator.click();\n        }\n\n        // Unfortunately the `toString()` is needed\n        cy.task('runPlaywright', playwrightCodeBlock.toString());\n\n        cy.url().should('contain', 'misc');\n        cy.get('body').should('contain', 'cypress/screenshots/my-image.png');\n        cy.get('body').contains('cy.focused()').click();\n        cy.get('body').contains('Get the DOM element that is currently focused.').should('exist');\n    });\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsongyu-wang%2Fcypress-plugin-playwright","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsongyu-wang%2Fcypress-plugin-playwright","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsongyu-wang%2Fcypress-plugin-playwright/lists"}