Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nghyd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
A compter du 1er avril, attention à vos pipelines :
Nouvelles limitations de Docker Hub
Show more breadcrumbs
Cassiopée
nghyd
Commits
652f8631
Commit
652f8631
authored
2 years ago
by
François Grand
Browse files
Options
Downloads
Patches
Plain Diff
refactor(e2e): move loadSession() function to util.po
refs
#614
parent
eae03513
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
e2e/load-save-session.e2e-spec.ts
+4
-14
4 additions, 14 deletions
e2e/load-save-session.e2e-spec.ts
e2e/util.po.ts
+15
-0
15 additions, 0 deletions
e2e/util.po.ts
with
19 additions
and
14 deletions
e2e/load-save-session.e2e-spec.ts
+
4
−
14
View file @
652f8631
...
...
@@ -5,7 +5,7 @@ import { Navbar } from "./navbar.po";
import
{
SideNav
}
from
"
./sidenav.po
"
;
import
{
browser
,
by
,
element
}
from
"
protractor
"
;
import
{
PreferencesPage
}
from
"
./preferences.po
"
;
import
{
changeSelectValue
,
expectNumber
}
from
"
./util.po
"
;
import
{
changeSelectValue
,
expectNumber
,
loadSession
}
from
"
./util.po
"
;
const
fs
=
require
(
"
fs
"
);
const
path
=
require
(
"
path
"
);
...
...
@@ -86,16 +86,6 @@ async function saveSession(): Promise<string> {
return
findDownloadedFile
(
sessionFile
);
}
async
function
loadSession
(
path
:
string
)
{
await
navbar
.
clickMenuButton
();
await
browser
.
sleep
(
200
);
await
sidenav
.
clickLoadSessionButton
();
await
browser
.
sleep
(
200
);
await
sidenav
.
loadSessionFile
(
path
);
}
/**
* Save and load (serialise and unserialise) calculators to/from JSON files
*/
...
...
@@ -117,7 +107,7 @@ describe("ngHyd − save and load sessions", () => {
it
(
"
when loading session-6-calc.test.json file from home page, 6 calculators should be loaded
"
,
async
()
=>
{
await
startPage
.
navigateTo
();
await
loadSession
(
"
./session/session-6-calc.test.json
"
);
await
loadSession
(
navbar
,
sidenav
,
"
./session/session-6-calc.test.json
"
);
await
browser
.
sleep
(
1000
);
expect
(
await
navbar
.
getAllCalculatorTabs
().
count
()).
toBe
(
6
);
...
...
@@ -126,7 +116,7 @@ describe("ngHyd − save and load sessions", () => {
it
(
"
when loading session-optional-params.test.json file from home page, the calculator should be loaded
"
,
async
()
=>
{
await
startPage
.
navigateTo
();
await
loadSession
(
"
./session/session-optional-params.test.json
"
);
await
loadSession
(
navbar
,
sidenav
,
"
./session/session-optional-params.test.json
"
);
await
browser
.
sleep
(
200
);
expect
(
await
navbar
.
getAllCalculatorTabs
().
count
()).
toBe
(
1
);
...
...
@@ -219,7 +209,7 @@ describe("ngHyd − save and load sessions", () => {
await
browser
.
sleep
(
200
);
// load session
await
loadSession
(
filename
);
// bug here : the click on the menu button (top left) takes 40s to take effect and open the side nav!)
await
loadSession
(
navbar
,
sidenav
,
filename
);
// bug here : the click on the menu button (top left) takes 40s to take effect and open the side nav!)
await
browser
.
sleep
(
200
);
// the displayed calculator is now the loaded one
...
...
This diff is collapsed.
Click to expand it.
e2e/util.po.ts
+
15
−
0
View file @
652f8631
import
{
ElementFinder
,
browser
,
by
,
element
}
from
"
protractor
"
;
import
{
Navbar
}
from
"
./navbar.po
"
;
import
{
SideNav
}
from
"
./sidenav.po
"
;
/**
* scroll page to make element visible
...
...
@@ -35,3 +37,16 @@ export async function changeSelectValue(elt: ElementFinder, index: number) {
await
option
.
click
();
await
browser
.
sleep
(
200
);
}
/**
* load a session from JSON file
*/
export
async
function
loadSession
(
navbar
:
Navbar
,
sideNav
:
SideNav
,
path
:
string
)
{
await
navbar
.
clickMenuButton
();
await
browser
.
sleep
(
200
);
await
sideNav
.
clickLoadSessionButton
();
await
browser
.
sleep
(
200
);
await
sideNav
.
loadSessionFile
(
path
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment