feat(app): add techdocs e2e
Signed-off-by: Rémi Doreau <remi.d45@gmail.com>
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
{
|
||||
"baseUrl": "http://localhost:3000",
|
||||
"fixturesFolder": false,
|
||||
"pluginsFile": false
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"metadata": {
|
||||
"namespace": "default",
|
||||
"annotations": {
|
||||
"backstage.io/managed-by-location": "file:../catalog-model/examples/acme/team-a-group.yaml",
|
||||
"backstage.io/managed-by-origin-location": "bootstrap:bootstrap"
|
||||
},
|
||||
"name": "guest",
|
||||
"uid": "88074c2a-9d6b-4cd9-9d61-6901da330cac",
|
||||
"etag": "YzE2NjMxN2YtOGNhNy00NWRkLTlhOTItNjFmYmIzZjM5ZDI4",
|
||||
"generation": 1
|
||||
},
|
||||
"apiVersion": "backstage.io/v1alpha1",
|
||||
"kind": "User",
|
||||
"spec": {
|
||||
"profile": {
|
||||
"displayName": "Guest User",
|
||||
"email": "guest@example.com",
|
||||
"picture": "https://avatars.dicebear.com/api/avataaars/guest@example.com.svg?background=%23fff"
|
||||
},
|
||||
"memberOf": ["team-a"]
|
||||
},
|
||||
"relations": [
|
||||
{
|
||||
"target": { "kind": "group", "namespace": "default", "name": "team-a" },
|
||||
"type": "memberOf"
|
||||
},
|
||||
{
|
||||
"target": {
|
||||
"kind": "component",
|
||||
"namespace": "default",
|
||||
"name": "backstage"
|
||||
},
|
||||
"type": "ownerOf"
|
||||
},
|
||||
{
|
||||
"target": {
|
||||
"kind": "component",
|
||||
"namespace": "default",
|
||||
"name": "documented-component"
|
||||
},
|
||||
"type": "ownerOf"
|
||||
},
|
||||
{
|
||||
"target": {
|
||||
"kind": "component",
|
||||
"namespace": "default",
|
||||
"name": "playback-order"
|
||||
},
|
||||
"type": "ownerOf"
|
||||
},
|
||||
{
|
||||
"target": {
|
||||
"kind": "component",
|
||||
"namespace": "default",
|
||||
"name": "searcher"
|
||||
},
|
||||
"type": "ownerOf"
|
||||
},
|
||||
{
|
||||
"target": {
|
||||
"kind": "component",
|
||||
"namespace": "default",
|
||||
"name": "shuffle-api"
|
||||
},
|
||||
"type": "ownerOf"
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"metadata": {
|
||||
"namespace": "default",
|
||||
"annotations": {
|
||||
"backstage.io/managed-by-location": "file:../../plugins/github-actions/examples/sample.yaml",
|
||||
"backstage.io/managed-by-origin-location": "bootstrap:bootstrap",
|
||||
"github.com/project-slug": "backstage/backstage",
|
||||
"backstage.io/techdocs-ref": "url:https://github.com/backstage/backstage"
|
||||
},
|
||||
"name": "backstage",
|
||||
"description": "backstage.io",
|
||||
"uid": "b3bae9fa-c34f-47d0-ae14-547c1d77c147",
|
||||
"etag": "MDU1MzdiYWYtYjFjZC00OGQ4LThhMmEtN2Q5NjA3ZGVhM2Rl",
|
||||
"generation": 1
|
||||
},
|
||||
"apiVersion": "backstage.io/v1alpha1",
|
||||
"kind": "Component",
|
||||
"spec": {
|
||||
"type": "website",
|
||||
"lifecycle": "production",
|
||||
"owner": "user:guest"
|
||||
},
|
||||
"relations": [
|
||||
{
|
||||
"target": { "kind": "user", "namespace": "default", "name": "guest" },
|
||||
"type": "ownedBy"
|
||||
}
|
||||
],
|
||||
"locationMetadata": {
|
||||
"type": "url",
|
||||
"target": "https://github.com/backstage/backstage"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"site_name": "Backstage",
|
||||
"site_description": "Main documentation for Backstage features and platform APIs"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "message": "Docs updated or did not need updating" }
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2020 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.
|
||||
*/
|
||||
|
||||
describe('Login', () => {
|
||||
beforeEach(() => {
|
||||
cy.intercept('GET', '**/catalog/entities**', {
|
||||
fixture: 'entities.json',
|
||||
});
|
||||
|
||||
cy.intercept('GET', '**/guest', {
|
||||
fixture: 'guest.json',
|
||||
});
|
||||
});
|
||||
|
||||
it('should render the login page', () => {
|
||||
cy.visit('/');
|
||||
cy.contains('Backstage Example App');
|
||||
});
|
||||
|
||||
it('should be able to login', () => {
|
||||
cy.get('button').contains('Enter').click();
|
||||
cy.url().should('include', '/catalog');
|
||||
|
||||
cy.contains('artist-lookup');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Copyright 2020 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.
|
||||
*/
|
||||
|
||||
describe('TechDocs', () => {
|
||||
beforeEach(() => {
|
||||
cy.login();
|
||||
});
|
||||
|
||||
describe('Navigating to TechDocs', () => {
|
||||
beforeEach(() => {
|
||||
cy.intercept('GET', '**/catalog/entities**', {
|
||||
fixture: 'entities.json',
|
||||
});
|
||||
|
||||
cy.intercept('GET', '**/guest', {
|
||||
fixture: 'guest.json',
|
||||
});
|
||||
|
||||
cy.mockTechDocs();
|
||||
});
|
||||
|
||||
it('should navigate to the TechDocs page via the primary navigation bar', () => {
|
||||
cy.visit('/');
|
||||
cy.get('[data-testid="sidebar-root"]')
|
||||
.get('div')
|
||||
.get('a[href="/docs"]')
|
||||
.click();
|
||||
|
||||
cy.contains('Documentation');
|
||||
});
|
||||
|
||||
it('should navigate to the TechDocs home page from a URL', () => {
|
||||
cy.visit('/docs');
|
||||
|
||||
cy.contains('Documentation');
|
||||
});
|
||||
|
||||
it('should navigate to a specific TechDocs component page from a URL', () => {
|
||||
cy.visit('/docs/default/Component/backstage');
|
||||
|
||||
cy.contains('Backstage');
|
||||
cy.contains(
|
||||
'Main documentation for Backstage features and platform APIs',
|
||||
);
|
||||
cy.get('[data-testid="techdocs-content-shadowroot"]')
|
||||
.shadow()
|
||||
.contains('The Backstage documentation is available at');
|
||||
});
|
||||
|
||||
it('should navigate to a specific TechDocs fragment from a URL', () => {
|
||||
cy.visit('/docs/default/Component/backstage/overview/roadmap');
|
||||
|
||||
cy.get('[data-testid="techdocs-content-shadowroot"]')
|
||||
.shadow()
|
||||
.within(() => {
|
||||
cy.contains('Phases');
|
||||
cy.contains('Detailed roadmap');
|
||||
});
|
||||
});
|
||||
|
||||
it('should navigate to a specific TechDocs hash from a URL', () => {
|
||||
cy.visit(
|
||||
'/docs/default/Component/backstage/overview/roadmap/#future-work',
|
||||
);
|
||||
|
||||
cy.get('[data-testid="techdocs-content-shadowroot"]')
|
||||
.shadow()
|
||||
.within(() => {
|
||||
// eslint-disable-next-line jest/valid-expect
|
||||
cy.get('#future-work').should($element =>
|
||||
expect($element[0].offsetTop).to.be.closeTo(1040, 200),
|
||||
);
|
||||
cy.contains('Future work');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Navigating within TechDocs', () => {
|
||||
beforeEach(() => {
|
||||
cy.intercept('GET', '**/catalog/entities**', {
|
||||
fixture: 'entities.json',
|
||||
});
|
||||
|
||||
cy.intercept('GET', '**/guest', {
|
||||
fixture: 'guest.json',
|
||||
});
|
||||
|
||||
cy.mockTechDocs();
|
||||
});
|
||||
it('should navigate to the TechDocs page via the table of contents', () => {
|
||||
cy.visit('/docs/default/Component/backstage/overview/roadmap');
|
||||
|
||||
cy.get('[data-testid="techdocs-content-shadowroot"]')
|
||||
.shadow()
|
||||
.within(() => {
|
||||
cy.get(
|
||||
'body > div.md-container > main > div > div.md-sidebar.md-sidebar--primary > div > div > nav > ul > li:nth-child(1)',
|
||||
).click();
|
||||
cy.get(
|
||||
'body > div.md-container > main > div > div.md-sidebar.md-sidebar--primary > div > div > nav > ul > li:nth-child(1) > nav > ul > li:nth-child(3)',
|
||||
).click();
|
||||
|
||||
cy.contains('Phases');
|
||||
cy.contains('Detailed roadmap');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -17,3 +17,62 @@ 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('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',
|
||||
});
|
||||
|
||||
// HTML
|
||||
cy.intercept(
|
||||
'GET',
|
||||
'**/techdocs/static/docs/default/Component/backstage/overview/roadmap/index.html',
|
||||
{
|
||||
fixture: 'techdocs/components/roadmap.html',
|
||||
},
|
||||
);
|
||||
|
||||
cy.intercept(
|
||||
'GET',
|
||||
'**/techdocs/static/docs/default/Component/backstage/index.html',
|
||||
{
|
||||
fixture: 'techdocs/components/default.html',
|
||||
},
|
||||
);
|
||||
|
||||
// CSS
|
||||
cy.intercept(
|
||||
'GET',
|
||||
'**/techdocs/static/docs/default/Component/backstage/assets/stylesheets/main.fe0cca5b.min.css',
|
||||
{
|
||||
fixture: 'techdocs/components/style.css',
|
||||
},
|
||||
);
|
||||
cy.intercept(
|
||||
'GET',
|
||||
'**/techdocs/static/docs/default/Component/assets/stylesheets/main.fe0cca5b.min.css',
|
||||
{
|
||||
fixture: 'techdocs/components/style.css',
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
@@ -3,6 +3,8 @@ kind: Component
|
||||
metadata:
|
||||
name: artist-lookup
|
||||
description: Artist Lookup
|
||||
annotations:
|
||||
github.com/project-slug: backstage/backstage
|
||||
tags:
|
||||
- java
|
||||
- data
|
||||
|
||||
@@ -10916,6 +10916,13 @@ debug@4.3.1:
|
||||
dependencies:
|
||||
ms "2.1.2"
|
||||
|
||||
debug@4.3.2:
|
||||
version "4.3.2"
|
||||
resolved "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b"
|
||||
integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==
|
||||
dependencies:
|
||||
ms "2.1.2"
|
||||
|
||||
debug@^3.0.0, debug@^3.1.0, debug@^3.1.1, debug@^3.2.5, debug@^3.2.6:
|
||||
version "3.2.6"
|
||||
resolved "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b"
|
||||
|
||||
Reference in New Issue
Block a user