mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
Co-authored-by: Yuliia Naumenko <jo.naumenko@gmail.com> Co-authored-by: Thomas Watson <w@tson.dk> Co-authored-by: Kyle Pollich <kyle.pollich@elastic.co> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
56 lines
1.7 KiB
TypeScript
56 lines
1.7 KiB
TypeScript
/*
|
|
* 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
|
|
// ***********************************************************
|
|
|
|
// Import commands.js using ES2015 syntax:
|
|
import { request } from '../tasks/common';
|
|
import './commands';
|
|
|
|
declare global {
|
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
namespace Cypress {
|
|
interface Chainable {
|
|
getBySel(value: string, ...args: any[]): Chainable<any>;
|
|
getKibanaVersion(): Chainable<string>;
|
|
}
|
|
}
|
|
}
|
|
|
|
function getBySel(selector: string, ...args: any[]) {
|
|
return cy.get(`[data-test-subj="${selector}"]`, ...args);
|
|
}
|
|
|
|
function getKibanaVersion() {
|
|
return request<{ version: { number: string } }>({ url: '/api/status' }).then(({ body }) => {
|
|
return body.version.number;
|
|
});
|
|
}
|
|
|
|
Cypress.Commands.add('getBySel', getBySel);
|
|
Cypress.Commands.add('getKibanaVersion', getKibanaVersion);
|
|
|
|
// Alternatively you can use CommonJS syntax:
|
|
// require('./commands')
|
|
Cypress.on('uncaught:exception', () => {
|
|
return false;
|
|
});
|