refactor(techdocs): requested changes

Signed-off-by: Rémi Doreau <remi.d45@gmail.com>
This commit is contained in:
Rémi Doreau
2021-07-23 15:43:08 +02:00
parent 197e9112bd
commit 5b31a86950
10 changed files with 6 additions and 3488 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
{
"baseUrl": "http://localhost:3000",
"baseUrl": "http://localhost:7000",
"integrationFolder": "./src/integration",
"supportFile": "./src/support",
"fixturesFolder": "./src/fixtures",
File diff suppressed because it is too large Load Diff
+3 -4
View File
@@ -15,14 +15,13 @@
*/
/// <reference types="cypress" />
import 'os';
import { API_BASE_URL } from '../settings';
describe('Integrations', () => {
describe('ReadTree', () => {
it('should work for github', () => {
cy.loginAsGuest();
cy.request('POST', `${API_BASE_URL}/api/catalog/locations`, {
cy.request('POST', '/api/catalog/locations', {
target:
'https://github.com/backstage-verification/test-repo/blob/main/**/*',
type: 'url',
@@ -49,7 +48,7 @@ describe('Integrations', () => {
it('should work for gitlab', () => {
cy.loginAsGuest();
cy.request('POST', `${API_BASE_URL}/api/catalog/locations`, {
cy.request('POST', '/api/catalog/locations', {
target:
'https://gitlab.com/backstage-verification/test-repo/-/tree/master/**/*',
type: 'url',
@@ -66,7 +65,7 @@ describe('Integrations', () => {
it('should work for bitbucket', () => {
cy.loginAsGuest();
cy.request('POST', `${API_BASE_URL}/api/catalog/locations`, {
cy.request('POST', '/api/catalog/locations', {
target:
'https://bitbucket.org/backstage-verification/test-repo/src/master/**/*',
type: 'url',
@@ -19,7 +19,6 @@ import 'os';
describe('TechDocs', () => {
beforeEach(() => {
cy.loginAsGuest();
cy.mockTechDocsCSS();
cy.mockSockJSNode();
cy.interceptTechDocsAPICalls();
});
@@ -39,7 +38,6 @@ describe('TechDocs', () => {
it('should navigate to the TechDocs home page from the URL', () => {
cy.visit('/docs');
cy.wait(500);
cy.contains('Documentation');
+1 -1
View File
@@ -19,7 +19,7 @@ import 'os';
describe('Login', () => {
it('should render the login page', () => {
cy.visit('/');
cy.contains('Backstage Example App');
cy.contains('Select a sign-in method');
});
it('should be able to login', () => {
-16
View File
@@ -1,16 +0,0 @@
/*
* 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';
-6
View File
@@ -64,12 +64,6 @@ Cypress.Commands.add('getTechDocsNavigation', () => {
cy.get('[data-md-component="navigation"]');
});
Cypress.Commands.add('mockTechDocsCSS', () => {
cy.intercept('GET', '**/assets/stylesheets/main.fe0cca5b.min.css', {
fixture: 'techdocs/style.css',
});
});
Cypress.Commands.add('mockSockJSNode', () => {
cy.intercept('GET', '**/sockjs-node/info**', {
body: {
-5
View File
@@ -42,11 +42,6 @@ declare namespace Cypress {
* @example cy.getTechDocsNavigation
*/
getTechDocsNavigation(): Chainable<Element>;
/**
* Mock Techdocs CSS
* @example cy.mockTechDocsCSS
*/
mockTechDocsCSS(): Chainable<Element>;
/**
* Intercept the TechDocs API calls
* @example cy.interceptTechDocsAPICalls
-53
View File
@@ -17,56 +17,3 @@ Cypress.Commands.add('enterAsGuest', () => {
cy.visit('/');
cy.get('button').contains('Enter').click();
});
Cypress.Commands.add('login', () => {
window.localStorage.setItem('@backstage/core:SignInPage:provider', 'guest');
});
Cypress.Commands.add('getTechDocsShadowRoot', () => {
cy.get('[data-testid="techdocs-content-shadowroot"]').shadow();
});
Cypress.Commands.add('mockTechDocs', () => {
cy.intercept(
'GET',
'**/techdocs/metadata/entity/default/Component/backstage',
{
fixture: 'techdocs/metadata-entity.json',
},
);
cy.intercept(
'GET',
'**/techdocs/metadata/techdocs/default/Component/backstage',
{
fixture: 'techdocs/metadata-techdocs.json',
},
);
cy.intercept('GET', '**/techdocs/sync/default/Component/backstage', {
fixture: 'techdocs/sync.json',
});
// Backstage Roadmap - TechDocs HTML
cy.intercept(
'GET',
'**/techdocs/static/docs/default/Component/backstage/overview/roadmap/index.html',
{
fixture: 'techdocs/components/roadmap.html',
},
);
// Backstage Home - TechDocs HTML
cy.intercept(
'GET',
'**/techdocs/static/docs/default/Component/backstage/index.html',
{
fixture: 'techdocs/components/default.html',
},
);
// TechDocs CSS
cy.intercept('GET', '**/assets/stylesheets/main.fe0cca5b.min.css', {
fixture: 'techdocs/components/style.css',
});
});
+1
View File
@@ -14,3 +14,4 @@
* limitations under the License.
*/
import '@testing-library/cypress/add-commands';
import './commands';