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:
@@ -29,7 +29,7 @@ e2e.scenario({
|
|||||||
|
|
||||||
cy.contains(queryText.slice(0, -1)).should('be.visible');
|
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');
|
cy.contains(queryText).should('be.visible');
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { getScenarioContext, setScenarioContext } from './support/scenarioContex
|
|||||||
import { e2eFactory } from './support';
|
import { e2eFactory } from './support';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import * as flows from './flows';
|
import * as flows from './flows';
|
||||||
|
import * as typings from './typings';
|
||||||
|
|
||||||
const e2eObject = {
|
const e2eObject = {
|
||||||
env: (args: string) => Cypress.env(args),
|
env: (args: string) => Cypress.env(args),
|
||||||
@@ -16,6 +17,7 @@ const e2eObject = {
|
|||||||
imgSrcToBlob: (url: string) => Cypress.Blob.imgSrcToBlob(url),
|
imgSrcToBlob: (url: string) => Cypress.Blob.imgSrcToBlob(url),
|
||||||
scenario: (args: ScenarioArguments) => e2eScenario(args),
|
scenario: (args: ScenarioArguments) => e2eScenario(args),
|
||||||
pages: e2eFactory({ selectors: selectors.pages }),
|
pages: e2eFactory({ selectors: selectors.pages }),
|
||||||
|
typings,
|
||||||
components: e2eFactory({ selectors: selectors.components }),
|
components: e2eFactory({ selectors: selectors.components }),
|
||||||
flows,
|
flows,
|
||||||
getScenarioContext,
|
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';
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user