Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
name: E2E Tests
description: Runs e2e tests.
name: Internal Tests
description: Runs internal tests.
inputs:
test_dimensions:
description: "Test dimensions JSON string."
default: "{}"
test_targets:
description: "Test targets."
required: true
e2e_test_targets:
description: "E2E test targets."
test_type:
description: "Test type (e.g. e2e_test or yts_test)"
required: true
artifact_name:
description: "The name of the artifact to be used for E2E tests (e.g., Cobalt.apk)."
description: "The name of the artifact to be used for tests (e.g., Cobalt.apk)."
default: "Cobalt.apk"
test_attempts:
description: "Number of attempts for the tests."
Expand Down Expand Up @@ -53,7 +56,7 @@ runs:
GITHUB_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
GITHUB_WORKFLOW: ${{ github.workflow }}
TEST_ATTEMPTS: ${{ inputs.test_attempts }}
TEST_TYPE: e2e_test
TEST_TYPE: ${{ inputs.test_type }}
TEST_RETRY_LEVEL: FAIL
run: |
set -x
Expand All @@ -62,7 +65,7 @@ runs:
--token ${GITHUB_TOKEN} \
trigger \
--test_type ${TEST_TYPE} \
--targets '${{ inputs.e2e_test_targets }}' \
--targets '${{ inputs.test_targets }}' \
--retry_level ${TEST_RETRY_LEVEL} \
--label ${TEST_TYPE} \
--label github_${GITHUB_PR_NUMBER:-postsubmit} \
Expand Down
27 changes: 27 additions & 0 deletions .github/config/android-arm.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"test_on_device": true,
"test_device_family": "android",
"test_e2e": true,
"test_yts": true,
"test_root_target": "//cobalt/android:cobalt_apk",
"test_attempts": "3",
"e2e_test_targets": [
Expand All @@ -31,6 +32,32 @@
"test_attempts": "6"
}
],
"yts_test_targets": [
{
"target": "testing/maneki/cobalt/kimono_tests:yts_dom_document_sabrina_custom_test",
"test_attempts": "6"
},
{
"target": "testing/maneki/cobalt/kimono_tests:yts_html_dom_element_sabrina_custom_test",
"test_attempts": "6"
},
{
"target": "testing/maneki/cobalt/kimono_tests:yts_dom_document_kirkwood_custom_test",
"test_attempts": "6"
},
{
"target": "testing/maneki/cobalt/kimono_tests:yts_html_dom_element_kirkwood_custom_test",
"test_attempts": "6"
},
{
"target": "testing/maneki/cobalt/kimono_tests:yts_dom_document_boreal_custom_test",
"test_attempts": "6"
},
{
"target": "testing/maneki/cobalt/kimono_tests:yts_html_dom_element_boreal_custom_test",
"test_attempts": "6"
}
],
"test_dimensions": {
"device_type": "arm_devices",
"device_pool": "maneki"
Expand Down
11 changes: 11 additions & 0 deletions .github/config/android-arm64.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"test_on_device": true,
"test_device_family": "android",
"test_e2e": true,
"test_yts": true,
"test_root_target": "//cobalt/android:cobalt_apk",
"test_dimensions": {
"device_type": "nvidia_shield",
Expand All @@ -21,6 +22,16 @@
"test_attempts": "6"
}
],
"yts_test_targets": [
{
"target": "testing/maneki/cobalt/kimono_tests:yts_dom_document_shield_custom_test",
"test_attempts": "6"
},
{
"target": "testing/maneki/cobalt/kimono_tests:yts_html_dom_element_shield_custom_test",
"test_attempts": "6"
}
],
"includes": [
{
"name": "arm64",
Expand Down
56 changes: 51 additions & 5 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@
set -x
test_e2e=$(cat ${GITHUB_WORKSPACE}/.github/config/${{ inputs.platform }}.json | jq -rc '.test_e2e')
echo "test_e2e=${test_e2e}" >> $GITHUB_OUTPUT
- name: Set YTS tests
id: set-test-yts
shell: bash
run: |
set -x
test_yts=$(cat ${GITHUB_WORKSPACE}/.github/config/${{ inputs.platform }}.json | jq -rc '.test_yts')
echo "test_yts=${test_yts}" >> $GITHUB_OUTPUT
- name: Set web tests
id: set-web-tests
shell: bash
Expand All @@ -165,6 +172,13 @@
set -x
test_device_family=$(cat ${GITHUB_WORKSPACE}/.github/config/${{ inputs.platform }}.json | jq -rc '.test_device_family // empty')
echo "test_device_family=${test_device_family}" >> $GITHUB_OUTPUT
- name: Set YTS test targets
id: set-yts-test-targets
shell: bash
run: |
set -x
yts_test_targets=$(cat ${GITHUB_WORKSPACE}/.github/config/${{ inputs.platform }}.json | jq -cr '.yts_test_targets // []')
echo "yts_test_targets=${yts_test_targets}" >> $GITHUB_OUTPUT
- name: Set E2E test targets
id: set-e2e-test-targets
shell: bash
Expand Down Expand Up @@ -224,9 +238,11 @@
test_on_device: ${{ steps.set-test-on-device.outputs.test_on_device }}
test_package: ${{ steps.set-test-package.outputs.test_package }}
test_e2e: ${{ steps.set-test-e2e.outputs.test_e2e }}
test_yts: ${{ steps.set-test-yts.outputs.test_yts }}
web_tests: ${{ steps.set-web-tests.outputs.web_tests }}
test_root_target: ${{ steps.set-test-root-target.outputs.test_root_target }}
test_device_family: ${{ steps.set-test-device-family.outputs.test_device_family }}
yts_test_targets: ${{ steps.set-yts-test-targets.outputs.yts_test_targets }}
e2e_test_targets: ${{ steps.set-e2e-test-targets.outputs.e2e_test_targets }}
e2e_test_attempts: ${{ steps.set-e2e-test-attempts.outputs.e2e_test_attempts }}
test_dimensions: ${{ steps.set-test-dimensions.outputs.test_dimensions }}
Expand Down Expand Up @@ -365,7 +381,7 @@
test_targets_json_file: out/${{ matrix.platform }}_${{ matrix.config }}/test_targets.json

- name: Release Package
if: (matrix.config == 'qa' || matrix.config == 'gold') && (needs.initialize.outputs.test_package == 'true' || needs.initialize.outputs.test_e2e == 'true')
if: (matrix.config == 'qa' || matrix.config == 'gold') && (needs.initialize.outputs.test_package == 'true' || needs.initialize.outputs.test_e2e == 'true' || needs.initialize.outputs.test_yts == 'true')
uses: ./cobalt/src/.github/actions/package
with:
package_dir: out/test-package
Expand All @@ -376,7 +392,7 @@
test_artifacts_key: ${{ env.TEST_ARTIFACTS_KEY }}
upload_on_host_test_artifacts: ${{ matrix.config == 'devel' && (needs.initialize.outputs.test_on_host == 'true' || needs.initialize.outputs.web_tests == 'true') }}
upload_on_device_test_artifacts: ${{ matrix.config == 'devel' && needs.initialize.outputs.test_on_device == 'true' }}
upload_e2e_test_artifacts: ${{ matrix.config == 'qa' && needs.initialize.outputs.test_e2e == 'true' }}
upload_e2e_test_artifacts: ${{ matrix.config == 'qa' && (needs.initialize.outputs.test_e2e == 'true' || needs.initialize.outputs.test_yts == 'true') }}
test_targets_json_file: out/${{ matrix.platform }}_${{ matrix.config }}/test_targets.json

- name: Run API Leak Detector
Expand Down Expand Up @@ -426,7 +442,7 @@

e2e-test:
needs: [initialize, build]
# Run E2E tests when on_device label is applied to PR.
# Run E2E tests for presumit.
# Also, run E2E tests on push and schedule if not explicitly disabled via repo vars.
if: |
needs.initialize.outputs.test_e2e == 'true' &&
Expand All @@ -448,12 +464,42 @@
- name: Checkout
uses: actions/checkout@v4
- name: Run E2E Tests
uses: ./.github/actions/e2e_tests
uses: ./.github/actions/internal_tests
with:
e2e_test_targets: '${{ needs.initialize.outputs.e2e_test_targets }}'
test_type: 'e2e_test'
test_targets: '${{ needs.initialize.outputs.e2e_test_targets }}'
test_attempts: '${{ needs.initialize.outputs.e2e_test_attempts }}'
test_dimensions: '${{ needs.initialize.outputs.test_dimensions }}'

yts-test:
needs: [initialize, build]
# Run YTS tests via presumit.
# Also, run YTS tests on push and schedule if not explicitly disabled via repo vars.
if: |
needs.initialize.outputs.test_yts == 'true' &&
(
(github.event_name == 'pull_request' && github.event.pull_request.draft == false ) ||
((inputs.nightly == 'true' || github.event_name == 'schedule') && vars.RUN_ODT_TESTS_ON_NIGHTLY != 'False') ||
(github.event_name == 'push' && vars.RUN_ODT_TESTS_ON_POSTSUBMIT != 'False')
)
runs-on: [self-hosted, odt-runner]
name: ${{ matrix.name }}_yts_tests
permissions: {}
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(needs.initialize.outputs.platforms) }}
include: ${{ fromJson(needs.initialize.outputs.includes) }}
config: [devel]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run YTS Tests
uses: ./.github/actions/internal_tests
with:
test_type: 'yts_test'
test_targets: '${{ needs.initialize.outputs.yts_test_targets }}'

on-host-test:
needs: [initialize, docker-unittest-image, build]
if: needs.initialize.outputs.test_on_host == 'true'
Expand Down
8 changes: 4 additions & 4 deletions cobalt/tools/on_device_tests_gateway_client.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def _process_test_requests(args: argparse.Namespace) -> List[Dict[str, Any]]:
files = _unit_test_files(args, target_name)
params = _unit_test_params(args, target_name, dir_on_device)

elif args.test_type == 'e2e_test':
elif args.test_type in ('e2e_test', 'yts_test'):
test_target = target_data['target']
test_attempts = target_data.get('test_attempts', '')
if test_attempts:
Expand Down Expand Up @@ -309,7 +309,7 @@ def main() -> int:
'--test_type',
type=str,
required=True,
choices=['unit_test', 'e2e_test'],
choices=['unit_test', 'e2e_test', 'yts_test'],
help='Type of test to run.',
)
trigger_args.add_argument(
Expand Down Expand Up @@ -409,9 +409,9 @@ def main() -> int:
args = parser.parse_args()

# TODO(b/428961033): Let argparse handle these checks as required arguments.
if args.test_type == 'e2e_test':
if args.test_type in ('e2e_test', 'yts_test'):
if not args.cobalt_path:
raise ValueError('--cobalt_path is required for e2e_test')
raise ValueError('--cobalt_path is required for e2e_test or yts_test')
elif args.test_type == 'unit_test':
if not args.device_family:
raise ValueError('--device_family is required for unit_test')
Expand Down
Loading