Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
e96f9620
Unverified
Commit
e96f9620
authored
Dec 13, 2019
by
Hugo Häggmark
Committed by
GitHub
Dec 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
e2e: Uses should on first element after visit to prevent flakiness (#21077)
parent
1aa39ee4
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
37 additions
and
12 deletions
+37
-12
packages/grafana-e2e/src/flows/addDataSource.ts
+4
-1
packages/grafana-e2e/src/flows/login.ts
+3
-1
packages/grafana-e2e/src/flows/openDashboard.ts
+2
-3
packages/grafana-e2e/src/noTypeCheck.ts
+1
-1
packages/grafana-e2e/src/pages/dashboard.ts
+1
-1
packages/grafana-e2e/src/support/types.ts
+18
-2
public/e2e-tests/integration/smoketests.spec.ts
+4
-2
public/e2e-tests/tsconfig.json
+4
-1
No files found.
packages/grafana-e2e/src/flows/addDataSource.ts
View file @
e96f9620
...
...
@@ -4,7 +4,10 @@ export const addDataSource = (pluginName?: string): string => {
pluginName
=
pluginName
||
'TestData DB'
;
e2e
().
logToConsole
(
'Adding data source with pluginName:'
,
pluginName
);
e2e
.
pages
.
AddDataSource
.
visit
();
e2e
.
pages
.
AddDataSource
.
dataSourcePlugins
(
pluginName
).
click
();
e2e
.
pages
.
AddDataSource
.
dataSourcePlugins
(
pluginName
)
.
scrollIntoView
()
.
should
(
'be.visible'
)
// prevents flakiness
.
click
();
const
dataSourceName
=
`e2e-
${
new
Date
().
getTime
()}
`
;
e2e
.
pages
.
DataSource
.
name
().
clear
();
...
...
packages/grafana-e2e/src/flows/login.ts
View file @
e96f9620
...
...
@@ -3,7 +3,9 @@ import { e2e } from '../index';
export
const
login
=
(
username
:
string
,
password
:
string
)
=>
{
e2e
().
logToConsole
(
'Trying to login with:'
,
{
username
,
password
});
e2e
.
pages
.
Login
.
visit
();
e2e
.
pages
.
Login
.
username
().
type
(
username
);
e2e
.
pages
.
Login
.
username
()
.
should
(
'be.visible'
)
// prevents flakiness
.
type
(
username
);
e2e
.
pages
.
Login
.
password
().
type
(
password
);
e2e
.
pages
.
Login
.
submit
().
click
();
e2e
().
logToConsole
(
'Logged in with'
,
{
username
,
password
});
...
...
packages/grafana-e2e/src/flows/openDashboard.ts
View file @
e96f9620
import
{
e2e
}
from
'../index'
;
export
const
openDashboard
=
(
dashboardTitle
:
string
)
=>
{
e2e
.
pages
.
Dashboards
.
visit
();
e2e
.
pages
.
Dashboards
.
dashboards
(
dashboardTitle
).
click
();
export
const
openDashboard
=
(
dashboardUid
:
string
)
=>
{
e2e
.
pages
.
Dashboard
.
visit
(
dashboardUid
);
};
packages/grafana-e2e/src/noTypeCheck.ts
View file @
e96f9620
...
...
@@ -9,7 +9,7 @@ import { Flows } from './flows';
export
type
SelectorFunction
=
(
text
?:
string
)
=>
Cypress
.
Chainable
<
any
>
;
export
type
SelectorObject
<
S
>
=
{
visit
:
()
=>
Cypress
.
Chainable
<
any
>
;
visit
:
(
args
?:
string
)
=>
Cypress
.
Chainable
<
any
>
;
selectors
:
S
;
};
...
...
packages/grafana-e2e/src/pages/dashboard.ts
View file @
e96f9620
import
{
pageFactory
}
from
'../support'
;
export
const
Dashboard
=
pageFactory
({
url
:
''
,
url
:
(
uid
:
string
)
=>
`/d/
${
uid
}
`
,
selectors
:
{
toolbarItems
:
(
button
:
string
)
=>
`Dashboard navigation bar button
${
button
}
`
,
backArrow
:
'Dashboard settings Go Back button'
,
...
...
packages/grafana-e2e/src/support/types.ts
View file @
e96f9620
...
...
@@ -7,12 +7,28 @@ export type Selectors = Record<string, string | Function>;
export
type
PageObjects
<
S
>
=
{
[
P
in
keyof
S
]:
SelectorFunction
};
export
type
PageFactory
<
S
>
=
PageObjects
<
S
>
&
SelectorObject
<
S
>
;
export
interface
PageFactoryArgs
<
S
extends
Selectors
>
{
url
?:
string
;
url
?:
string
|
Function
;
selectors
:
S
;
}
export
const
pageFactory
=
<
S
extends
Selectors
>
({
url
,
selectors
}:
PageFactoryArgs
<
S
>
):
PageFactory
<
S
>
=>
{
const
visit
=
()
=>
e2e
().
visit
(
Url
.
fromBaseUrl
(
url
));
const
visit
=
(
args
?:
string
)
=>
{
if
(
!
url
)
{
return
e2e
().
visit
(
''
);
}
let
parsedUrl
=
''
;
if
(
typeof
url
===
'string'
)
{
parsedUrl
=
Url
.
fromBaseUrl
(
url
);
}
if
(
typeof
url
===
'function'
&&
args
)
{
parsedUrl
=
Url
.
fromBaseUrl
(
url
(
args
));
}
e2e
().
logToConsole
(
'Visiting'
,
parsedUrl
);
return
e2e
().
visit
(
parsedUrl
);
};
const
pageObjects
:
PageObjects
<
S
>
=
{}
as
PageObjects
<
S
>
;
const
keys
=
Object
.
keys
(
selectors
);
...
...
public/e2e-tests/integration/smoketests.spec.ts
View file @
e96f9620
...
...
@@ -8,8 +8,10 @@ e2e.scenario({
addScenarioDashBoard
:
true
,
skipScenario
:
false
,
scenario
:
({
dataSourceName
,
dashboardTitle
,
dashboardUid
}:
ScenarioContext
)
=>
{
e2e
.
flows
.
openDashboard
(
dashboardTitle
);
e2e
.
pages
.
Dashboard
.
toolbarItems
(
'Add panel'
).
click
();
e2e
.
flows
.
openDashboard
(
dashboardUid
);
e2e
.
pages
.
Dashboard
.
toolbarItems
(
'Add panel'
)
.
should
(
'be.visible'
)
// prevents flakiness
.
click
();
e2e
.
pages
.
AddDashboard
.
ctaButtons
(
'Add Query'
).
click
();
e2e
.
pages
.
Panels
.
EditPanel
.
tabItems
(
'Queries'
).
click
();
...
...
public/e2e-tests/tsconfig.json
View file @
e96f9620
{
"extends"
:
"../../tsconfig.json"
,
"include"
:
[
"**/*.ts"
]
"compilerOptions"
:
{
"types"
:
[
"cypress"
]
},
"include"
:
[
"**/*.ts"
,
"../../packages/grafana-e2e/cypress/support/index.d.ts"
]
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment