From f57575b6b707620420c9118b3722d7c79e9b8a5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Doreau?= Date: Fri, 14 May 2021 15:30:05 +0200 Subject: [PATCH] feat(cypress): api base url MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémi Doreau --- cypress/cypress.json | 2 +- cypress/src/integration/integrations.spec.ts | 7 ++++--- cypress/src/settings.ts | 16 ++++++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 cypress/src/settings.ts diff --git a/cypress/cypress.json b/cypress/cypress.json index 3ef3df8e65..bc14ea6557 100644 --- a/cypress/cypress.json +++ b/cypress/cypress.json @@ -1,5 +1,5 @@ { - "baseUrl": "http://localhost:7000", + "baseUrl": "http://localhost:3000", "integrationFolder": "./src/integration", "supportFile": "./src/support", "fixturesFolder": "./src/fixtures", diff --git a/cypress/src/integration/integrations.spec.ts b/cypress/src/integration/integrations.spec.ts index 4703c18881..68d6840e3d 100644 --- a/cypress/src/integration/integrations.spec.ts +++ b/cypress/src/integration/integrations.spec.ts @@ -15,13 +15,14 @@ */ /// import 'os'; +import { API_BASE_URL } from '../settings'; describe('Integrations', () => { describe('ReadTree', () => { it('should work for github', () => { cy.loginAsGuest(); - cy.request('POST', '/api/catalog/locations', { + cy.request('POST', `${API_BASE_URL}/api/catalog/locations`, { target: 'https://github.com/backstage-verification/test-repo/blob/main/**/*', type: 'url', @@ -48,7 +49,7 @@ describe('Integrations', () => { it('should work for gitlab', () => { cy.loginAsGuest(); - cy.request('POST', '/api/catalog/locations', { + cy.request('POST', `${API_BASE_URL}/api/catalog/locations`, { target: 'https://gitlab.com/backstage-verification/test-repo/-/tree/master/**/*', type: 'url', @@ -65,7 +66,7 @@ describe('Integrations', () => { it('should work for bitbucket', () => { cy.loginAsGuest(); - cy.request('POST', '/api/catalog/locations', { + cy.request('POST', `${API_BASE_URL}/api/catalog/locations`, { target: 'https://bitbucket.org/backstage-verification/test-repo/src/master/**/*', type: 'url', diff --git a/cypress/src/settings.ts b/cypress/src/settings.ts new file mode 100644 index 0000000000..350cb5af8b --- /dev/null +++ b/cypress/src/settings.ts @@ -0,0 +1,16 @@ +/* + * Copyright 2021 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export const API_BASE_URL = 'http://localhost:7000';