mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
parent
42476811a4
commit
7feaddea8f
@ -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');
|
||||
},
|
||||
|
@ -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,
|
||||
|
1
packages/grafana-e2e/src/typings/index.ts
Normal file
1
packages/grafana-e2e/src/typings/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export { undo } from './undo';
|
19
packages/grafana-e2e/src/typings/undo.ts
Normal file
19
packages/grafana-e2e/src/typings/undo.ts
Normal 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';
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user