For resizing use code from there (https://www.sfml-dev.org/tutorials/2.2/graphics-view.php#showing-more-when-the-window-is-resized):
// the event loop
sf::Event event;
while (window.pollEvent(event))
{
...
// catch the resize events
if (event.type == sf::Event::Resized)
{
// update the view to the new size of the window
sf::FloatRect visibleArea(0, 0, event.size.width, event.size.height);
window.setView(sf::View(visibleArea));
}
}
If you want resize window inside handler than you should call window.setSize there.
So change it to:
if (test2Btn.contains(mousePosFloat))
{
boardObject.ResetGame(cfgWindowMaker);
cfgWindowMaker.ReadingCFGFile("boards/configintermediate.cfg");
boardObject.RandomBombMaker(cfgWindowMaker, window);
window.setSize({ cfgWindowMaker.GetWidth(), cfgWindowMaker.GetHeight() });
//view will change in resize handler
}