"use strict";
/*
 * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under
 * one or more contributor license agreements. See the NOTICE file distributed
 * with this work for additional information regarding copyright ownership.
 * Licensed under the Camunda License 1.0. You may not use this file
 * except in compliance with the Camunda License 1.0.
 */
Object.defineProperty(exports, "__esModule", { value: true });
const c8Run_8_7_1 = require("../../fixtures/c8Run-8.7");
const apiHelpers_1 = require("../../utils/apiHelpers");
const UtilitiesPage_1 = require("../../pages/c8Run-8.7/UtilitiesPage");
const _setup_1 = require("../../test-setup.js");
const baseUrl = process.env.C8RUN_CONNECTORS_API_URL;
let connectorsToken = '';
if (process.env.RUN_AS_DOCKER_COMPOSE == 'true') {
    c8Run_8_7_1.test.describe('Connectors API tests', () => {
        c8Run_8_7_1.test.use({
            baseURL: baseUrl,
        });
        c8Run_8_7_1.test.beforeEach(async ({ page, request }) => {
            await (0, UtilitiesPage_1.navigateToApp)(page, 'identity');
            connectorsToken = await (0, UtilitiesPage_1.getAccessTokenFor)(request, 'connectors');
        });
        c8Run_8_7_1.test.afterEach(async ({ page }, testInfo) => {
            await (0, _setup_1.captureScreenshot)(page, testInfo);
            await (0, _setup_1.captureFailureVideo)(page, testInfo);
        });
        (0, c8Run_8_7_1.test)('Get connectors status', async ({ request }) => {
            const connectorsStatus = await request.get('/actuator/health', {
                headers: {
                    Authorization: `Bearer ${connectorsToken}`,
                    'Content-Type': 'application/json',
                },
            });
            await (0, apiHelpers_1.assertResponseStatus)(connectorsStatus, 200);
        });
        (0, c8Run_8_7_1.test)('Get a inbound connectors list', async ({ request }) => {
            const connectorsInboundList = await request.get('/inbound', {
                headers: {
                    Authorization: `Bearer ${connectorsToken}`,
                    'Content-Type': 'application/json',
                },
            });
            await (0, apiHelpers_1.assertResponseStatus)(connectorsInboundList, 200);
        });
    });
}
