Refactor functional tests
Use named quries and input variables instead of creating query strings Use gql documents instead of strings
Resolves T4554