Chore: adding platform independent typings for e2e tests. (#27768)

* added typings that are platform independent in the tests.

* fixing nits.
This commit is contained in:
Marcus Andersson 2020-09-24 18:47:25 +02:00 committed by GitHub
parent 42476811a4
commit 7feaddea8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 1 deletions

View File

@ -29,7 +29,7 @@ e2e.scenario({
cy.contains(queryText.slice(0, -1)).should('be.visible');
e2e.components.QueryField.container().type('{ctrl}z');
e2e.components.QueryField.container().type(e2e.typings.undo());
cy.contains(queryText).should('be.visible');
},

View File

@ -8,6 +8,7 @@ import { getScenarioContext, setScenarioContext } from './support/scenarioContex
import { e2eFactory } from './support';
import { selectors } from '@grafana/e2e-selectors';
import * as flows from './flows';
import * as typings from './typings';
const e2eObject = {
env: (args: string) => Cypress.env(args),
@ -16,6 +17,7 @@ const e2eObject = {
imgSrcToBlob: (url: string) => Cypress.Blob.imgSrcToBlob(url),
scenario: (args: ScenarioArguments) => e2eScenario(args),
pages: e2eFactory({ selectors: selectors.pages }),
typings,
components: e2eFactory({ selectors: selectors.components }),
flows,
getScenarioContext,

View File

@ -0,0 +1 @@
export { undo } from './undo';

View File

@ -0,0 +1,19 @@
// https://nodejs.org/api/os.html#os_os_platform
enum Platform {
osx = 'darwin',
windows = 'win32',
linux = 'linux',
aix = 'aix',
freebsd = 'freebsd',
openbsd = 'openbsd',
sunos = 'sunos',
}
export const undo = () => {
switch (Cypress.platform) {
case Platform.osx:
return '{cmd}z';
default:
return '{ctrl}z';
}
};