Remove some unused data-testids in Vue files
What does this MR do and why?
I used a script to help me find the unused testids and remove them. Unfortunately, I had to add some exceptions, some testids that are generated dynamically and cannot be found like this. I don't think we will be able to automate a check for this just yet (e.g. in our pipeline).
I leave my script for future reference, in case we want to automate a check for dangling testids later on:
#!/bin/bash
for match in $(rg "data-testid=[\"']([a-z0-9_-]+)[\"']" -or '$1' -g *.vue | sort -u)
do
file=$(echo $match | cut -f1 -d:)
testid=$(echo $match | cut -f2 -d:)
if ! rg -q $testid spec/frontend ee/spec/frontend spec/frontend_integration ee/spec/frontend_integration ee/spec spec/features ee/spec/features spec/support ee/spec/support qa/qa; then
echo "Removing $testid from $file"
sed -i '' "s/data-testid=\"$testid\"//g" $file
yarn prettier $file -w
fi
done
# some exceptions
git checkout app/assets/javascripts/ci/pipeline_editor/components/lint/ci_lint_results.vue
git checkout app/assets/javascripts/ci/pipeline_editor/components/lint/ci_lint_results_value.vue
git checkout app/assets/javascripts/ci/pipeline_editor/components/lint/ci_lint_results_param.vue
git checkout ee/app/assets/javascripts/analytics/cycle_analytics/components/value_stream_select.vue
git checkout ee/app/assets/javascripts/analytics/group_ci_cd_analytics/components/app.vue
git checkout ee/app/assets/javascripts/security_dashboard/components/shared/vulnerability_details_graphql/index.vue
git checkout app/assets/javascripts/projects/settings/components/access_dropdown.vue
git checkout app/assets/javascripts/diffs/components/diff_row.vue
git checkout app/assets/javascripts/admin/abuse_report/components/report_actions.vue
git checkout ee/app/assets/javascripts/on_demand_scans/components/tabs/saved.vue
git checkout app/assets/javascripts/ide/components/activity_bar.vue
Screenshots or screen recordings
NA
How to set up and validate locally
NA
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Miguel Rincon