ReactJs testing useEffect hook with enzyme

Reactjs testing with enzyme doesn’t work with new React hook like useEffect, you need to: Mock useEffect hook with: jest.spyOn Use React.useEffect instead of import { useEffect } from 'react' component.js export default function YourComponent() { const [data, setData] = useState(null) React.useEffect(() => { YourService.yourfunction() .then(data => setData(data)) }, []) return ( <Table/> ) } component.test.js import { shallow } from "enzyme" describe("<YourComponent>", () => { let wrapper beforeEach(() => { // given YourService.

How to configure lombok and mapstruct with Gradle

I created a new Kotlin project and want to import my old project. Old configuration My new Kotlin project was configured to use Mapstruct and the build.gradle look like apply plugin: 'kotlin-kapt' dependencies { implementation "org.mapstruct:mapstruct:${mapstructVersion}" kapt "org.mapstruct:mapstruct-processor:${mapstructVersion}" } When I want to use lombok for the java project. I added the dependencies but it doesn’t work. implementation "org.projectlombok:lombok:${lombokVersion}" annotationProcessor "org.projectlombok:lombok:${lombokVersion}" The ./gradlew build just give the error of no Getter/Setter found, that means lombok was not processing when build.

CodeceptJS attachFile

Today I try to select the file for upload using CodeceptJS WebdriverIO helper. I.attachFile(‘fieldName’, ‘path/file’); My expectation is that the file input field will be filled with the file path but it wasn’t. I try to debug by add the log to the helper configuration in codecept.json “logLevel”: “verbose”, “logOutput”: “test/output”, Then I see the command was trigger, but what it did is upload the file directly to the web server.

Angular directive update template before execute controller function

Some time you want to response to user before you execute heavy task. There is one way is to use broadcast and listener. Today I use another way. I use the other variable for the directive template and other for the logic in controller. I update the `flagSrc` then use timeout to call controller function. So the `flagSrc` will be update when the scope apply and the controller function will be called in another thread.

Overriding CSS Location for Playback in Inspectlet

By default, Inspectlet caches your CSS files and loads those during session playback and heatmap rendering to preserve your site’s styling exactly as it was at the time it was experienced by your visitors. However, if you’ve disabled our CSS bot from caching your CSS, Inspectlet will load your CSS files directly from your site. If during session playback in Inspectlet you’d like to load your CSS from a different URL, you can do so by adding the inspectlet-href attribute to your CSS LINK tag like so: