Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 65 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/scratch-gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
"@babel/core": "7.29.0",
"@babel/preset-env": "7.29.0",
"@babel/preset-react": "7.28.5",
"@reduxjs/toolkit": "^2.11.2",
"@testing-library/jest-dom": "5.17.0",
"@testing-library/react": "14.3.1",
"@types/jest": "25.2.3",
Expand Down
32 changes: 32 additions & 0 deletions packages/scratch-gui/test/helpers/selenium-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ class SeleniumHelper {
'clickButton',
'clickXpath',
'clickBlocksCategory',
'clickKey',
'clickKeys',
'elementIsVisible',
'findByText',
'textToXpath',
Expand Down Expand Up @@ -391,6 +393,36 @@ class SeleniumHelper {
}
}

/**
* Sends a single keyboard key to the active element.
* @param {string} key - The key to send
* @param {number} [sleepTime] - Optional delay after sending the key (ms).
*/
async clickKey (key, sleepTime = 50) {
try {
await this.driver.actions().sendKeys(key)
.perform();
await this.driver.sleep(sleepTime);
} catch (error) {
throw new Error(`Failed to send key "${key}": ${error.message}`);
}
};

/**
* Sends multiple keyboard keys in sequence.
* @param {string[]} keys - Array of keys to send.
* @param {number} [sleepTime] - Optional delay between each key (ms).
*/
async clickKeys (keys, sleepTime = 50) {
try {
for (const key of keys) {
await this.clickKey(key, sleepTime);
}
} catch (error) {
throw new Error(`Failed to send key sequence - ${keys}: ${error.message}`);
}
};

/**
* Get selected browser log entries.
* @param {Array.<string>} [whitelist] An optional list of log strings to allow. Default: see implementation.
Expand Down
Loading
Loading