I believe there are two ways to do what you want.
1. Use the VSCode extension APIs and the built-in commands[1] to write an extension that unit tests your tutorials
For example, you could use vscode.executeCodeActionProvider which will return the actions that VSCode suggests at a specific point in the file.
For the shortcuts, I think the only option would be to read user's keybindings.json file directly.
This is the easiest way I think and may be enough but generally speaking, VSCode's APIs are very restrictive and may not give you everything you need.
2. VSCode being an Electron app can be run from Playwright (similar to Selenium) which should give you full control to drive and inspect it. I haven't done this myself but apparently Playwright is used internally to test VSCode as well. So it should be possible. See [2].