Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
cypress-forced-colors
Advanced tools
Cypress commands to enable and disable browser forced colors mode
⚠️ For full forced color emulation, the browser you are testing on must be Chromium > 98.
This library contains helper cypress methods to enable and disable forced colors emulation in chromium borwsers through the chrome devtools protocol.
The devtools APIs used by this library can be found on the official chrome devtools protocol docs.
Forced colors is a browser mode where color CSS properties are overriden. You can find a full list of affected properties on the MDN docs. This browser feature is leveraged notably by Windows High Contrast Mode, which will override all colors with system colors to provide more contrast for users that need it.
Chrome devtools has media emulation as a stable feature and in version 98, supports full emulation of forced colors. This plugin can be used to have an easy way of testing acessible high contrast designs without needing a windows machine or enabling a windows os feature.
npm install --save-dev cypress-forced-colors
Add the following code to your cypress support file.
// cypress/support/index.js
// cypress/support/index.ts
import 'cypress-forced-colors';
Once the custom commands are registered with cypress you can enable or disable forced color mode in your tests.
it('Test with forced colors mode', () => {
cy.enableForcedColors('dark');
// your test code...
cy.disableForcedColors();
})
You can also use this for test suites
describe('Forced color tests', () => {
before(() => {
cy.enableForcedColors('dark');
});
after(() => {
cy.disableForcedColors();
})
})
⚠️ Make sure you use a Chromium browser with version > 98
You can try out this feature from this repository. Simply clone the repo and run the following commands to open cypress and test to see the example test suite.
npm install
npm start
FAQs
Cypress commands to enable and disable browser forced colors mode
The npm package cypress-forced-colors receives a total of 5 weekly downloads. As such, cypress-forced-colors popularity was classified as not popular.
We found that cypress-forced-colors demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.