Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 17, 2025

Problem

When users specified the same YAML file multiple times in the files array of config.yaml, only one instance was executed. This prevented users from creating business process flows that require executing the same test file at different stages.

For example, a user might want to:

  1. Execute login.yaml
  2. Execute some feature tests
  3. Execute login.yaml again to verify session state

Previously, this config would only execute login.yaml once:

files:
  - './testScripts/00-login.yaml'
  - './testScripts/01-check-devinfo.yaml'
  - './testScripts/02-fastset-ap.yaml'
  - './testScripts/00-login.yaml'  # This was being ignored

Root Cause

The expandFilePatterns function in packages/cli/src/config-factory.ts used a Set to track seen files and skip duplicates. This deduplication logic prevented intentional duplicate file specifications from being executed.

Solution

Removed the Set-based deduplication logic to allow all file entries to be preserved in the execution order. Each pattern in the files array is now evaluated independently, and files can appear multiple times in the final execution list.

Changes

  • packages/cli/src/config-factory.ts: Removed seenFiles Set and simplified the file collection loop to preserve all matched files
  • packages/cli/tests/unit-test/config-factory.test.ts:
    • Added test case to verify duplicate file preservation
    • Updated existing test to reflect new behavior where overlapping patterns result in multiple executions

Testing

  • All 75 existing unit tests pass
  • New test specifically validates duplicate file entries are preserved
  • Manual testing confirmed that duplicate files execute as expected:
    Scripts:
      - /path/to/login.yaml
      - /path/to/test.yaml
      - /path/to/login.yaml
    
    Total files: 3
    

Impact

This change enables users to define sequential test flows that reuse the same test files at different points in the execution sequence, which is essential for complex business process automation scenarios.

Fixes #[issue number]

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • googlechromelabs.github.io
  • https://storage.googleapis.com/chrome-for-testing-public/133.0.6943.53/linux64/chrome-headless-shell-linux64.zip
    • Triggering command: node install.mjs (http block)
  • https://storage.googleapis.com/chrome-for-testing-public/133.0.6943.53/linux64/chrome-linux64.zip
    • Triggering command: node install.mjs (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug]: When I execute a project using the command midscene -- config config. yaml, the duplicate yaml case files under the files node in config. yaml will be ignored</issue_title>
<issue_description>### Version

System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 AMD Ryzen 5 PRO 4650G with Radeon Graphics
    Memory: 3.58 GB / 15.37 GB
  Browsers:
    Edge: Chromium (140.0.3485.54)
    Internet Explorer: 11.0.19041.5794

Details

Image
From the current usage scenario, it is hoped that a single YAML file can be used as a functional use case and executed according to a certain business process in the config. YAML file. As shown in the figure, it will be necessary to execute a certain YAML use case multiple times during the process

Reproduce link

https://github.com/web-infra-dev/midscene-example

Reproduce Steps

1、midscene --config config.yaml

Image</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #1326


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@netlify
Copy link

netlify bot commented Oct 17, 2025

Deploy Preview for midscene ready!

Name Link
🔨 Latest commit 3f7f092
🔍 Latest deploy log https://app.netlify.com/projects/midscene/deploys/68f1f051e0e5f800079e8123
😎 Deploy Preview https://deploy-preview-1327--midscene.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@CLAassistant
Copy link

CLAassistant commented Oct 17, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ quanru
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

Co-authored-by: quanru <11739753+quanru@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with ignored duplicate YAML case files fix(cli): allow duplicate YAML files in config.yaml Oct 17, 2025
Copilot AI requested a review from quanru October 17, 2025 02:44
Copilot finished work on behalf of quanru October 17, 2025 02:44
@quanru quanru marked this pull request as ready for review October 17, 2025 03:08
Copy link
Collaborator

@yuyutaotao yuyutaotao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge it into 1.0

@quanru quanru changed the base branch from main to 1.0 October 17, 2025 09:04
@quanru quanru merged commit c1a3398 into 1.0 Oct 17, 2025
10 of 11 checks passed
@quanru quanru deleted the copilot/fix-duplicate-yaml-ignored branch October 17, 2025 09:13
@Nicholas-And-Liu
Copy link

thanks for @yuyutaotao @quanru

The solution to this problem makes it easier for our company's automated testing projects to be conducted in the testing community.

quanru added a commit that referenced this pull request Oct 23, 2025
* Initial plan

* fix(cli): allow duplicate YAML files in config.yaml

Co-authored-by: quanru <11739753+quanru@users.noreply.github.com>

* fix(cli): deep clone YAML script to prevent mutation issues

* fix(yaml): prevent mutation of flowItem by creating a new object for processing

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: quanru <11739753+quanru@users.noreply.github.com>
Co-authored-by: quanruzhuoxiu <quanruzhuoxiu@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

5 participants