Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
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
exchain
nebula
Commits
3ce4507c
Unverified
Commit
3ce4507c
authored
Sep 08, 2023
by
OptimismBot
Committed by
GitHub
Sep 08, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7150 from ethereum-optimism/wyatt/ufm/synpress-playwright-init
Init synpress and playwright
parents
92da7898
81882115
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
7505 additions
and
6 deletions
+7505
-6
pnpm-workspace.yaml
pnpm-workspace.yaml
+0
-1
.env.example
ufm-test-services/.env.example
+7
-0
crontab-example
ufm-test-services/crontab-example
+1
-1
datesources.yml
ufm-test-services/datesources.yml
+1
-1
docker-compose.yml
ufm-test-services/docker-compose.yml
+1
-2
.env.example
ufm-test-services/metamask/.env.example
+4
-0
.gitignore
ufm-test-services/metamask/.gitignore
+4
-0
package.json
ufm-test-services/metamask/package.json
+8
-1
playwright.config.ts
ufm-test-services/metamask/playwright.config.ts
+47
-0
pnpm-lock.yaml
ufm-test-services/metamask/pnpm-lock.yaml
+7369
-0
pnpm-workspace.yaml
ufm-test-services/metamask/pnpm-workspace.yaml
+2
-0
metamask.spec.ts
ufm-test-services/metamask/tests/metamask.spec.ts
+6
-0
testWithSynpress.ts
ufm-test-services/metamask/tests/testWithSynpress.ts
+55
-0
No files found.
pnpm-workspace.yaml
View file @
3ce4507c
...
@@ -2,4 +2,3 @@ packages:
...
@@ -2,4 +2,3 @@ packages:
-
'
packages/*'
-
'
packages/*'
-
'
endpoint-monitor'
-
'
endpoint-monitor'
-
'
op-exporter'
-
'
op-exporter'
-
'
ufm-test-services/metamask'
ufm-test-services/.env.example
0 → 100644
View file @
3ce4507c
CI=false
GRAFANA_ADMIN_PWD=
# Used to set the display to be used by playwright when running Metamask test service
MM_DISPLAY=host.docker.internal:0
MM_DISPLAY_VOLUME=/tmp/.X11-unix:/tmp/.X11-unix
\ No newline at end of file
ufm-test-services/crontab-example
View file @
3ce4507c
...
@@ -5,4 +5,4 @@ PATH=/
...
@@ -5,4 +5,4 @@ PATH=/
* * * * * /usr/local/bin/docker-compose -f /path/to/docker-compose.yml --profile 1minute up -d
* * * * * /usr/local/bin/docker-compose -f /path/to/docker-compose.yml --profile 1minute up -d
# Runs every 5 minutes
# Runs every 5 minutes
*/5 * * * * /usr/local/bin/docker-compose -f /path/to/docker-compose.yml --profile 5minutes up -d
*/5 * * * * /usr/local/bin/docker-compose -f /path/to/docker-compose.yml --profile 5minutes up -d
\ No newline at end of file
ufm-test-services/datesources.yml
View file @
3ce4507c
...
@@ -5,4 +5,4 @@ datasources:
...
@@ -5,4 +5,4 @@ datasources:
type
:
prometheus
type
:
prometheus
access
:
proxy
access
:
proxy
url
:
http://prometheus:9090
url
:
http://prometheus:9090
isDefault
:
true
isDefault
:
true
\ No newline at end of file
ufm-test-services/docker-compose.yml
View file @
3ce4507c
...
@@ -33,8 +33,7 @@ services:
...
@@ -33,8 +33,7 @@ services:
depends_on
:
depends_on
:
-
prometheus
-
prometheus
environment
:
environment
:
# TODO - Replace with ENV variables to allow for better security
-
GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PWD}
-
GF_SECURITY_ADMIN_PASSWORD=adminpassword
volumes
:
volumes
:
-
./datesources.yml:/etc/grafana/provisioning/datasources/datasources.yaml
-
./datesources.yml:/etc/grafana/provisioning/datasources/datasources.yaml
security_opt
:
security_opt
:
...
...
ufm-test-services/metamask/.env.example
0 → 100644
View file @
3ce4507c
METAMASK_SECRET_WORDS_OR_PRIVATEKEY=""
METAMASK_NETWORK="goerli"
METAMASK_PASSWORD="Test@1234"
METAMASK_DAPP_URL="http://localhost:9011"
ufm-test-services/metamask/.gitignore
0 → 100644
View file @
3ce4507c
node_modules/
/test-results/
/playwright-report/
/playwright/.cache/
ufm-test-services/metamask/package.json
View file @
3ce4507c
...
@@ -11,10 +11,17 @@
...
@@ -11,10 +11,17 @@
"homepage"
:
"https://optimism.io"
,
"homepage"
:
"https://optimism.io"
,
"type"
:
"module"
,
"type"
:
"module"
,
"scripts"
:
{
"scripts"
:
{
"clean"
:
"rm -rf node_modules packages/*/node_modules && echo 'Finished cleaning'"
,
"lint"
:
"prettier --check ."
,
"lint"
:
"prettier --check ."
,
"lint:fix"
:
"prettier --write ."
"lint:fix"
:
"prettier --write ."
,
"start:metamask-dapp"
:
"npx static-server node_modules/@metamask/test-dapp/dist --port 9011"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
"@metamask/test-dapp"
:
"^7.1.0"
,
"@playwright/test"
:
"^1.37.1"
,
"@synthetixio/synpress"
:
"3.7.2-beta.5"
,
"dotenv"
:
"^16.3.1"
,
"static-server"
:
"^2.2.1"
,
"typescript"
:
"^5.1.6"
"typescript"
:
"^5.1.6"
}
}
}
}
ufm-test-services/metamask/playwright.config.ts
0 → 100644
View file @
3ce4507c
import
{
defineConfig
,
devices
}
from
'
@playwright/test
'
;
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
import
'
dotenv/config
'
/**
* See https://playwright.dev/docs/test-configuration.
*/
export
default
defineConfig
({
testDir
:
'
./tests
'
,
/* Run tests in files in parallel */
fullyParallel
:
true
,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly
:
!!
process
.
env
.
CI
,
/* Retry on CI only */
retries
:
process
.
env
.
CI
?
2
:
0
,
/* Opt out of parallel tests on CI. */
workers
:
process
.
env
.
CI
?
1
:
undefined
,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter
:
'
html
'
,
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use
:
{
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace
:
'
on-first-retry
'
,
},
/* Configure projects for major browsers */
projects
:
[
{
name
:
'
chromium
'
,
use
:
{
...
devices
[
'
Desktop Chrome
'
]
},
},
],
/* Run your local dev server before starting the tests */
webServer
:
{
command
:
'
pnpm run start:metamask-dapp
'
,
url
:
process
.
env
.
METAMASK_DAPP_URL
,
reuseExistingServer
:
false
,
},
});
ufm-test-services/metamask/pnpm-lock.yaml
0 → 100644
View file @
3ce4507c
This diff is collapsed.
Click to expand it.
ufm-test-services/metamask/pnpm-workspace.yaml
0 → 100644
View file @
3ce4507c
packages
:
-
./
ufm-test-services/metamask/tests/metamask.spec.ts
0 → 100644
View file @
3ce4507c
import
{
testWithSynpress
}
from
'
./testWithSynpress
'
import
{
test
}
from
'
@playwright/test
'
testWithSynpress
(
'
should be able to read
'
,
async
({
page
})
=>
{
await
page
.
goto
(
'
http://localhost:9011
'
)
})
ufm-test-services/metamask/tests/testWithSynpress.ts
0 → 100644
View file @
3ce4507c
import
'
dotenv/config
'
import
{
type
BrowserContext
,
chromium
,
expect
,
test
as
base
,
}
from
'
@playwright/test
'
import
metamask
from
'
@synthetixio/synpress/commands/metamask.js
'
import
helpers
from
'
@synthetixio/synpress/helpers.js
'
const
{
initialSetup
}
=
metamask
const
{
prepareMetamask
}
=
helpers
export
const
testWithSynpress
=
base
.
extend
<
{
context
:
BrowserContext
}
>
({
context
:
async
({},
use
)
=>
{
// required for synpress
global
.
expect
=
expect
// download metamask
const
metamaskPath
=
await
prepareMetamask
(
process
.
env
.
METAMASK_VERSION
||
'
10.25.0
'
,
)
// prepare browser args
const
browserArgs
=
[
`--disable-extensions-except=
${
metamaskPath
}
`
,
`--load-extension=
${
metamaskPath
}
`
,
'
--remote-debugging-port=9222
'
,
]
if
(
process
.
env
.
CI
)
{
browserArgs
.
push
(
'
--disable-gpu
'
)
}
if
(
process
.
env
.
HEADLESS_MODE
)
{
browserArgs
.
push
(
'
--headless=new
'
)
}
// launch browser
const
context
=
await
chromium
.
launchPersistentContext
(
''
,
{
headless
:
false
,
args
:
browserArgs
,
})
// wait for metamask
await
context
.
pages
()[
0
].
waitForTimeout
(
3000
)
// setup metamask
await
initialSetup
(
chromium
,
{
secretWordsOrPrivateKey
:
process
.
env
.
METAMASK_SECRET_WORDS_OR_PRIVATEKEY
,
network
:
process
.
env
.
METAMASK_NETWORK
,
password
:
process
.
env
.
METAMASK_PASSWORD
,
enableAdvancedSettings
:
true
,
})
await
use
(
context
)
await
context
.
close
()
},
})
export
{
expect
}
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