[Search] test: removing stale cypress & functional_enterprise_search references (#220446)

## Summary

Removed old cypress and functional_enterprise_search code and
references.

They should have been removed for 9.0 but fell through the cracks.

### Checklist

- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
This commit is contained in:
Rodney Norris 2025-05-08 12:33:09 -05:00 committed by GitHub
parent 06c7c434f4
commit 9fc42af400
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 19 additions and 727 deletions

View file

@ -1,11 +1,5 @@
disabled:
# Base config files, only necessary to inform config finding script
- x-pack/test/functional_enterprise_search/base_config.ts
# Cypress configs, for now these are still run manually
- x-pack/test/functional_enterprise_search/cypress.config.ts
- x-pack/test/functional_enterprise_search/visual_config.ts
- x-pack/test/functional_enterprise_search/cli_config.ts
defaultQueue: 'n2-4-spot'
enabled:

View file

@ -73,68 +73,27 @@ sh jest.sh public/applications/shared/flash_messages/flash_messages_logic.test.t
### E2E tests
We currently have two testing libraries in which we run E2E tests:
- [Cypress](#cypress-tests)
- Will contain the majority of our happy path E2E testing
- [Kibana's Functional Test Runner (FTR)](#kibana-ftr-tests)
- Contains basic tests that only run when the Enterprise Search host is not configured
- It's likely we will not continue to expand these tests, and might even trim some over time (to be replaced by Cypress)
#### Cypress tests
Documentation: https://docs.cypress.io/
Cypress tests can be run directly from the `x-pack/solutions/search/plugins/enterprise_search` folder. You can use our handy cypress.sh script to run specific product test suites:
```bash
# Basic syntax
sh cypress.sh {run|open|dev}
# Examples
sh cypress.sh run # run Enterprise Search tests
sh cypress.sh open # open Enterprise Search tests
sh cypress.sh dev # run "cypress only" with Enterprise Search config
```
There are 3 ways you can spin up the required environments to run our Cypress tests:
1. Running Cypress against local dev environments:
- Elasticsearch:
- Start a local instance, or use Kibana's `yarn es snapshot` command (with all configurations/versions required to run Enterprise Search locally)
- NOTE: We generally recommend a fresh instance (or blowing away your `data/` folder) to reduce false negatives due to custom user data
- Kibana:
- You **must** have `csp.strict: false` and `csp.warnLegacyBrowsers: false` set in your `kibana.dev.yml`.
- You should either start Kibana with `yarn start --no-base-path` or pass `--config baseUrl=http://localhost:5601/xyz` into your Cypress command.
- Enterprise Search:
- Nothing extra is required to run Cypress tests, only what is already needed to run Kibana/Enterprise Search locally.
2. Running Cypress against Kibana's functional test server:
- Make sure docker is up and running in you system
- From the `x-pack/` project folder, run `sh cypress.sh` which will spin up Kibana, Elasticsearch through functional test runners and Enterprise Search instance in Docker.
3. Running Cypress against Enterprise Search dockerized stack scripts
- :warning: This is for Enterprise Search devs only, as this requires access to our closed source Enterprise Search repo
- `stack_scripts/start-with-es-native-auth.sh --with-kibana`
- Note that the tradeoff of an easier one-command start experience is you will not be able to run Cypress tests against any local changes.
##### Debugging
Cypress can either run silently in a headless browser in the command line (`run` or `--headless` mode), which is the default mode used by CI, or opened interactively in an included app and the Chrome browser (`open` or `--headed --no-exit` mode).
For debugging failures locally, we generally recommend using open mode, which allows you to run a single specific test suite, and makes browser dev tools available to you so you can pause and inspect DOM as needed.
> :warning: Although this is more extra caution than a hard-and-fast rule, we generally recommend taking a break and not clicking or continuing to use the app while tests are running. This can eliminate or lower the possibility of hard-to-reproduce/intermittently flaky behavior and timeouts due to user interference.
##### Artifacts
All failed tests will output a screenshot to the `x-pack/solutions/search/plugins/enterprise_search/target/cypress/screenshots` folder. We strongly recommend starting there for debugging failed tests to inspect error messages and UI state at point of failure.
To track what Cypress is doing while running tests, you can pass in `--config video=true` which will output screencaptures to a `videos/` folder for all tests (both successful and failing). This can potentially provide more context leading up to the failure point, if a static screenshot isn't providing enough information.
> :information_source: We have videos turned off in our config to reduce test runtime, especially on CI, but suggest re-enabling it for any deep debugging.
#### Kibana FTR tests
See [our functional test runner README](../../../../test/functional_enterprise_search).
FTR configs for stateful search solution are listed in `.buildkite/ftr_search_stateful_configs.yml`, the main set of functional tests for this plugin are in the [x-pack/test/functional_search](../../../../test/functional_search/) suite of tests.
Our automated accessibility tests can be found in [x-pack/test/accessibility/apps](../../../../test/accessibility/apps/group3/enterprise_search.ts).
These can be run from the root of the Kibana folder with the following command:
```shell
node scripts/functional_tests --config=x-pack/test/functional_search/config.ts --bail --quiet
```
Or if you are updating the tests it can be easier to run the server first so you can re-run the tests many times:
```shell
node scripts/functional_tests_server --config=x-pack/test/functional_search/config.ts
```
One this commands is finished starting the server you run the tests by opening another terminal and running:
```shell
node scripts/functional_test_runner --config=x-pack/test/functional_search/config.ts
```
These scripts can be used with any FTR config.

View file

@ -19,8 +19,4 @@ module.exports = {
],
coverageDirectory:
'<rootDir>/target/kibana-coverage/jest/x-pack/solutions/search/plugins/enterprise_search',
modulePathIgnorePatterns: [
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/app_search/cypress',
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/workplace_search/cypress',
],
};

View file

@ -1,38 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { defineCypressConfig } from '@kbn/cypress-config';
export default defineCypressConfig({
defaultCommandTimeout: 60000,
execTimeout: 120000,
pageLoadTimeout: 120000,
requestTimeout: 60000,
responseTimeout: 60000,
retries: {
runMode: 2,
},
screenshotOnRunFailure: false,
screenshotsFolder: '../../../../../target/kibana-fleet/cypress/screenshots',
trashAssetsBeforeRuns: false,
video: false,
videosFolder: '../../../../../target/kibana-fleet/cypress/videos',
viewportHeight: 900,
viewportWidth: 1440,
// eslint-disable-next-line sort-keys
env: {
configport: '5601',
hostname: 'localhost',
protocol: 'http',
},
// eslint-disable-next-line sort-keys
e2e: {
baseUrl: 'http://localhost:5601',
supportFile: './cypress/support/e2e.ts',
},
});

View file

@ -1,12 +0,0 @@
{
"mongo_test": {
"host": "",
"username": "",
"password": "",
"database": "",
"collection": ""
},
"crawler_test": {
"domain": ""
}
}

View file

@ -1,22 +0,0 @@
#! /bin/bash
# Use either `cypress run` or `cypress open` - defaults to run
MODE="${1}"
if [ "$MODE" == "dev" ]; then
echo "Running dev mode. This will run cypress only"
node ../../../../../node_modules/.bin/cypress open --config-file ./cypress.config.ts ${2}
else
if ! docker info > /dev/null 2>&1; then
echo "This script needs docker to run. Start docker and try again."
echo "If you are testing against your own setup use ./cypress.sh dev"
exit 1
fi
if [ "$MODE" == "open" ]; then
node ../../../../../scripts/functional_tests --config ../../test/functional_enterprise_search/visual_config.ts
else
node ../../../../../scripts/functional_tests --config ../../test/functional_enterprise_search/cli_config.ts
fi
fi

View file

@ -1,61 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { login } from '../../tasks/login';
import { NEW_INDEX_CARD, CRAWLER_INDEX, INDEX_OVERVIEW, ROUTES, getIndexRoute } from './selectors';
describe('Enterprise Search Crawler', () => {
it('test', () => {
const envConfig = Cypress.env('crawler_test');
const indexName = 'cypress-crawler-' + Math.random();
login();
cy.visit(ROUTES.NEW_INDEX);
// Crawler selected by default
cy.getBySel(NEW_INDEX_CARD.SELECT_CRAWLER).click();
// we are in correct route
cy.url().should('contain', ROUTES.NEW_INDEX);
cy.getBySel(CRAWLER_INDEX.CREATE_BUTTON).should('be.disabled');
// type new name
cy.getBySel(CRAWLER_INDEX.INDEX_NAME_INPUT).type(indexName);
// create index
cy.getBySel(CRAWLER_INDEX.CREATE_BUTTON).click();
// make sure we are in new index
cy.url().should('contain', getIndexRoute(indexName) + 'domain_management');
cy.getBySel(CRAWLER_INDEX.DOMAIN_MANAGEMENT.DOMAIN_INPUT).type(envConfig.domain);
cy.getBySel(CRAWLER_INDEX.DOMAIN_MANAGEMENT.DOMAIN_BUTTON).click();
cy.getBySel(CRAWLER_INDEX.DOMAIN_MANAGEMENT.SUBMIT_BUTTON).should('be.enabled');
cy.getBySel(CRAWLER_INDEX.DOMAIN_MANAGEMENT.SUBMIT_BUTTON).click();
cy.getBySel(CRAWLER_INDEX.CRAWL_DROPDOWN).should('be.enabled');
cy.getBySel(CRAWLER_INDEX.CRAWL_DROPDOWN).click();
cy.getBySel(CRAWLER_INDEX.CRAWL_ALL_DOMAINS).click();
// go to overview tab
cy.getBySel(INDEX_OVERVIEW.TABS.OVERVIEW).click();
// Page header has index name
cy.get('main header h1').should('contain.text', indexName);
// check Ingestion Type stat is Crawler
cy.getBySel(INDEX_OVERVIEW.STATS.INGESTION_TYPE).should('contain.text', 'Crawler');
cy.getBySel(INDEX_OVERVIEW.STATS.DOCUMENT_COUNT).should((el) => {
const text = el.text();
const count = parseInt(text.match(/[0-9]+/g), 10);
expect(count).to.gt(0);
});
});
});

View file

@ -1,95 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { login } from '../../../tasks/login';
import {
CONNECTOR_INDEX,
getIndexRoute,
INDEX_OVERVIEW,
NEW_INDEX_CARD,
NEW_CONNECTOR_PAGE,
ROUTES,
SELECT_CONNECTOR,
SEARCH_INDICES,
} from '../selectors';
describe('Enterprise Search MongoDB connector', () => {
it('succesfully syncs documents with single sync', () => {
// Get configuration information from cypress.env.json
const mongoConfig = Cypress.env('mongo_test');
const indexName = 'cypress-mongodb-' + Math.random();
const baseUrl = Cypress.config().baseUrl;
login();
cy.visit(ROUTES.SEARCH_INDICES_OVERVIEW);
cy.getBySel(SEARCH_INDICES.CREATE_INDEX_BUTTON).click();
cy.url().should('eq', baseUrl + ROUTES.NEW_INDEX);
// select connector
cy.getBySel(NEW_INDEX_CARD.SELECT_CONNECTOR).click();
// we are in correct route
cy.url().should('contain', ROUTES.SELECT_CONNECTOR);
// Select MongoDB from the list
cy.get('#checkableCard-mongodb').should('not.be.selected');
cy.get('#checkableCard-mongodb-details')
.find('a')
.invoke('attr', 'href')
.should('include', 'connectors-mongodb.html');
cy.get('#checkableCard-mongodb').click();
cy.getBySel(SELECT_CONNECTOR.SELECT_AND_CONFIGURE_BUTTON).click();
// Connector URL, mongo selected
cy.url().should('contain', 'service_type=mongodb');
cy.getBySel(NEW_CONNECTOR_PAGE.INDEX_NAME_INPUT).type(indexName);
// create index
cy.getBySel(NEW_CONNECTOR_PAGE.CREATE_BUTTON).click();
// make sure we are in new index route
cy.url().should('contain', getIndexRoute(indexName) + 'configuration');
// Fill in connector configuration
cy.getBySel(CONNECTOR_INDEX.getConfigurationRow('host')).type(mongoConfig.host);
cy.getBySel(CONNECTOR_INDEX.getConfigurationRow('user')).type(mongoConfig.username);
cy.getBySel(CONNECTOR_INDEX.getConfigurationRow('password')).type(mongoConfig.password);
cy.getBySel(CONNECTOR_INDEX.getConfigurationRow('database')).type(mongoConfig.database);
cy.getBySel(CONNECTOR_INDEX.getConfigurationRow('collection')).type(mongoConfig.collection);
cy.getBySel(CONNECTOR_INDEX.SAVE_CONFIG).click();
// Wait until configuration is saved
cy.getBySel(CONNECTOR_INDEX.EDIT_CONFIG);
cy.getBySel(CONNECTOR_INDEX.SET_SCHEDULE_BUTTON).click();
// Scheduling Tab opened
cy.url().should('contain', getIndexRoute(indexName) + 'scheduling');
// Start one time sync
cy.getBySel(CONNECTOR_INDEX.HEADER_SYNC_MENU).click();
cy.getBySel(CONNECTOR_INDEX.HEADER_SYNC_MENU_START).click();
// go to overview tab
cy.getBySel(INDEX_OVERVIEW.TABS.OVERVIEW).click();
cy.getBySel(INDEX_OVERVIEW.STATS.INGESTION_TYPE).should('contain.text', 'Connector');
cy.getBySel(INDEX_OVERVIEW.STATS.CONNECTOR_TYPE).should('contain.text', 'MongoDB');
cy.getBySel(INDEX_OVERVIEW.STATS.INGESTION_STATUS).should('contain.text', 'Configured');
cy.getBySel(INDEX_OVERVIEW.STATS.INGESTION_STATUS).should('contain.text', 'Connected');
// Wait until document count > 0
cy.getBySel(INDEX_OVERVIEW.STATS.DOCUMENT_COUNT).should((el) => {
const text = el.text();
const count = parseInt(text.match(/[0-9]+/g), 10);
expect(count).to.gt(0);
});
});
});

View file

@ -1,70 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
export const ROUTES = {
CRAWLER_INDEX: '/app/elasticsearch/content/crawlers/new_crawler',
NEW_INDEX: '/app/elasticsearch/content/search_indices/new_index',
SEARCH_INDICES_OVERVIEW: '/app/elasticsearch/content/search_indices/',
SELECT_CONNECTOR: '/app/elasticsearch/content/connectors/select_connector',
};
export const SEARCH_INDICES = {
CREATE_INDEX_BUTTON: 'entSearchContent-searchIndices-createButton',
};
export const SELECT_CONNECTOR = {
SELECT_AND_CONFIGURE_BUTTON: 'entSearchContent-connector-selectConnector-selectAndConfigure',
};
export const NEW_CONNECTOR_PAGE = {
CREATE_BUTTON: 'entSearchContent-connector-newIndex-createIndex',
INDEX_NAME_INPUT: 'entSearchContent-connector-newIndex-editName',
};
export const CONNECTOR_INDEX = {
EDIT_CONFIG: 'entSearchContent-connector-configuration-editConfiguration',
HEADER_SYNC_MENU: 'entSearchContent-connector-header-sync-menu',
HEADER_SYNC_MENU_START: 'entSearchContent-connector-header-sync-startSync',
SAVE_CONFIG: 'entSearchContent-connector-configuration-saveConfiguration',
SET_SCHEDULE_BUTTON: 'entSearchContent-connector-configuration-setScheduleAndSync',
getConfigurationRow: (rowkey: string) =>
`entSearchContent-connector-configuration-formrow-${rowkey}`,
};
export const NEW_INDEX_CARD = {
SELECT_CONNECTOR: 'entSearchContent-newIndexCard-button-connector',
SELECT_CRAWLER: 'entSearchContent-newIndexCard-button-crawler',
};
export const CRAWLER_INDEX = {
CRAWL_ALL_DOMAINS: 'entSearchContent-crawler-startCrawlMenu-crawlAllDomains',
CRAWL_DROPDOWN: 'entSearchContent-crawler-startCrawlMenu-menuButton',
CREATE_BUTTON: 'entSearchContent-crawler-newIndex-createIndex',
DOMAIN_MANAGEMENT: {
DOMAIN_BUTTON: 'entSearchContent-crawler-addDomainForm-validate-button',
DOMAIN_INPUT: 'entSearchContent-crawler-addDomainForm-validate-input',
SUBMIT_BUTTON: 'entSearchContent-crawler-addDomain-submitButton',
},
INDEX_NAME_INPUT: 'entSearchContent-crawler-newIndex-editName',
};
export const INDEX_OVERVIEW = {
STATS: {
CONNECTOR_TYPE: 'entSearchContent-indexOverview-totalStats-connectorType',
DOCUMENT_COUNT: 'entSearchContent-indexOverview-totalStats-documentCount',
INGESTION_STATUS: 'entSearchContent-indexOverview-connectorStats-ingestionStatus',
INGESTION_TYPE: 'entSearchContent-indexOverview-totalStats-ingestionType',
},
TABS: {
CRAWLER_SCHEDULER: 'entSearchContent-index-crawler-scheduler-tab',
OVERVIEW: 'entSearchContent-index-overview-tab',
},
};
export const getIndexRoute = (indexName: string) => {
return `/app/elasticsearch/content/search_indices/search-${indexName}/`;
};

View file

@ -1,55 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
// / <reference types="cypress" />
// ***********************************************************
// 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
// ***********************************************************
// Enforce building this file.
export {};
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Cypress {
interface Chainable {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
findBySel(value: string, ...args: any[]): Chainable<any>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
getBySel(value: string, ...args: any[]): Chainable<any>;
}
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function getBySel(selector: string, ...args: any[]) {
return cy.get(`[data-test-subj="${selector}"]`, ...args);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function findBySel(selector: string, ...args: any[]) {
return cy.find(`[data-test-subj="${selector}"]`, ...args);
}
Cypress.Commands.add('getBySel', getBySel);
Cypress.Commands.add('findBySel', findBySel);
Cypress.on('uncaught:exception', () => {
return false;
});

View file

@ -1,45 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
const ELASTICSEARCH_USERNAME = 'elastic';
const ELASTICSEARCH_PASSWORD = 'changeme';
const LOGIN_API_ENDPOINT = '/internal/security/login';
export const constructUrlWithUser = (route: string) => {
const url = Cypress.config().baseUrl;
const kibana = new URL(String(url));
const hostname = kibana.hostname;
const username = ELASTICSEARCH_USERNAME;
const password = ELASTICSEARCH_PASSWORD;
const protocol = kibana.protocol.replace(':', '');
const port = kibana.port;
const path = `${route.startsWith('/') ? '' : '/'}${route}`;
const strUrl = `${protocol}://${username}:${password}@${hostname}:${port}${path}`;
const builtUrl = new URL(strUrl);
cy.log(`origin: ${builtUrl.href}`);
return builtUrl.href;
};
export const login = () => {
cy.session('user', () => {
cy.request({
body: {
currentURL: '/',
params: {
password: ELASTICSEARCH_PASSWORD,
username: ELASTICSEARCH_USERNAME,
},
providerName: 'basic',
providerType: 'basic',
},
headers: { 'kbn-xsrf': 'cypress-creds-via-config' },
method: 'POST',
url: constructUrlWithUser(LOGIN_API_ENDPOINT),
});
});
};

View file

@ -1,20 +0,0 @@
{
"extends": "../../../../../../tsconfig.base.json",
"include": ["**/*", "../cypress.config.ts"],
"exclude": ["target/**/*"],
"compilerOptions": {
"outDir": "target/types",
"types": ["cypress", "node"],
"resolveJsonModule": true
},
"kbn_references": [
"@kbn/cypress-config",
// cypress projects that are nested inside of other ts project use code
// from the parent ts project in ways that can't be automatically deteceted
// at this time so we have to force the inclusion of this reference
{
"path": "../tsconfig.json",
"force": true
}
]
}

View file

@ -21,8 +21,4 @@ module.exports = {
],
coverageDirectory:
'<rootDir>/target/kibana-coverage/jest/x-pack/solutions/search/plugins/enterprise_search/public/applications/ai_search',
modulePathIgnorePatterns: [
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/app_search/cypress',
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/workplace_search/cypress',
],
};

View file

@ -21,8 +21,4 @@ module.exports = {
],
coverageDirectory:
'<rootDir>/target/kibana-coverage/jest/x-pack/solutions/search/plugins/enterprise_search/public/applications/analytics',
modulePathIgnorePatterns: [
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/app_search/cypress',
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/workplace_search/cypress',
],
};

View file

@ -21,8 +21,4 @@ module.exports = {
],
coverageDirectory:
'<rootDir>/target/kibana-coverage/jest/x-pack/solutions/search/plugins/enterprise_search/public/applications/applications',
modulePathIgnorePatterns: [
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/app_search/cypress',
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/workplace_search/cypress',
],
};

View file

@ -21,8 +21,4 @@ module.exports = {
],
coverageDirectory:
'<rootDir>/target/kibana-coverage/jest/x-pack/solutions/search/plugins/enterprise_search/public/applications/elasticsearch',
modulePathIgnorePatterns: [
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/app_search/cypress',
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/workplace_search/cypress',
],
};

View file

@ -21,8 +21,4 @@ module.exports = {
],
coverageDirectory:
'<rootDir>/target/kibana-coverage/jest/x-pack/solutions/search/plugins/enterprise_search/public/applications/enterprise_search_content',
modulePathIgnorePatterns: [
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/app_search/cypress',
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/workplace_search/cypress',
],
};

View file

@ -1,31 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { defineCypressConfig } from '@kbn/cypress-config';
export default defineCypressConfig({
defaultCommandTimeout: 120000,
e2e: {
baseUrl: 'http://localhost:5601',
supportFile: false,
},
env: {
password: 'changeme',
username: 'elastic',
},
execTimeout: 120000,
fixturesFolder: false,
pageLoadTimeout: 180000,
retries: {
runMode: 2,
},
screenshotsFolder: '../../../target/cypress/screenshots',
video: false,
videosFolder: '../../../target/cypress/videos',
viewportHeight: 1200,
viewportWidth: 1600,
});

View file

@ -1,46 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { login, checkA11y } from '../../../shared/cypress/commands';
import { homePath } from '../../../shared/cypress/routes';
context('Enterprise Search Overview', () => {
beforeEach(() => {
login();
});
it('should contain product cards', () => {
cy.visit(homePath);
cy.contains('Welcome to Elastic Enterprise Search');
cy.get('[data-test-subj="appSearchProductCard"]')
.contains('Open App Search')
.should('have.attr', 'href')
.and('match', /app_search/);
cy.get('[data-test-subj="workplaceSearchProductCard"]')
.contains('Open Workplace Search')
.should('have.attr', 'href')
.and('match', /workplace_search/);
checkA11y();
});
it('should have a setup guide', () => {
// @see https://github.com/quasarframework/quasar/issues/2233#issuecomment-492975745
// This only appears to occur for setup guides - I haven't (yet?) run into it on other pages
cy.on('uncaught:exception', (err) => {
if (err.message.includes('> ResizeObserver loop limit exceeded')) return false;
});
cy.visit(`${homePath}/setup_guide`);
cy.contains('Setup Guide');
cy.contains('Add your Enterprise Search host URL to your Kibana configuration');
checkA11y();
});
});

View file

@ -1,18 +0,0 @@
{
"extends": "../../shared/cypress/tsconfig.json",
"compilerOptions": { "outDir": "target/types" },
"include": ["./**/*"],
"exclude": [
"target/**/*",
],
"kbn_references": [
{ "path": "../../shared/cypress/tsconfig.json" },
// cypress projects that are nested inside of other ts project use code
// from the parent ts project in ways that can't be automatically deteceted
// at this time so we have to force the inclusion of this reference
{
"path": "../../../../tsconfig.json",
"force": true
},
],
}

View file

@ -21,8 +21,4 @@ module.exports = {
],
coverageDirectory:
'<rootDir>/target/kibana-coverage/jest/x-pack/solutions/search/plugins/enterprise_search/public/applications/enterprise_search_overview',
modulePathIgnorePatterns: [
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/app_search/cypress',
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/workplace_search/cypress',
],
};

View file

@ -21,8 +21,4 @@ module.exports = {
],
coverageDirectory:
'<rootDir>/target/kibana-coverage/jest/x-pack/solutions/search/plugins/enterprise_search/public/applications/enterprise_search_redirect',
modulePathIgnorePatterns: [
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/app_search/cypress',
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/workplace_search/cypress',
],
};

View file

@ -21,8 +21,4 @@ module.exports = {
],
coverageDirectory:
'<rootDir>/target/kibana-coverage/jest/x-pack/solutions/search/plugins/enterprise_search/public/applications/search_experiences',
modulePathIgnorePatterns: [
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/app_search/cypress',
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/workplace_search/cypress',
],
};

View file

@ -21,8 +21,4 @@ module.exports = {
],
coverageDirectory:
'<rootDir>/target/kibana-coverage/jest/x-pack/solutions/search/plugins/enterprise_search/public/applications/semantic_search',
modulePathIgnorePatterns: [
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/app_search/cypress',
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/workplace_search/cypress',
],
};

View file

@ -1,66 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
/*
* Shared non-product-specific commands
*/
/*
* Log in a user via XHR
* @see https://docs.cypress.io/guides/getting-started/testing-your-app#Logging-in
*/
interface Login {
username?: string;
password?: string;
}
export const login = ({
username = Cypress.env('username'),
password = Cypress.env('password'),
}: Login = {}) => {
cy.request({
method: 'POST',
url: '/internal/security/login',
headers: { 'kbn-xsrf': 'cypress' },
body: {
providerType: 'basic',
providerName: 'basic',
currentURL: '/',
params: { username, password },
},
});
};
/*
* Cypress setup/helpers
*/
// eslint complains this should be in `dependencies` and not `devDependencies`, but these tests should only run on dev
import 'cypress-axe';
import { AXE_CONFIG, AXE_OPTIONS } from '@kbn/axe-config';
const axeConfig = {
...AXE_CONFIG,
rules: [
...AXE_CONFIG.rules,
{
id: 'landmark-no-duplicate-banner',
selector: '[data-test-subj="headerGlobalNav"]',
},
],
};
const axeOptions = {
...AXE_OPTIONS,
runOnly: [...AXE_OPTIONS.runOnly, 'best-practice'],
};
// @see https://github.com/component-driven/cypress-axe#cychecka11y for params
export const checkA11y = () => {
cy.injectAxe();
cy.configureAxe(axeConfig);
const context = '.kbnAppWrapper'; // Scopes a11y checks to only our app
cy.checkA11y(context, axeOptions);
};

View file

@ -1,10 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
export const homePath = '/app/elasticsearch/overview';
export const appSearchPath = '/app/enterprise_search/app_search';
export const workplaceSearchPath = '/app/enterprise_search/workplace_search';

View file

@ -1,14 +0,0 @@
{
"extends": "../../../../../../../../../tsconfig.base.json",
"include": ["./**/*"],
"compilerOptions": {
"outDir": "target/types",
"types": ["cypress", "cypress-axe", "node"]
},
"exclude": [
"target/**/*",
],
"kbn_references": [
"@kbn/axe-config",
],
}

View file

@ -19,8 +19,4 @@ module.exports = {
],
coverageDirectory:
'<rootDir>/target/kibana-coverage/jest/x-pack/solutions/search/plugins/enterprise_search/public/applications/shared',
modulePathIgnorePatterns: [
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/app_search/cypress',
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/workplace_search/cypress',
],
};

View file

@ -21,8 +21,4 @@ module.exports = {
],
coverageDirectory:
'<rootDir>/target/kibana-coverage/jest/x-pack/solutions/search/plugins/enterprise_search/public/applications/vector_search',
modulePathIgnorePatterns: [
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/app_search/cypress',
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/workplace_search/cypress',
],
};

View file

@ -23,8 +23,4 @@ module.exports = {
],
coverageDirectory:
'<rootDir>/target/kibana-coverage/jest/x-pack/solutions/search/plugins/enterprise_search',
modulePathIgnorePatterns: [
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/app_search/cypress',
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/workplace_search/cypress',
],
};

View file

@ -19,8 +19,4 @@ module.exports = {
],
coverageDirectory:
'<rootDir>/target/kibana-coverage/jest/x-pack/solutions/search/plugins/enterprise_search',
modulePathIgnorePatterns: [
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/app_search/cypress',
'<rootDir>/x-pack/solutions/search/plugins/enterprise_search/public/applications/workplace_search/cypress',
],
};

View file

@ -4,7 +4,6 @@
"outDir": "target/types",
},
"exclude": [
"public/applications/**/cypress/**/*",
"target/**/*",
],
"include": [
@ -41,7 +40,6 @@
"@kbn/core-http-server",
"@kbn/core-saved-objects-server",
"@kbn/data-views-plugin",
"@kbn/cypress-config",
"@kbn/discover-plugin",
"@kbn/guided-onboarding",
"@kbn/shared-ux-router",