55 workflow_call :
66 inputs :
77 environment :
8- description : The relevant github environment (for secrets and variables)
8+ description : " The relevant github environment (for secrets and variables)"
99 required : true
1010 type : string
1111 workspace :
1717 required : false
1818 type : string
1919 test_type :
20- description : " The name of the type of test report that will be generated"
20+ description : " The name of the type of test report that will be generated (e.g., bdd, apim, ui)"
21+ required : false
22+ type : string
23+ api_name :
24+ description : " The name of the API to test (for APIM tests, e.g., dos-search)"
25+ required : false
26+ type : string
27+ apim_env :
28+ description : " The APIM environment to test (for APIM tests, e.g., internal-dev, internal-qa)"
2129 required : false
2230 type : string
2331 ref :
@@ -127,19 +135,21 @@ jobs:
127135 uses : actions/cache@v5
128136 with :
129137 path : ~/.asdf
130- key : asdf-${{ runner.os }}-${{ hashFiles('.tool-versions') }}
138+ key : asdf-${{ runner.os }}-${{ hashFiles('.tool-versions', 'tests/service_automation/.tool-versions' ) }}
131139
132140 - name : " Install tools from .tool-versions"
133141 if : steps.asdf-cache.outputs.cache-hit != 'true'
134142 uses : asdf-vm/actions/install@v4.0.1
135143
136144 - name : " Cache Poetry dependencies"
145+ id : poetry-cache
137146 uses : actions/cache@v5
138147 with :
139148 path : ~/.cache/pypoetry
140149 key : ${{ runner.os }}-poetry-${{ hashFiles('tests/service_automation/poetry.lock') }}
141150
142151 - name : " Cache Playwright browsers"
152+ id : playwright-cache
143153 uses : actions/cache@v5
144154 with :
145155 path : ~/.cache/ms-playwright
@@ -154,9 +164,27 @@ jobs:
154164 environment : ${{ inputs.environment }}
155165
156166 - name : " Install project"
167+ if : steps.asdf-cache.outputs.cache-hit != 'true' || steps.poetry-cache.outputs.cache-hit != 'true' || steps.playwright-cache.outputs.cache-hit != 'true'
157168 run : make install
158169 working-directory : " tests/service_automation"
159170
171+ - name : Authenticate with APIM
172+ if : inputs.test_type == 'apim'
173+ uses : ./.github/actions/authenticate-apim
174+ id : apim-auth
175+ with :
176+ api_name : ${{ inputs.api_name }}
177+ environment : ${{ inputs.environment }}
178+ aws_region : ${{ vars.AWS_REGION }}
179+
180+ - name : Get Apigee access token
181+ if : inputs.test_type == 'apim'
182+ uses : ./.github/actions/authenticate-apim-pytest
183+ with :
184+ api_name : ${{ inputs.api_name }}
185+ access_token : ${{ steps.apim-auth.outputs.access_token }}
186+ proxygen_base_url : ${{ secrets.PROXYGEN_URL }}
187+
160188 - name : Run ${{ inputs.test_tag }} service automation tests
161189 id : run-service_automation-tests
162190 uses : ./.github/actions/service-automation-test
@@ -166,6 +194,8 @@ jobs:
166194 workspace : ${{ inputs.workspace }}
167195 test_tag : ${{ inputs.test_tag }}
168196 test_type : ${{ inputs.test_type }}
197+ api_name : ${{ inputs.api_name }}
198+ apim_env : ${{ inputs.environment == 'dev' && 'internal-dev' || inputs.environment == 'test' && 'internal-qa' || inputs.environment }}
169199 commit_hash : ${{ inputs.commit_hash || github.sha }}
170200 ref : ${{ inputs.ref }}
171201
0 commit comments