Protecting a tag form instantiated twice when using vite

This bug was caught by an E2E test when using Vite only.

When loading with Vite, occasionally two elements are present: Screenshot_2024-01-17_at_14.47.54

Test metadata (don't modify)

Field Value
File URL qa/qa/specs/features/browser_ui/3_create/repository/protected_tags_spec.rb#L66
Filename qa/specs/features/browser_ui/3_create/repository/protected_tags_spec.rb
Description Create Repository tags when protected behaves like successful tag creation can be created by maintainer_user
Test level
Hash bb7d050e37978121db4cffa52291c7888265a5984
Duration 72.47 seconds
Expected duration < 240 seconds
Test case https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347928

Stack trace

Failure/Error: protected_tags.choose_access_level_role(role)

Capybara::Ambiguous:
  Ambiguous match, found 2 elements matching visible css "[data-testid=\"allowed-to-create-dropdown\"],[data-qa-selector=\"allowed-to-create-dropdown\"]" within #<Capybara::Node::Element tag="section" path="/HTML/BODY[1]/DIV[2]/DIV[2]/DIV[3]/MAIN[1]/DIV[3]/SECTION[2]">
Shared Example Group: "successful tag creation" called from ./qa/specs/features/browser_ui/3_create/repository/protected_tags_spec.rb:66

Screenshot

create_repository_tags_when_protected_behaves_like_successful_tag_creation_can_b_2024-01-16-06-26-02.542

Reports (2)

  1. 2024-01-16: https://gitlab.com/gitlab-org/gitlab/-/jobs/5936050581 (https://gitlab.com/gitlab-org/gitlab/-/pipelines/1139384969)
  2. 2024-01-17: https://gitlab.com/gitlab-org/gitlab/-/jobs/5944876994 (https://gitlab.com/gitlab-org/gitlab/-/pipelines/1140724665)
Edited by Jay McCure