Skip to content

Commit

Permalink
Merge branch 'master' into integrations-separate-app
Browse files Browse the repository at this point in the history
  • Loading branch information
kpollich committed Jun 4, 2021
2 parents 457f450 + 090d0ab commit a361845
Show file tree
Hide file tree
Showing 111 changed files with 6,763 additions and 6,002 deletions.
50 changes: 25 additions & 25 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
# Client Side Monitoring / Uptime (lives in APM directories but owned by Uptime)
/x-pack/plugins/apm/e2e/cypress/support/step_definitions/csm @elastic/uptime
/x-pack/plugins/apm/e2e/cypress/integration/csm_dashboard.feature @elastic/uptime
/x-pack/plugins/apm/public/application/csmApp.tsx @elastic/uptime
/x-pack/plugins/apm/public/application/uxApp.tsx @elastic/uptime
/x-pack/plugins/apm/public/components/app/RumDashboard @elastic/uptime
/x-pack/plugins/apm/server/lib/rum_client @elastic/uptime
/x-pack/plugins/apm/server/routes/rum_client.ts @elastic/uptime
Expand Down Expand Up @@ -128,7 +128,7 @@
/x-pack/test/functional_basic/apps/ml/ @elastic/ml-ui
/x-pack/test/functional_with_es_ssl/apps/ml/ @elastic/ml-ui

# ML team owns and maintains the transform plugin despite it living in the Elasticsearch management section.
# ML team owns and maintains the transform plugin despite it living in the Data management section.
/x-pack/plugins/transform/ @elastic/ml-ui
/x-pack/test/accessibility/apps/transform.ts @elastic/ml-ui
/x-pack/test/api_integration/apis/transform/ @elastic/ml-ui
Expand Down Expand Up @@ -305,29 +305,29 @@
/x-pack/plugins/enterprise_search/server/collectors/workplace_search/ @elastic/workplace-search-frontend
/x-pack/plugins/enterprise_search/server/saved_objects/workplace_search/ @elastic/workplace-search-frontend

# Elasticsearch UI
/src/plugins/dev_tools/ @elastic/es-ui
/src/plugins/console/ @elastic/es-ui
/src/plugins/es_ui_shared/ @elastic/es-ui
/x-pack/plugins/cross_cluster_replication/ @elastic/es-ui
/x-pack/plugins/index_lifecycle_management/ @elastic/es-ui
/x-pack/plugins/console_extensions/ @elastic/es-ui
/x-pack/plugins/grokdebugger/ @elastic/es-ui
/x-pack/plugins/index_management/ @elastic/es-ui
/x-pack/plugins/license_api_guard/ @elastic/es-ui
/x-pack/plugins/license_management/ @elastic/es-ui
/x-pack/plugins/painless_lab/ @elastic/es-ui
/x-pack/plugins/remote_clusters/ @elastic/es-ui
/x-pack/plugins/rollup/ @elastic/es-ui
/x-pack/plugins/searchprofiler/ @elastic/es-ui
/x-pack/plugins/snapshot_restore/ @elastic/es-ui
/x-pack/plugins/upgrade_assistant/ @elastic/es-ui
/x-pack/plugins/watcher/ @elastic/es-ui
/x-pack/plugins/ingest_pipelines/ @elastic/es-ui
/packages/kbn-ace/ @elastic/es-ui
/packages/kbn-monaco/ @elastic/es-ui
#CC# /x-pack/plugins/console_extensions/ @elastic/es-ui
#CC# /x-pack/plugins/cross_cluster_replication/ @elastic/es-ui
# Stack Management
/src/plugins/dev_tools/ @elastic/kibana-stack-management
/src/plugins/console/ @elastic/kibana-stack-management
/src/plugins/es_ui_shared/ @elastic/kibana-stack-management
/x-pack/plugins/cross_cluster_replication/ @elastic/kibana-stack-management
/x-pack/plugins/index_lifecycle_management/ @elastic/kibana-stack-management
/x-pack/plugins/console_extensions/ @elastic/kibana-stack-management
/x-pack/plugins/grokdebugger/ @elastic/kibana-stack-management
/x-pack/plugins/index_management/ @elastic/kibana-stack-management
/x-pack/plugins/license_api_guard/ @elastic/kibana-stack-management
/x-pack/plugins/license_management/ @elastic/kibana-stack-management
/x-pack/plugins/painless_lab/ @elastic/kibana-stack-management
/x-pack/plugins/remote_clusters/ @elastic/kibana-stack-management
/x-pack/plugins/rollup/ @elastic/kibana-stack-management
/x-pack/plugins/searchprofiler/ @elastic/kibana-stack-management
/x-pack/plugins/snapshot_restore/ @elastic/kibana-stack-management
/x-pack/plugins/upgrade_assistant/ @elastic/kibana-stack-management
/x-pack/plugins/watcher/ @elastic/kibana-stack-management
/x-pack/plugins/ingest_pipelines/ @elastic/kibana-stack-management
/packages/kbn-ace/ @elastic/kibana-stack-management
/packages/kbn-monaco/ @elastic/kibana-stack-management
#CC# /x-pack/plugins/console_extensions/ @elastic/kibana-stack-management
#CC# /x-pack/plugins/cross_cluster_replication/ @elastic/kibana-stack-management

# Security Solution
/x-pack/test/endpoint_api_integration_no_ingest/ @elastic/security-solution
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-legacy-logging/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ NPM_MODULE_EXTRA_FILES = [

SRC_DEPS = [
"//packages/kbn-config-schema",
"//packages/kbn-utils",
"@npm//@elastic/numeral",
"@npm//@hapi/hapi",
"@npm//chokidar",
Expand Down
6 changes: 6 additions & 0 deletions packages/kbn-test/src/functional_test_runner/public_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ export interface GenericFtrProviderContext<
getService(serviceName: 'failureMetadata'): FailureMetadata;
getService<T extends keyof ServiceMap>(serviceName: T): ServiceMap[T];

/**
* Get the instance of a page object
* @param pageObjectName
*/
getPageObject<K extends keyof PageObjectMap>(pageObjectName: K): PageObjectMap[K];

/**
* Get a map of PageObjects
* @param pageObjects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
* Side Public License, v 1.
*/

import { GenericFtrProviderContext } from '@kbn/test';
import { GenericFtrProviderContext, GenericFtrService } from '@kbn/test';

import { pageObjects } from './page_objects';
import { services } from './services';

export type FtrProviderContext = GenericFtrProviderContext<typeof services, typeof pageObjects>;
export class FtrService extends GenericFtrService<FtrProviderContext> {}
136 changes: 67 additions & 69 deletions test/accessibility/services/a11y/a11y.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import chalk from 'chalk';
import testSubjectToCss from '@kbn/test-subj-selector';

import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrService } from '../../ftr_provider_context';
import { AxeReport, printResult } from './axe_report';
// @ts-ignore JS that is run in browser as is
import { analyzeWithAxe, analyzeWithAxeWithClient } from './analyze_with_axe';
Expand All @@ -33,86 +33,84 @@ export const normalizeResult = (report: any) => {
return report.result as false | AxeReport;
};

export function A11yProvider({ getService }: FtrProviderContext) {
const browser = getService('browser');
const Wd = getService('__webdriver__');

/**
* Accessibility testing service using the Axe (https://www.deque.com/axe/)
* toolset to validate a11y rules similar to ESLint. In order to test against
* the rules we must load up the UI and feed a full HTML snapshot into Axe.
*/
return new (class Accessibility {
public async testAppSnapshot(options: TestOptions = {}) {
const context = this.getAxeContext(true, options.excludeTestSubj);
const report = await this.captureAxeReport(context);
await this.testAxeReport(report);
}
/**
* Accessibility testing service using the Axe (https://www.deque.com/axe/)
* toolset to validate a11y rules similar to ESLint. In order to test against
* the rules we must load up the UI and feed a full HTML snapshot into Axe.
*/
export class AccessibilityService extends FtrService {
private readonly browser = this.ctx.getService('browser');
private readonly Wd = this.ctx.getService('__webdriver__');

public async testAppSnapshot(options: TestOptions = {}) {
const context = this.getAxeContext(true, options.excludeTestSubj);
const report = await this.captureAxeReport(context);
this.assertValidAxeReport(report);
}

public async testGlobalSnapshot(options: TestOptions = {}) {
const context = this.getAxeContext(false, options.excludeTestSubj);
const report = await this.captureAxeReport(context);
await this.testAxeReport(report);
}
public async testGlobalSnapshot(options: TestOptions = {}) {
const context = this.getAxeContext(false, options.excludeTestSubj);
const report = await this.captureAxeReport(context);
this.assertValidAxeReport(report);
}

private getAxeContext(global: boolean, excludeTestSubj?: string | string[]): AxeContext {
return {
include: global ? undefined : [testSubjectToCss('appA11yRoot')],
exclude: ([] as string[])
.concat(excludeTestSubj || [])
.map((ts) => [testSubjectToCss(ts)])
.concat([['[role="graphics-document"][aria-roledescription="visualization"]']]),
};
}
private getAxeContext(global: boolean, excludeTestSubj?: string | string[]): AxeContext {
return {
include: global ? undefined : [testSubjectToCss('appA11yRoot')],
exclude: ([] as string[])
.concat(excludeTestSubj || [])
.map((ts) => [testSubjectToCss(ts)])
.concat([['[role="graphics-document"][aria-roledescription="visualization"]']]),
};
}

private testAxeReport(report: AxeReport) {
const errorMsgs = [];
private assertValidAxeReport(report: AxeReport) {
const errorMsgs = [];

for (const result of report.violations) {
errorMsgs.push(printResult(chalk.red('VIOLATION'), result));
}
for (const result of report.violations) {
errorMsgs.push(printResult(chalk.red('VIOLATION'), result));
}

if (errorMsgs.length) {
throw new Error(`a11y report:\n${errorMsgs.join('\n')}`);
}
if (errorMsgs.length) {
throw new Error(`a11y report:\n${errorMsgs.join('\n')}`);
}
}

private async captureAxeReport(context: AxeContext): Promise<AxeReport> {
const axeOptions = {
reporter: 'v2',
runOnly: ['wcag2a', 'wcag2aa'],
rules: {
'color-contrast': {
enabled: false, // disabled because we have too many failures
},
bypass: {
enabled: false, // disabled because it's too flaky
},
private async captureAxeReport(context: AxeContext): Promise<AxeReport> {
const axeOptions = {
reporter: 'v2',
runOnly: ['wcag2a', 'wcag2aa'],
rules: {
'color-contrast': {
enabled: false, // disabled because we have too many failures
},
};

await (Wd.driver.manage() as any).setTimeouts({
...(await (Wd.driver.manage() as any).getTimeouts()),
script: 600000,
});
bypass: {
enabled: false, // disabled because it's too flaky
},
},
};

const report = normalizeResult(
await browser.executeAsync(analyzeWithAxe, context, axeOptions)
);
await this.Wd.driver.manage().setTimeouts({
...(await this.Wd.driver.manage().getTimeouts()),
script: 600000,
});

if (report !== false) {
return report;
}
const report = normalizeResult(
await this.browser.executeAsync(analyzeWithAxe, context, axeOptions)
);

const withClientReport = normalizeResult(
await browser.executeAsync(analyzeWithAxeWithClient, context, axeOptions)
);
if (report !== false) {
return report;
}

if (withClientReport === false) {
throw new Error('Attempted to analyze with axe but failed to load axe client');
}
const withClientReport = normalizeResult(
await this.browser.executeAsync(analyzeWithAxeWithClient, context, axeOptions)
);

return withClientReport;
if (withClientReport === false) {
throw new Error('Attempted to analyze with axe but failed to load axe client');
}
})();

return withClientReport;
}
}
2 changes: 1 addition & 1 deletion test/accessibility/services/a11y/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
* Side Public License, v 1.
*/

export { A11yProvider } from './a11y';
export * from './a11y';
4 changes: 2 additions & 2 deletions test/accessibility/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
*/

import { services as kibanaFunctionalServices } from '../../functional/services';
import { A11yProvider } from './a11y';
import { AccessibilityService } from './a11y';

export const services = {
...kibanaFunctionalServices,
a11y: A11yProvider,
a11y: AccessibilityService,
};
Loading

0 comments on commit a361845

Please sign in to comment.