1import{gG as e,gH as v,a as s,j as n,gI as d,ag as y,gJ as C,gK as R,gL as p,gM as I,gN as h,gO as E,gP as k,es as _,gQ as x}from"./index-BFa3nKuT.js";import{a as D}from"./datepicker-CN3oO0F6.js";import"./visx-o561FtCw.js";import"./framerMotion-KnKeNhwd.js";import"./charts-BEfaN6Tb.js";import"./apollo-B9xYJgZj.js";import"./shiki-DSW_v8w1.js";import"./betterAuth-wecmey9t.js";import"./tanstack-82Oensom.js";import"./virtuoso-_8EeKo1c.js";import"./sentry-BM1d0HPc.js";import"./forms-BE_8TKCw.js";import"./amplitude-rTYtQKJT.js";import"./amplify-FijOe782.js";import"./qrcode-CMNUHY9J.js";import"./dnd-BjCurfON.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"01e610d75577dcaf5e5c9af84e79c9458f58a767"},t._sentryModuleMetadata=t._sentryModuleMetadata||{},t._sentryModuleMetadata[new t.Error().stack]=(function(i){for(var o=1;o<arguments.length;o++){var a=arguments[o];if(a!=null)for(var c in a)a.hasOwnProperty(c)&&(i[c]=a[c])}return i})({},t._sentryModuleMetadata[new t.Error().stack],{"_sentryBundlerPluginAppKey:currents-dashboard":!0});var r=new t.Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="e8ee522f-cfb3-4883-b6c9-82522fb0885f",t._sentryDebugIdIdentifier="sentry-dbid-e8ee522f-cfb3-4883-b6c9-82522fb0885f")}catch{}})();const U=()=>`name: Run Playwright Tests 2on: 3 pull_request: 4 branches: [main] 5jobs: 6 run-tests: 7 name: "Playwright Tests" 8 timeout-minutes: 30 9 runs-on: ubuntu-latest 10 container: mcr.microsoft.com/playwright:latest 11 12 steps: 13 - uses: actions/checkout@v4 14 15 - name: Install dependencies 16 run: npm ci 17 18 - name: Playwright Tests 19 continue-on-error: false 20 env: 21 CURRENTS_RECORD_KEY: \${{ secrets.CURRENTS_RECORD_KEY }} 22 run: npx playwright test 23`,N=()=>"env:\n CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }}",j=()=>`default: 24 image: mcr.microsoft.com/playwright:latest 25 26stages: 27 - test 28 29test: 30 image: mcr.microsoft.com/playwright:latest 31 stage: test 32 33 script: 34 - npm ci 35 - npx playwright test 36`,S=()=>`version: 2.1 37jobs: 38 run-test: 39 docker: 40 - image: mcr.microsoft.com/playwright:latest 41 steps: 42 - checkout 43 - run: npm ci 44 - run: 45 name: Run tests 46 # CURRENTS_RECORD_KEY is available from project environment variables 47 command: npx playwright test 48 49# Invoke jobs via workflows 50workflows: 51 run-test-workflow: 52 jobs: 53 - run-test: 54 # Use "currents" CircleCI context to enable access to secrets 55 context: currents 56`,$=()=>`pipeline { 57 agent { 58 docker { 59 image 'mcr.microsoft.com/playwright:latest' 60 } 61 } 62 63 stages { 64 stage('build') { 65 steps { 66 echo "Running build \${env.BUILD_ID} on \${env.JENKINS_URL}
66" 67 echo "Installing dependencies..." 68 sh 'npm ci' 69 } 70 } 71 72 stage('Playwright parallel tests') { 73 environment { 74 // See https://jenkins.io/doc/book/using/using-credentials/ 75 CURRENTS_RECORD_KEY = credentials('CURRENTS_RECORD_KEY') 76 } 77 78 // Run parallel workers, see: 79 // https://jenkins.io/doc/book/pipeline/syntax/#parallel 80 parallel { 81 // each worker is running the same command, 82 stage('tester A') { 83 steps { 84 echo "Running build \${env.BUILD_ID}" 85 sh "npx playwright test --shard 1/2 --output test-results/shard-1" 86 } 87 } 88 89 // second tester runs the same command 90 stage('tester B') { 91 steps { 92 echo "Running build \${env.BUILD_ID}" 93 sh "npx playwright test --shard 2/2 --output test-results/shard-2" 94 } 95 } 96 } 97 98 } 99 } 100} 101`,O=()=>`version: 0.2 102 103batch: 104 fast-fail: false 105 build-matrix: 106 dynamic: 107 buildspec: 108 - buildspec.yml 109 env: 110 variables: 111 WORKER: 112 - 1 113 - 2 114 - 3 115 116phases: 117 install: 118 runtime-versions: 119 nodejs: 22 120 commands: 121 # install playwright and its dependencies 122 - npm ci 123 - npx playwright install 124 - npx playwright install-deps 125 126 build: 127 commands: 128 # update shard details according to the overall # of containers 129 - npx playwright test --shard $WORKER/3 130`,K=()=>`trigger: 131- main 132 133jobs: 134- job: pwcTests 135 displayName: Playwright Tests - pwc 136 strategy: 137 matrix: 138 chromium-1: 139 project: chromium 140 shard: 1/3 141 chromium-2: 142 project: chromium 143 shard: 2/3 144 chromium-3: 145 project: chromium 146 shard: 3/3 147 pool: 148 vmImage: ubuntu-latest 149 150 container: mcr.microsoft.com/playwright:latest 151 variables: 152 - name: npm_config_cache 153 value: $(Pipeline.Workspace)/.npm 154 155 # You can use a variable group to store the CURRENTS_RECORD_KEY secret 156 - group: currents-settings 157 steps: 158 # Speed up the execution by caching the dependencies 159 # https://docs.microsoft.com/en-us/azure/devops/pipelines/caching/?view=azure-devops 160 - task: Cache@2 161 inputs: 162 key: 'npm | "$(Agent.OS)" | package-lock.json' 163 restoreKeys: | 164 npm | "$(Agent.OS)" 165 path: $(npm_config_cache) 166 displayName: Cache npm 167 168 # Install Node dependencies 169 - script: npm ci 170 displayName: 'Install Dependencies' 171 172 - script: npx playwright test --shard=$(shard) 173 displayName: 'Run Playwright Tests' 174 env: 175 CI: 'true' 176 CURRENTS_RECORD_KEY: $(CURRENTS_RECORD_KEY) 177`,w=t=>t===e.githubActions?U():t===e.gitlab?j():t===e.circleCI?S():t===e.jenkins?$():t===e.awsCodeBuild?O():t===e.azure?K():"",T=t=>t===e.githubActions?N():"",B=(t,r)=>({playwright:{[e.githubActions]:"https://docs.currents.dev/getting-started/ci-setup/github-actions/playwright-github-actions",[e.gitlab]:"https://docs.currents.dev/getting-started/ci-setup/gitlab/playwright-gitlab-ci-cd",[e.circleCI]:"https://docs.currents.dev/getting-started/ci-setup/playwright-circleci",[e.jenkins]:"https://docs.currents.dev/getting-started/ci-setup/jenkins",[e.azure]:"https://docs.currents.dev/getting-started/ci-setup/playwright-azure-devops",[e.awsCodeBuild]:"https://docs.currents.dev/getting-started/ci-setup/playwright-aws-code-build"},cypress:{[e.githubActions]:"https://docs.currents.dev/getting-started/ci-setup/github-actions/cypress-github-actions",[e.gitlab]:"https://docs.currents.dev/getting-started/ci-setup/gitlab/cypress-gitlab-ci-cd",[e.circleCI]:"https://docs.currents.dev/getting-started/ci-setup/circleci/cypress-circleci",[e.jenkins]:"https://docs.currents.dev/getting-started/ci-setup/jenkins/cypress-jenkins",[e.azure]:"https://docs.currents.dev/getting-started/ci-setup/azure-devops/cypress-azure-devops",[e.awsCodeBuild]:"https://docs.currents.dev/getting-started/ci-setup/aws-code-build/cypress-aws-code-build"},jest:{[e.githubActions]:"https://docs.currents.dev/getting-started/ci-setup/github-actions/jest-github-actions",[e.gitlab]:"https://docs.currents.dev/getting-started/ci-setup/gitlab",[e.circleCI]:"https://docs.currents.dev/getting-started/ci-setup/circleci",[e.jenkins]:"https://docs.currents.dev/getting-started/ci-setup/jenkins",[e.azure]:"https://docs.currents.dev/getting-started/ci-setup/azure-devops",[e.awsCodeBuild]:"https://docs.currents.dev/getting-started/ci-setup/aws-code-build"},vitest:{[e.githubActions]:"https://docs.currents.dev/getting-started/ci-setup/github-actions",[e.gitlab]:"https://docs.currents.dev/getting-started/ci-setup/gitlab",[e.circleCI]:"https://docs.currents.dev/getting-started/ci-setup/circleci",[e.jenkins]:"https://docs.currents.dev/getting-started/ci-setup/jenkins",[e.azure]:"https://docs.currents.dev/getting-started/ci-setup/azure-devops",[e.awsCodeBuild]:"https://docs.currents.dev/getting-started/ci-setup/aws-code-build"},node:{[e.githubActions]:"https://docs.currents.dev/getting-started/ci-setup/github-actions/node-github-actions",[e.gitlab]:"https://docs.currents.dev/getting-started/ci-setup/gitlab",[e.circleCI]:"https://docs.currents.dev/getting-started/ci-setup/circleci",[e.jenkins]:"https://docs.currents.dev/getting-started/ci-setup/jenkins",[e.azure]:"https://docs.currents.dev/getting-started/ci-setup/azure-devops",[e.awsCodeBuild]:"https://docs.currents.dev/getting-started/ci-setup/aws-code-build"},postman:{[e.githubActions]:"https://docs.currents.dev/getting-started/ci-setup/github-actions",[e.gitlab]:"https://docs.currents.dev/getting-started/ci-setup/gitlab",[e.circleCI]:"https://docs.currents.dev/getting-started/ci-setup/circleci",[e.jenkins]:"https://docs.currents.dev/getting-started/ci-setup/jenkins",[e.azure]:"https://docs.currents.dev/getting-started/ci-setup/azure-devops",[e.awsCodeBuild]:"https://docs.currents.dev/getting-started/ci-setup/aws-code-build"}})[t][r],Y=t=>{switch(t){case e.githubActions:return".github/workflows/ci.yml";case e.gitlab:return".gitlab-ci.yml";case e.circleCI:return".circleci/config.yml";case e.jenkins:return"Jenkinsfile";case e.azure:return"azure-pipelines.yml";case e.awsCodeBuild:return"buildspec.yml";default:throw new Error(`Unhandled CI provider: ${t}`)}},A=t=>{switch(t){case e.githubActions:return"env:\n CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }}";case e.gitlab:return"variables:\n CURRENTS_RECORD_KEY: ${CURRENTS_RECORD_KEY}";case e.circleCI:return`environment: 178 # CURRENTS_RECORD_KEY is automatically available from project environment variables`;case e.jenkins:return`environment { 179 CURRENTS_RECORD_KEY = credentials('CURRENTS_RECORD_KEY') 180}`;case e.azure:return`variables:
181 - group: currents-settings # Contains CURRENTS_RECORD_KEY`;case e.awsCodeBuild:return`env: 182 # CURRENTS_RECORD_KEY should be set in CodeBuild project environment variables`;default:throw new Error(`Unhandled CI provider: ${t}`)}},L=t=>{switch(t){case"playwright":return`Make sure you have completed the local setup first: 183- Installed @currents/playwright package as a dev dependency 184- Updated playwright.config.ts with currentsReporter() 185- Created currents.config.ts file`;case"cypress":return`Make sure you have completed the local setup first: 186- Installed cypress-cloud package as a dev dependency 187- Created currents.config.js file 188- Updated cypress.config.ts with cloudPlugin 189- Added cypress-cloud/support to support file 190- Installed alternative Cypress binaries`;case"jest":return`Make sure you have completed the local setup first: 191- Installed @currents/jest and @currents/cmd packages as dev dependencies 192- Configured Jest with Currents reporter`;case"vitest":return`Make sure you have completed the local setup first: 193- Installed @currents/cmd package as a dev dependency 194- Configured vitest.config.ts with JUnit reporter`;case"node":return`Make sure you have completed the local setup first: 195- Installed @currents/node-test-reporter and @currents/cmd packages as dev dependencies`;case"postman":return`Make sure you have completed the local setup first: 196- Installed @currents/cmd and newman packages as dev dependencies 197- Have your Postman collection file ready`;default:throw new Error(`Unhandled framework: ${t}`)}},z=(t,r)=>{if(r!=="cypress")return"";switch(t){case e.githubActions:return"\nFor Cypress, use GitHub Actions run ID as CI build ID:\n```yaml\nenv:\n CI_BUILD_ID: ${{ github.run_id }}-${{ github.run_attempt }}\n```";case e.gitlab:return"\nFor Cypress, use GitLab CI pipeline ID as CI build ID:\n```yaml\nvariables:\n CI_BUILD_ID: ${CI_PIPELINE_ID}\n```";case e.circleCI:return"\nFor Cypress, use CircleCI workflow ID as CI build ID:\n```yaml\nenvironment:\n CI_BUILD_ID: << pipeline.id >>\n```";case e.jenkins:return'\nFor Cypress, use Jenkins build ID:\n```groovy\nenvironment {\n CI_BUILD_ID = "${env.BUILD_ID}"\n}\n```';case e.azure:return"\nFor Cypress, use Azure DevOps build ID:\n```yaml\nvariables:\n - name: CI_BUILD_ID\n value: $(Build.BuildId)\n```";case e.awsCodeBuild:return"\nFor Cypress, use AWS CodeBuild ID:\n```yaml\nenv:\n variables:\n CI_BUILD_ID: ${CODEBUILD_BUILD_ID}\n```";default:throw new Error(`Unhandled CI provider: ${t}`)}},M=t=>{switch(t){case"playwright":return"";case"cypress":return"3. Update the test command to use cypress-cloud:\n\n```bash\nnpx cypress-cloud run --parallel --record --key $CURRENTS_RECORD_KEY --ci-build-id $CI_BUILD_ID\n```\n\n";case"jest":return"3. Update the test step to run Jest with Currents reporter and upload results:\n\n```bash\nnpx jest --reporters=@currents/jest --reporters=default && npx currents upload --key=$CURRENTS_RECORD_KEY\n```\n\n";case"vitest":return"3. Update the test step to run Vitest with JUnit output and upload results:\n\n```bash\nnpx vitest --outputFile.junit=./results.xml && npx currents convert --input-format=junit --input-file=./results.xml --framework=vitest && npx currents upload --key=$CURRENTS_RECORD_KEY\n```\n\n";case"node":return"3. Update the test step to run Node.js tests with reporter and upload results:\n\n```bash\nnode --test --test-reporter @currents/node-test-reporter --test-reporter-destination=./report.xml **.test.mjs && npx currents convert --input-format=junit --input-file=./report.xml --framework=node && npx currents upload --key=$CURRENTS_RECORD_KEY\n```\n\n";case"postman":return"3. Update the test step to run Newman with JUnit output and upload results:\n\n```bash\nnpx newman run ./collection.json -r cli,junit --reporter-junit-export ./results.xml && npx currents convert --input-format=junit --input-file=./results.xml --framework=postman && npx currents upload --key=$CURRENTS_RECORD_KEY\n```\n\n";default:throw new Error(`Unhandled framework: ${t}`)}},W=t=>{switch(t){case"playwright":return`3. Verify your changes: 198- Ensure the original \`npx playwright test\` command remains unchanged 199- Only the environment variable should be added to the workflow 200- Do not modify any other parts of the workflow file`;case"cypress":return`4. Verify your changes: 201- Ensure the test command uses cypress-cloud with the correct flags 202- Only the environment variables and test command should be modified 203- Do not modify any other parts of the workflow file`;case"jest":return`4. Verify your changes: 204- Ensure the original jest configuration remains intact 205- Only the environment variable and test command should be modified 206- Do not modify any other parts of the workflow file`;case"vitest":return`4. Verify your changes: 207- Ensure the original vitest configuration remains intact 208- Only the environment variable and test command should be modified 209- Do not modify any other parts of the workflow file`;case"node":return`4. Verify your changes: 210- Ensure the original node test configuration remains intact 211- Only the environment variable and test command should be modified 212- Do not modify any other parts of the workflow file`;case"postman":return`4. Verify your changes: 213- Ensure the original newman configuration remains intact 214- Only the environment variable and test command should be modified 215- Do not modify any other parts of the workflow file`;default:throw new Error(`Unhandled framework: ${t}`)}},V=(t,r)=>{const i=v[r],o=Y(r),a=A(r),c=L(t),u=z(r,t),l=M(t),g=W(t),m=B(t,r),f=w(r),b=f?` 216 217 If no workflow file exists, create one at \`${o}\` using this template as a starting point, then adapt the install and test-command steps to match the project (e.g., replace \`npx playwright test\` with the ${t}
217 test command) before continuing: 218 219\`\`\` 220${f}\`\`\` 221`:"";return`Your task is to update or create a ${i} CI workflow to report ${t} test results to Currents.dev 222 223Prerequisites: 224${c} 225 226Reference documentation: ${m} 227 228Instructions: 229 2301. Locate the CI workflow file that runs ${t} tests (e.g., ${o} or similar).${b} 231 2322. Add the CURRENTS_RECORD_KEY environment variable to your workflow: 233 234\`\`\` 235${a} 236\`\`\` 237${u} 238 239${l}${g}`},F=({ciProvider:t,recordKey:r,framework:i,aiMode:o})=>{const[a,c]=D.useState(!1),u=v[t],l=(g=!1)=>`CURRENTS_RECORD_KEY=${g?r:k(r)}`;return s("div",{className:"space-y-ui-v2-4 flex flex-col gap-6",children:n("div",{className:"flex flex-col gap-6",children:[n("div",{className:"flex flex-col gap-ui-v2-4",children:[n("span",{className:"text-sm flex items-baseline gap-2",children:[s(d,{step:1}),n("span",{children:["Add the record key below as a secret in"," ",s(y,{target:"_blank",icon:!0,href:C[t],children:u}),". Use the name ",s("code",{children:"CURRENTS_RECORD_KEY"})," so the workflow can use it."]})]}),s("div",{className:"ml-8",children:n(R,{code:l(a),copyValue:l(!0),language:"bash",children:[s(p,{}),s(I,{isRevealed:a,onToggle:()=>c(!a)})]})})]}),o&&n("div",{className:"flex flex-col gap-ui-v2-4",children:[n("span",{className:"text-sm flex items-baseline gap-2",children:[s(d,{step:2}),"Share these instructions with your AI assistant to update your CI workflow."]}),s("div",{className:"ml-8",children:s(h,{code:V(i,t),language:"markdown",filename:"Prompt",maxHeight:"max-h-[180px]",collapsible:!0,wrap:!0,children:s(p,{})})})]}),!o&&n("div",{className:"flex flex-col gap-ui-v2-4",children:[n("span",{className:"text-sm flex items-baseline gap-2",children:[s(d,{step:2}),n("span",{children:["Add environment variables to your existing ",u," ","workflow."]})]}),n("div",{className:"ml-8 flex flex-col gap-ui-v2-4",children:[t===e.githubActions&&s(h,{code:T(t),language:"yaml",filename:"Environment variables",wrap:!0,children:s(p,{})}),s("span",{className:"text-sm text-theme-secondary",children:"Complete workflow example"}),s(h,{code:w(t),language:"yaml",filename:"ci.yml",maxHeight:"max-h-[100px]",collapsible:!0,wrap:!0,children:s(p,{})}),n("span",{className:"text-sm text-theme-secondary",children:["More examples (parallelization, matrix):"," ",s(y,{color:!1,icon:!0,target:"_blank",href:E(i)[t],children:"View docs and examples"})]})]})]}),n("div",{className:"flex flex-col gap-ui-v2-4",children:[n("span",{className:"text-sm flex items-baseline gap-2",children:[s(d,{step:3}),s("span",{children:"Commit your changes and push to trigger a CI run."})]}),s("div",{className:"ml-8",children:s("span",{className:"text-sm",children:"Your test results will appear in Currents automatically once the workflow runs."})})]})]})})},ce=({ciProvider:t,orgId:r,framework:i,aiMode:o})=>{var l;const a=_(),[c]=x(r,{skip:a}),u=((l=c[0])==null?void 0:l.recordKey)??"<key>";return s(F,{ciProvider:t,recordKey:u,framework:i,aiMode:o})};export{ce as SetupCI,ce as default}; 240//# sourceMappingURL=setupCI-Bs6xljsu.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.