UIDefectMocker is designed to inject various UI display defects into mobile screenshot to simulate real-world UI issues.
- CONTENT_ERROR: Repeats content within an element.
- CONTENT_REPEAT: Replaces content within an element.
- EL_OVERLAPPING: Overlaps one element with another.
- EL_SCALING: Scales an element up or down.
- EL_MISSING_BLANK: Replaces an element with a blank space.
- EL_MISSING_BROKEN_IMG: Replaces an element with a broken image.
- EL_MISALIGNED: Misaligns elements on the page.
- UNEVEN_SPACE: Covers a row of elements with a blank space in the center.
- Clone the repository:
git clone https://github.com/sesuii/uidefectmocker.git
- Navigate to the project directory:
cd UIDefectMocker - Initialize Poetry in the project:
poetry init
- Install the required dependencies:
poetry install
- Configure the
config.yamlfile with your desired settings. - Place your screenshots in the directory specified by
INPUT_DIRin theconfig.yamlfile. - Run the main script to inject defects:
poetry run python uidm_main.py
Here is an example configuration config.yaml:
INPUT_DIR: "/screenshots"
SAVED_DIR: "/saved"
ANDROID_XML_DIR: "/xml"
STRATEGY: ["CONTENT_ERROR", "CONTENT_REPEAT", "EL_OVERLAPPING", "EL_SCALING", "EL_MISSING_BLANK", "EL_MISSING_BROKEN_IMG", "EL_MISALIGNED", "UNEVEN_SPACE"]
OUTPUT_WITH_LABELED: True
PATTERN: "SCREENSHOT_WITH_XML"
RESOURCE_DIR: "/resources"
FONT_PATH: "/resources/Roboto-Regular.ttf"
GARBLED_CONTENT: ['����', 'nullnull']
DARK_MODE: false
MIN_DIST: 30- According to the screenshot size, automatically adjust the
screen_labeledrelated parameters (font_size,thickness). - Strategy:
UNEVEN_SPACEuse a rectangle(screenshot_width, screenshot / 10) scan the screen?
