Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
18932201
Commit
18932201
authored
Nov 21, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
load envs to browser in pw tests
parent
87da6184
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
1 deletion
+51
-1
.gitignore
.gitignore
+2
-0
.env.pw
configs/envs/.env.pw
+12
-0
package.json
package.json
+1
-1
index.html
playwright/index.html
+1
-0
make-envs-script.sh
playwright/make-envs-script.sh
+35
-0
No files found.
.gitignore
View file @
18932201
...
...
@@ -46,3 +46,5 @@ yarn-error.log*
/test-results/
/playwright-report/
/playwright/.cache/
/playwright/.browser/
/playwright/envs.js
configs/envs/.env.pw
0 → 100644
View file @
18932201
# app config
NEXT_PUBLIC_APP_HOST=blockscout.com
NEXT_PUBLIC_APP_INSTANCE=pw
NEXT_PUBLIC_APP_ENV=testing
# ui config
NEXT_PUBLIC_BLOCKSCOUT_VERSION=v4.1.7-beta
NEXT_PUBLIC_FOOTER_GITHUB_LINK=https://github.com/blockscout/blockscout
NEXT_PUBLIC_FOOTER_TWITTER_LINK=https://www.twitter.com/blockscoutcom
# api config
NEXT_PUBLIC_API_HOST=blockscout.com
package.json
View file @
18932201
...
...
@@ -21,7 +21,7 @@
"lint:tsc"
:
"./node_modules/.bin/tsc -p ./tsconfig.json"
,
"prepare"
:
"husky install"
,
"format-svg"
:
"./node_modules/.bin/svgo -r ./icons"
,
"test:pw"
:
"playwright test -c playwright-ct.config.ts"
,
"test:pw"
:
"
./playwright/make-envs-script.sh &&
playwright test -c playwright-ct.config.ts"
,
"test:pw:docker"
:
"docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.28.0-focal ./playwright/run-tests.sh"
,
"test:jest"
:
"jest"
,
"test:jest:watch"
:
"jest --watch"
...
...
playwright/index.html
View file @
18932201
...
...
@@ -7,6 +7,7 @@
</head>
<body>
<div
id=
"root"
></div>
<script
type=
"module"
src=
"/playwright/envs.js"
></script>
<script
type=
"module"
src=
"/playwright/index.ts"
></script>
</body>
</html>
playwright/make-envs-script.sh
0 → 100755
View file @
18932201
#!/bin/bash
targetFile
=
'./playwright/envs.js'
declare
-a
envFiles
=(
'./configs/envs/.env.pw'
'./configs/envs/.env.poa_core'
)
touch
$targetFile
;
truncate
-s
0
$targetFile
;
echo
"Creating script file with envs"
echo
"window.process = { env: { } };"
>>
$targetFile
;
for
envFile
in
"
${
envFiles
[@]
}
"
do
# read each env file
while
read
line
;
do
# if it is a comment or an empty line, continue to next one
if
[
"
${
line
:0:1
}
"
==
"#"
]
||
[
"
${
line
}
"
==
""
]
;
then
continue
fi
# split by "=" sign to get variable name and value
configName
=
"
$(
cut
-d
'='
-f1
<<<
"
$line
"
)
"
;
configValue
=
"
$(
cut
-d
'='
-f2-
<<<
"
$line
"
)
"
;
# if there is a value, escape it and add line to target file
if
[
-n
"
$configValue
"
]
;
then
escapedConfigValue
=
$(
echo
$configValue
|
sed
s/
\'
/
\"
/g
)
;
echo
"window.process.env.
${
configName
}
= '
${
escapedConfigValue
}
';"
>>
$targetFile
;
fi
done
<
$envFile
done
echo
"Done"
\ No newline at end of file
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