diff --git a/spec/tooling/lib/tooling/mappings/js_to_system_specs_mappings_spec.rb b/spec/tooling/lib/tooling/mappings/js_to_system_specs_mappings_spec.rb
index 72e02547938986d2fb79158ff2335370ba045f5a..12a73480440a8cd47e7bca8f55957fccf7e24386 100644
--- a/spec/tooling/lib/tooling/mappings/js_to_system_specs_mappings_spec.rb
+++ b/spec/tooling/lib/tooling/mappings/js_to_system_specs_mappings_spec.rb
@@ -129,6 +129,20 @@
     it 'returns a singularized keyword based on the first folder the file is in' do
       expect(subject).to eq(%w[board query])
     end
+
+    context 'when the files are under the pages folder' do
+      let(:js_files) do
+        %w[
+          app/assets/javascripts/pages/boards/issue_board_filters.js
+          ee/app/assets/javascripts/pages2/queries/epic_due_date.query.graphql
+          ee/app/assets/javascripts/queries/epic_due_date.query.graphql
+        ]
+      end
+
+      it 'captures the second folder' do
+        expect(subject).to eq(%w[board pages2 query])
+      end
+    end
   end
 
   describe '#system_specs_for_edition' do
diff --git a/tooling/lib/tooling/mappings/js_to_system_specs_mappings.rb b/tooling/lib/tooling/mappings/js_to_system_specs_mappings.rb
index 365e466011b018327b01ab666182c757b6f246fe..e78ce266a32fdc103b1f08f21cc4d8bb5460bf5c 100644
--- a/tooling/lib/tooling/mappings/js_to_system_specs_mappings.rb
+++ b/tooling/lib/tooling/mappings/js_to_system_specs_mappings.rb
@@ -18,6 +18,7 @@ def initialize(js_base_folder: 'app/assets/javascripts', system_specs_base_folde
         @first_js_folder_extract_regexp = %r{
           (?:.*/)?             # Skips the GitLab edition (e.g. ee/, jh/)
           #{@js_base_folder}/  # Most likely app/assets/javascripts/
+          (?:pages/)?          # If under a pages folder, we capture the following folder
           ([\w-]*)             # Captures the first folder
         }x
       end