{"id":20511312,"url":"https://github.com/intility/cypress-msal","last_synced_at":"2025-04-13T22:42:12.076Z","repository":{"id":43818629,"uuid":"465784460","full_name":"intility/cypress-msal","owner":"intility","description":"A cypress plugin for projects using @azure/msal-browser.","archived":false,"fork":false,"pushed_at":"2023-10-20T07:29:11.000Z","size":312,"stargazers_count":16,"open_issues_count":2,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-27T13:01:54.147Z","etag":null,"topics":["azure-ad","cypress","e2e","msal","msal-browser","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/intility.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}},"created_at":"2022-03-03T15:51:44.000Z","updated_at":"2024-11-25T23:04:34.000Z","dependencies_parsed_at":"2024-11-15T20:35:41.105Z","dependency_job_id":"0e1cd10b-d913-4df7-aeee-f942588ccb30","html_url":"https://github.com/intility/cypress-msal","commit_stats":{"total_commits":23,"total_committers":3,"mean_commits":7.666666666666667,"dds":0.3913043478260869,"last_synced_commit":"bd358edd26a037e0f185de24d158c763a0758a4d"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intility%2Fcypress-msal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intility%2Fcypress-msal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intility%2Fcypress-msal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intility%2Fcypress-msal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/intility","download_url":"https://codeload.github.com/intility/cypress-msal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248794565,"owners_count":21162613,"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":["azure-ad","cypress","e2e","msal","msal-browser","testing"],"created_at":"2024-11-15T20:35:28.173Z","updated_at":"2025-04-13T22:42:12.025Z","avatar_url":"https://github.com/intility.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cimg src=\"https://avatars.githubusercontent.com/u/35199565\" width=\"124px\"/\u003e\u003cbr/\u003e\n  @intility/cypress-msal\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  A cypress plugin for projects using @azure/msal-browser. \n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/Intility/cypress-msal/actions\"\u003e\n    \u003cimg alt=\"pipeline\" src=\"https://github.com/Intility/cypress-msal/actions/workflows/publish.yml/badge.svg\" style=\"max-width:100%;\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@intility/cypress-msal\"\u003e\n    \u003cimg alt=\"package version\" src=\"https://img.shields.io/npm/v/@intility/cypress-msal?label=%40intility%2Fcypress-msal\" style=\"max-width:100%;\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## Installation\n\n```\nnpm install @intility/cypress-msal\n```\n\n## Usage\n\nRegister the package in `cypress/support/e2e.js`:\n\n```js\nimport \"@intility/cypress-msal/command\";\n```\n\nConfigure the login command, and add it as a task in `cypress.config.js`:\n\n```js\nimport { defineConfig } from \"cypress\"\nimport generateLogin from \"@intility/cypress-msal\"\n\nlet publicClientConfig = {\n  auth: {\n    clientId: \"APP_CLIENT_ID\",\n    authority: \"https://login.microsoftonline.com/TENANT_ID\",\n  },\n};\n\nlet requests = [\n  {\n    scopes: [\"User.Read\"],\n  },\n];\n\nlet login = generateLogin(publicClientConfig, requests);\n\nexport default defineConfig({\n  // ...other cypress settings here...\n  e2e: {\n    setupNodeEvents(on, config) {\n      // `on` is used to hook into various events Cypress emits\n      on(\"task\", {\n        // register a task named login which calls the generated login from @intility/cypress-msal\n        login,\n      });\n    }\n  }\n})\n```\n\nYou can now login by using the `login` command before running your tests.\n\n```js\nbefore(() =\u003e cy.login());\n```\n\n## Azure Configuration\n\nThe App registration needs to be a Public Application to be able to use the Device Code flow.\n\n## `generateLogin`\n\n### Syntax\n\n```js\nlet login = generateLogin(publicClientConfiguration, requests);\n```\n\n### Parameters\n\n#### `publicClientConfiguration`\n\nA [`Configuration`](https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_node.html#configuration) that will be used to initialize a [`PublicClientApplication`](https://azuread.github.io/microsoft-authentication-library-for-js/ref/classes/_azure_msal_node.publicclientapplication.html) from `@azure/msal-node`.\n\n#### `requests`\n\nAn array of Requests (`{ scopes: string[] }`) that will be used for [`acquireTokenByDeviceCode`](https://azuread.github.io/microsoft-authentication-library-for-js/ref/classes/_azure_msal_node.publicclientapplication.html#acquiretokenbydevicecode) and [`acquireTokenSilent`](https://azuread.github.io/microsoft-authentication-library-for-js/ref/classes/_azure_msal_node.publicclientapplication.html#acquiretokensilent).\n\n### Return value\n\nA task plugin named `login` that should be registered with `on(\"task\", { login })`.\n\n## `cy.login`\n\n### Syntax\n\n`cy.login()`\n\n### Return value\n\nA Promise that get resolves when all tokens are acquired and registered in `sessionStorage` to be used by `@azure/msal-browser`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintility%2Fcypress-msal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintility%2Fcypress-msal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintility%2Fcypress-msal/lists"}