remove cypress

Co-authored-by: Fredrik Adelöw <freben@gmail.com>
Co-authored-by: Johan Haals <johan.haals@gmail.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-09-25 16:37:31 +02:00
parent 8d11fed246
commit a07764f44a
61 changed files with 72 additions and 4480 deletions
-35
View File
@@ -75,38 +75,3 @@ pip install mkdocs-techdocs-core
```
Then run `yarn test`.
#### Cypress (Integration and Visual regression) tests
Running cypress tests requires you to run the CLI locally against our example docs.
Run the local version of techdocs-cli against the example docs:
```sh
# From the root of this repository run
# NOTE: This will build the techdocs-cli-embedded-app and copy the output into the cli dist directory
yarn build --scope @techdocs/cli
# Navigate to the example project
cd packages/techdocs-cli/src/example-docs
# Now execute the techdocs-cli serve command
../../bin/techdocs-cli serve
```
In another shell, run the cypress tests:
```sh
# From the root of the project, navigate to the techdocs-cli package
cd packages/techdocs-cli
# Run tests
yarn test:cypress
```
This will launch a cypress app where you can run the two different tests:
- `backstage_serve` - will run against the backstage server
- `mkdocs_serve` - will run test against the mkdocs server
> If its the first time you run Cypress, it will run a "Verifying Cypress can run" step. This step can result in a "Cypress verification timed out" error. If that is the case, let the verification step run and then run the command again and it should succeed.
-30
View File
@@ -1,30 +0,0 @@
/*
* Copyright 2022 The Backstage Authors
*
* 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.
*/
import { defineConfig } from 'cypress';
import { initPlugin } from '@frsource/cypress-plugin-visual-regression-diff/plugins';
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
initPlugin(on, config);
},
excludeSpecPattern: ['**/__snapshots__/*', '**/__image_snapshots__/*'],
},
viewportWidth: 1920,
viewportHeight: 1080,
includeShadowDom: true,
});
@@ -1,12 +0,0 @@
{
"plugins": ["cypress"],
"extends": ["plugin:cypress/recommended"],
"rules": {
"jest/expect-expect": [
"error",
{
"assertFunctionNames": ["expect", "cy.contains", "cy.document"]
}
]
}
}
@@ -1,58 +0,0 @@
/*
* Copyright 2022 The Backstage Authors
*
* 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.
*/
/// <reference types="cypress" />
describe('TechDocs Live Preview - Backstage Serve', () => {
it('successfully serves documentation', () => {
cy.visit(`${Cypress.env('backstageBaseUrl')}/docs/default/component/local`);
cy.contains('hello mock docs');
});
it('successfully navigates to sub page of documentation', () => {
cy.contains('SubDocs').click();
cy.contains('Home 2').click();
cy.contains(
'This is an md file in another docs folder using the MkDocs Monorepo Plugin',
);
});
it('successfully renders all Backstage main elements', () => {
cy.contains('header', 'Live preview environment');
cy.get('[data-testid="sidebar-root"]')
.children()
.should('have.length.gt', 0);
});
it('successfully renders all extracted MkDocs main elements', () => {
// as it gets replaced by Backstage header
cy.get('.md-header').should('have.length', 0);
cy.get('.md-main').should('have.length', 1);
cy.contains(
'.md-main',
'This is an md file in another docs folder using the MkDocs Monorepo Plugin',
);
cy.get('.md-sidebar.md-sidebar--primary').should('have.length', 1);
cy.get('.md-sidebar.md-sidebar--primary').should('have.length', 1);
cy.get('.md-footer').should('have.length', 1);
});
it('matchImage - Backstage TechDocs Page', () => {
cy.visit(
`${Cypress.env('backstageBaseUrl')}/docs/default/component/local`,
).then(() => {
cy.document().matchImage();
});
});
});
@@ -1,48 +0,0 @@
/*
* Copyright 2022 The Backstage Authors
*
* 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.
*/
/// <reference types="cypress" />
describe('TechDocs Live Preview - MkDocs Serve', () => {
it('successfully serves documentation', () => {
cy.visit(Cypress.env('mkdocsBaseUrl'));
cy.contains('hello mock docs');
});
it('successfully navigates to sub page of documentation', () => {
cy.contains('SubDocs').click();
cy.contains('Home 2').click();
cy.contains(
'This is an md file in another docs folder using the MkDocs Monorepo Plugin',
);
});
it('successfully renders all main elements', () => {
cy.get('.md-header').should('have.length', 1);
cy.get('.md-main').should('have.length', 1);
cy.contains(
'.md-main',
'This is an md file in another docs folder using the MkDocs Monorepo Plugin',
);
cy.get('.md-sidebar.md-sidebar--primary').should('have.length', 1);
cy.get('.md-sidebar.md-sidebar--primary').should('have.length', 1);
cy.get('.md-footer').should('have.length', 1);
});
it('matchImage - MkDocs Page', () => {
cy.visit(Cypress.env('mkdocsBaseUrl')).then(() => {
cy.document().matchImage();
});
});
});
@@ -1,5 +0,0 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
@@ -1,40 +0,0 @@
/*
* Copyright 2022 The Backstage Authors
*
* 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.
*/
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
@@ -1,36 +0,0 @@
/*
* Copyright 2022 The Backstage Authors
*
* 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.
*/
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands';
import '@frsource/cypress-plugin-visual-regression-diff/commands';
// Alternatively you can use CommonJS syntax:
// require('./commands')
-3
View File
@@ -29,7 +29,6 @@
"test": "backstage-cli package test",
"test:e2e": "backstage-cli test --config e2e-test.config.js",
"test:e2e:ci": "backstage-cli test --config e2e-test.config.js --watchAll=false --ci",
"test:cypress": "cypress open",
"prepack": "./scripts/prepack.sh"
},
"bin": {
@@ -37,14 +36,12 @@
},
"devDependencies": {
"@backstage/cli": "workspace:^",
"@frsource/cypress-plugin-visual-regression-diff": "^3.2.8",
"@types/commander": "^2.12.2",
"@types/fs-extra": "^9.0.6",
"@types/http-proxy": "^1.17.4",
"@types/node": "^18.17.8",
"@types/serve-handler": "^6.1.0",
"@types/webpack-env": "^1.15.3",
"cypress": "^10.0.0",
"find-process": "^1.4.5",
"nodemon": "^3.0.1",
"techdocs-cli-embedded-app": "link:../techdocs-cli-embedded-app",