test-client.ts 907 B

123456789101112131415161718192021222324
  1. import { AttemptLogin, AttemptLoginVariables } from 'shared/generated-types';
  2. import { ATTEMPT_LOGIN } from '../../admin-ui/src/app/data/definitions/auth-definitions';
  3. import { getDefaultChannelToken } from '../mock-data/get-default-channel-token';
  4. import { SimpleGraphQLClient } from '../mock-data/simple-graphql-client';
  5. import { SUPER_ADMIN_USER_IDENTIFIER, SUPER_ADMIN_USER_PASSWORD } from '../src/common/constants';
  6. import { testConfig } from './config/test-config';
  7. // tslint:disable:no-console
  8. /**
  9. * A GraphQL client for use in e2e tests configured to use the test server endpoint.
  10. */
  11. export class TestClient extends SimpleGraphQLClient {
  12. constructor() {
  13. super(`http://localhost:${testConfig.port}/${testConfig.apiPath}`);
  14. }
  15. async init() {
  16. const token = await getDefaultChannelToken();
  17. this.setChannelToken(token);
  18. await this.asSuperAdmin();
  19. }
  20. }