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
Show more breadcrumbs
Cassiopée
nghyd
Commits
83aaf874
Commit
83aaf874
authored
2 years ago
by
François Grand
Browse files
Options
Downloads
Patches
Plain Diff
fix(e2e): test fails due to bad path
refs
#608
parent
8decbc4d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!225
Release v4.17.0
,
!211
Resolve "Documentation: Les formules de math ne s'affichent pas dans la version anglaise"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+0
-5
0 additions, 5 deletions
.gitlab-ci.yml
e2e/load-save-session.e2e-spec.ts
+31
-10
31 additions, 10 deletions
e2e/load-save-session.e2e-spec.ts
with
31 additions
and
15 deletions
.gitlab-ci.yml
+
0
−
5
View file @
83aaf874
...
...
@@ -71,11 +71,6 @@ install:
test
:
stage
:
test
only
:
-
tags
-
schedules
-
web
-
master
script
:
-
npm run e2e
...
...
This diff is collapsed.
Click to expand it.
e2e/load-save-session.e2e-spec.ts
+
31
−
10
View file @
83aaf874
...
...
@@ -18,16 +18,35 @@ let navbar: Navbar;
let
sidenav
:
SideNav
;
let
prefPage
:
PreferencesPage
;
async
function
saveSession
():
Promise
<
string
>
{
await
calcPage
.
clickSaveCalcButton
();
await
browser
.
sleep
(
500
);
function
findDownloadedFile
(
filename
:
string
):
string
{
const
downloadDirs
=
[
"
Téléchargements
"
,
"
Downloads
"
,
"
/tmp
"
];
for
(
const
d
of
downloadDirs
)
{
const
download_prefix
=
d
.
charAt
(
0
)
===
"
/
"
?
d
:
path
.
resolve
(
os
.
homedir
(),
d
);
const
fp
=
path
.
resolve
(
download_prefix
,
filename
);
if
(
fs
.
existsSync
(
fp
))
{
return
fp
;
}
}
}
function
deleteDownloadedFile
(
filename
:
string
)
{
// see: https://stackoverflow.com/questions/21935696/protractor-e2e-test-case-for-downloading-pdf-file
const
f
ilename
=
path
.
resolve
(
os
.
homedir
(),
"
Téléchargements/session.json
"
);
if
(
f
s
.
existsSync
(
filename
)
)
{
const
f
p
=
findDownloadedFile
(
filename
);
if
(
f
p
!==
undefined
)
{
// Make sure the browser doesn't have to rename the download.
fs
.
unlinkSync
(
f
ilename
);
fs
.
unlinkSync
(
f
p
);
}
}
async
function
saveSession
():
Promise
<
string
>
{
const
sessionFile
=
"
session.json
"
;
deleteDownloadedFile
(
sessionFile
);
await
calcPage
.
clickSaveCalcButton
();
await
browser
.
sleep
(
500
);
// cf. protractor.conf.fs, exports.config.capabilities.chromeOptions.prefs.download.default_directory
// protractor.conf.fs/exports.config.capabilities.chromeOptions.prefs.download.default_directory DOES NOT WORK !
// Le code laissé en commentaire tente de corriger un bug :
// il s'écoule 40 secondes entre le clic sur le bouton menu (en haut à gauche) et l'ouverture du sidenav.
...
...
@@ -63,7 +82,8 @@ async function saveSession(): Promise<string> {
// browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
return
filename
;
console
.
log
(
"
saveSession() saved to
"
,
findDownloadedFile
(
sessionFile
));
return
findDownloadedFile
(
sessionFile
);
}
async
function
loadSession
(
path
:
string
)
{
...
...
@@ -125,13 +145,14 @@ describe("ngHyd − save and load sessions", () => {
await
changeSelectValue
(
calcPage
.
getSelectById
(
"
select_section
"
),
2
);
// mode "trapezoidal"
await
calcPage
.
getInputById
(
"
Ks
"
).
clear
();
// coefficient de Strickler
await
browser
.
sleep
(
10
00
);
await
browser
.
sleep
(
2
00
);
await
calcPage
.
getInputById
(
"
Ks
"
).
sendKeys
(
"
42
"
);
await
browser
.
sleep
(
10
00
);
await
browser
.
sleep
(
2
00
);
const
filename
=
await
saveSession
();
await
browser
.
sleep
(
10
00
);
await
browser
.
sleep
(
5
00
);
const
fileContent
=
fs
.
readFileSync
(
filename
,
{
encoding
:
"
utf8
"
});
await
browser
.
sleep
(
200
);
expect
(
fileContent
).
toContain
(
`"nodeType":"SectionTrapeze"`
);
expect
(
fileContent
).
toContain
(
`{"symbol":"Ks","mode":"SINGLE","value":42}`
);
...
...
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