Open rubengrill opened 1 month ago
I found out that it does work if a safe area is defined with any non null bottom value.
Works:
assertSnapshot(matching: vc, as: .image(on: .init(safeArea: .init(top: 0, left: 0, bottom: 1, right: 0), size: .init(width: 375, height: 812))))
Does not work:
assertSnapshot(matching: vc, as: .image(on: .init(safeArea: .init(top: 0, left: 0, bottom: 0, right: 0), size: .init(width: 375, height: 812))))
Since all predefined configs have a safe area, this issue should not happen when these are used:
assertSnapshot(matching: vc, as: .image(on: .iPhoneX))
When trying to use Keyboard Layout Guide it seems that the keyboard layout is not set (at top with no height) and the resulting screenshot is incorrect therefore. I am aware that for screenshot tests there is no keyboard, but my expectation would have been that the keyboard layout then matches the bottom part below the safe area (in other words keyboard layout top = safe area bottom). This would be in line with what Apple documents:
Example:
It correctly works when replacing the keyboard layout guide:
How do you use keyboard layout guide in snapshot tests? Is it possible to somehow set the keyboard layout guide in tests? Or are you using the keyboard layout guide differently (maybe always in combination with safe area layout guide)?