feat(cypress): remove techodcs fixtures
Signed-off-by: Rémi Doreau <remi.d45@gmail.com>
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,69 +0,0 @@
|
||||
{
|
||||
"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
@@ -1,33 +0,0 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"site_name": "Backstage",
|
||||
"site_description": "Main documentation for Backstage features and platform APIs"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{ "message": "Docs updated or did not need updating" }
|
||||
@@ -19,22 +19,13 @@ import 'os';
|
||||
describe('TechDocs', () => {
|
||||
beforeEach(() => {
|
||||
cy.loginAsGuest();
|
||||
cy.mockTechDocsCSS();
|
||||
cy.mockSockJSNode();
|
||||
cy.interceptTechDocsAPICalls();
|
||||
});
|
||||
|
||||
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', () => {
|
||||
it('should navigate to the TechDocs home page via the primary navigation bar', () => {
|
||||
cy.visit('/');
|
||||
cy.get('[data-testid="sidebar-root"]')
|
||||
.get('div')
|
||||
@@ -44,7 +35,12 @@ describe('TechDocs', () => {
|
||||
cy.contains('Documentation');
|
||||
});
|
||||
|
||||
it('should navigate to the TechDocs home page from the "Overview" tab', () => {
|
||||
it('should navigate to the TechDocs home page from the URL', () => {
|
||||
cy.visit('/docs');
|
||||
cy.contains('Documentation');
|
||||
});
|
||||
|
||||
it('should navigate to a specific TechDocs entity from the "Overview" tab', () => {
|
||||
cy.visit('/docs');
|
||||
cy.get('[data-testid="read_docs"]').eq(0).click();
|
||||
|
||||
@@ -53,7 +49,7 @@ describe('TechDocs', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should navigate to the TechDocs home page from the "Owned documents" tab', () => {
|
||||
it('should navigate to a specific TechDocs entity from the "Owned documents" tab', () => {
|
||||
cy.visit('/docs');
|
||||
cy.get('[data-testid="header-tab-1"]').click();
|
||||
cy.get('[value="backstage"] > div > a').click();
|
||||
@@ -63,13 +59,9 @@ describe('TechDocs', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should navigate to a specific TechDocs project page', () => {
|
||||
cy.visit('/docs');
|
||||
cy.contains('Documentation');
|
||||
});
|
||||
|
||||
it('should navigate to a specific TechDocs entity page from a URL', () => {
|
||||
cy.visit('/docs/default/Component/backstage');
|
||||
cy.waitHomePage();
|
||||
|
||||
cy.contains('Backstage');
|
||||
cy.contains(
|
||||
@@ -82,6 +74,7 @@ describe('TechDocs', () => {
|
||||
|
||||
it('should navigate to a specific TechDocs section from a URL', () => {
|
||||
cy.visit('/docs/default/Component/backstage/overview/roadmap');
|
||||
cy.waitRoadmapPage();
|
||||
|
||||
cy.window().its('scrollY').should('equal', 0);
|
||||
|
||||
@@ -95,6 +88,7 @@ describe('TechDocs', () => {
|
||||
cy.visit(
|
||||
'/docs/default/Component/backstage/overview/roadmap/#future-work',
|
||||
);
|
||||
cy.waitRoadmapPage();
|
||||
|
||||
// This is used to test the post-render behavior of the techdocs Reader
|
||||
cy.wait(500);
|
||||
@@ -118,103 +112,108 @@ describe('TechDocs', () => {
|
||||
});
|
||||
|
||||
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 navigation bar', () => {
|
||||
it('should navigate to a specific TechDocs page via the navigation bar', () => {
|
||||
cy.visit('/docs/default/Component/backstage');
|
||||
cy.waitHomePage();
|
||||
|
||||
cy.getTechDocsShadowRoot().within(() => {
|
||||
cy.get('[data-testid="md-nav-overview"]').click();
|
||||
cy.get('[data-testid="md-nav-roadmap"]').click();
|
||||
|
||||
const overviewNavigation = cy
|
||||
.getTechDocsNavigation()
|
||||
.find('> div > div > [data-md-level="0"] > ul > li:nth-child(1)');
|
||||
overviewNavigation.within(() => {
|
||||
// Overview
|
||||
cy.get('> input').click({ force: true });
|
||||
});
|
||||
overviewNavigation.within(() => {
|
||||
// Project Roadmap
|
||||
cy.get('> [data-md-level="1"] > ul > li:nth-child(3) > a').click();
|
||||
});
|
||||
cy.contains('Phases');
|
||||
cy.contains('Detailed roadmap');
|
||||
});
|
||||
});
|
||||
|
||||
it('should navigate to the TechDocs page via the table of contents - Level 1', () => {
|
||||
cy.visit('/docs/default/Component/backstage/overview/roadmap');
|
||||
describe('Navigating within a TechDocs page', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('/docs/default/Component/backstage/overview/roadmap');
|
||||
cy.waitRoadmapPage();
|
||||
});
|
||||
it('should navigate to a specific fragment within the page via the table of contents - Level 1', () => {
|
||||
return cy.getTechDocsShadowRoot().within(() => {
|
||||
// Phases
|
||||
cy.getTechDocsTableOfContents().within(() => {
|
||||
cy.get('> div > div > nav > ul > li:nth-child(2) > a').click();
|
||||
});
|
||||
|
||||
return cy.getTechDocsShadowRoot().within(() => {
|
||||
cy.get('[data-testid="md-nav-phases"]').click();
|
||||
|
||||
cy.get('#phases').then($el => {
|
||||
cy.window()
|
||||
.its('scrollY')
|
||||
.should($scrollY => {
|
||||
expect($scrollY).to.be.closeTo($el[0].offsetTop, 200);
|
||||
});
|
||||
cy.get('#phases').then($el => {
|
||||
cy.window()
|
||||
.its('scrollY')
|
||||
.should($scrollY => {
|
||||
expect($scrollY).to.be.closeTo($el[0].offsetTop, 200);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should navigate to the TechDocs page via the table of contents - Level 2', () => {
|
||||
cy.visit('/docs/default/Component/backstage/overview/roadmap');
|
||||
it('should navigate to a specific fragment within the page via the table of contents - Level 2', () => {
|
||||
return cy.getTechDocsShadowRoot().within(() => {
|
||||
// Future work
|
||||
cy.getTechDocsTableOfContents()
|
||||
.find(
|
||||
'> div > div > nav > ul > li:nth-child(3) > nav > ul > li:nth-child(2) > a',
|
||||
)
|
||||
.click();
|
||||
|
||||
return cy.getTechDocsShadowRoot().within(() => {
|
||||
cy.get('[data-testid="md-nav-future-work"]').click();
|
||||
|
||||
cy.get('#future-work').then($el => {
|
||||
cy.window()
|
||||
.its('scrollY')
|
||||
.should($scrollY => {
|
||||
expect($scrollY).to.be.closeTo($el[0].offsetTop, 200);
|
||||
});
|
||||
cy.get('#future-work').then($el => {
|
||||
cy.window()
|
||||
.its('scrollY')
|
||||
.should($scrollY => {
|
||||
expect($scrollY).to.be.closeTo($el[0].offsetTop, 200);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should navigate to a specific fragment within a TechDocs page', () => {
|
||||
cy.visit('/docs/default/Component/backstage/overview/roadmap');
|
||||
cy.scrollTo('bottom');
|
||||
it('should navigate to a specific TechDocs page fragment from a link', () => {
|
||||
return cy.getTechDocsShadowRoot().within(() => {
|
||||
cy.get('.md-content > article')
|
||||
.contains('upgrade their installation')
|
||||
.click();
|
||||
|
||||
return cy.getTechDocsShadowRoot().within(() => {
|
||||
cy.contains('Link to Phases').click();
|
||||
|
||||
cy.get('#phases').then($el => {
|
||||
cy.window()
|
||||
.its('scrollY')
|
||||
.should($scrollY => {
|
||||
expect($scrollY).to.be.closeTo($el[0].offsetTop, 200);
|
||||
});
|
||||
cy.location().should(loc => {
|
||||
expect(loc.pathname).to.eq(
|
||||
'/docs/default/Component/backstage/cli/commands/',
|
||||
);
|
||||
expect(loc.hash).to.eq('#versionsbump');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should navigate to the next page within a TechDocs page', () => {
|
||||
cy.visit('/docs/default/Component/backstage/overview/roadmap');
|
||||
cy.scrollTo('bottom');
|
||||
cy.getTechDocsShadowRoot().within(() => {
|
||||
cy.get('.md-footer-nav__link.md-footer-nav__link--next').click();
|
||||
it('should navigate to the next page within a TechDocs entity', () => {
|
||||
cy.scrollTo('bottom');
|
||||
|
||||
cy.location().should(loc => {
|
||||
expect(loc.pathname).to.eq(
|
||||
'/docs/default/Component/backstage/overview/vision/',
|
||||
);
|
||||
return cy.getTechDocsShadowRoot().within(() => {
|
||||
cy.get('.md-footer-nav__link--next').click();
|
||||
|
||||
cy.location().should(loc => {
|
||||
expect(loc.pathname).to.eq(
|
||||
'/docs/default/Component/backstage/overview/vision/',
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should navigate to the previous page within a TechDocs page', () => {
|
||||
cy.visit('/docs/default/Component/backstage/overview/roadmap');
|
||||
cy.scrollTo('bottom');
|
||||
cy.getTechDocsShadowRoot().within(() => {
|
||||
cy.get('.md-footer-nav__link.md-footer-nav__link--prev').click();
|
||||
it('should navigate to the previous page within a TechDocs entity', () => {
|
||||
cy.scrollTo('bottom');
|
||||
|
||||
cy.location().should(loc => {
|
||||
expect(loc.pathname).to.eq(
|
||||
'/docs/default/Component/backstage/overview/architecture-overview/',
|
||||
);
|
||||
return cy.getTechDocsShadowRoot().within(() => {
|
||||
cy.get('.md-footer-nav__link--prev').click();
|
||||
|
||||
cy.location().should(loc => {
|
||||
expect(loc.pathname).to.eq(
|
||||
'/docs/default/Component/backstage/overview/architecture-overview/',
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -17,16 +17,6 @@
|
||||
import 'os';
|
||||
|
||||
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');
|
||||
|
||||
@@ -24,47 +24,66 @@ Cypress.Commands.add('getTechDocsShadowRoot', () => {
|
||||
cy.get('[data-testid="techdocs-content-shadowroot"]').shadow();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('mockTechDocs', () => {
|
||||
Cypress.Commands.add('getTechDocsTableOfContents', () => {
|
||||
cy.get('[data-md-component="toc"]');
|
||||
});
|
||||
|
||||
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: {
|
||||
websocket: true,
|
||||
origins: ['*:*'],
|
||||
cookie_needed: false,
|
||||
entropy: 2882389500,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('interceptTechDocsAPICalls', () => {
|
||||
cy.intercept(
|
||||
'GET',
|
||||
'**/techdocs/metadata/entity/default/Component/backstage',
|
||||
{
|
||||
fixture: 'techdocs/metadata-entity.json',
|
||||
},
|
||||
);
|
||||
).as('entityMetadata');
|
||||
|
||||
cy.intercept(
|
||||
'GET',
|
||||
'**/techdocs/metadata/techdocs/default/Component/backstage',
|
||||
{
|
||||
fixture: 'techdocs/metadata-techdocs.json',
|
||||
},
|
||||
).as('techdocsMetadata');
|
||||
|
||||
cy.intercept('GET', '**/techdocs/sync/default/Component/backstage').as(
|
||||
'syncEntity',
|
||||
);
|
||||
|
||||
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',
|
||||
},
|
||||
);
|
||||
).as('roadmapHTML');
|
||||
|
||||
// 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',
|
||||
});
|
||||
).as('homeHTML');
|
||||
});
|
||||
|
||||
Cypress.Commands.add('waitRoadmapPage', () => {
|
||||
cy.wait([
|
||||
'@entityMetadata',
|
||||
'@syncEntity',
|
||||
'@techdocsMetadata',
|
||||
'@roadmapHTML',
|
||||
]);
|
||||
});
|
||||
|
||||
Cypress.Commands.add('waitHomePage', () => {
|
||||
cy.wait(['@entityMetadata', '@syncEntity', '@techdocsMetadata', '@homeHTML']);
|
||||
});
|
||||
|
||||
Vendored
+35
@@ -32,5 +32,40 @@ declare namespace Cypress {
|
||||
* @example cy.mockTechDocs
|
||||
*/
|
||||
mockTechDocs(): void;
|
||||
/**
|
||||
* Get the TechDocs table of contents element
|
||||
* @example cy.getTechDocsShadowRoot
|
||||
*/
|
||||
getTechDocsTableOfContents(): Chainable<Element>;
|
||||
/**
|
||||
* Get the TechDocs navigation element
|
||||
* @example cy.getTechDocsShadowRoot
|
||||
*/
|
||||
getTechDocsNavigation(): Chainable<Element>;
|
||||
/**
|
||||
* Mock Techdocs CSS
|
||||
* @example cy.getTechDocsShadowRoot
|
||||
*/
|
||||
mockTechDocsCSS(): Chainable<Element>;
|
||||
/**
|
||||
* Intercept the TechDocs API calls
|
||||
* @example cy.getTechDocsShadowRoot
|
||||
*/
|
||||
interceptTechDocsAPICalls(): Chainable<Element>;
|
||||
/**
|
||||
* Mock SockJS-Node call
|
||||
* @example cy.getTechDocsShadowRoot
|
||||
*/
|
||||
mockSockJSNode(): Chainable<Element>;
|
||||
/**
|
||||
* Wait TechDocs API response for Backstage home page
|
||||
* @example cy.getTechDocsShadowRoot
|
||||
*/
|
||||
waitHomePage(): Chainable<Element>;
|
||||
/**
|
||||
* Wait TechDocs API response for Backstage rodmap page
|
||||
* @example cy.getTechDocsShadowRoot
|
||||
*/
|
||||
waitRoadmapPage(): Chainable<Element>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user