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
a0f3febf
Unverified
Commit
a0f3febf
authored
Sep 01, 2023
by
Wyatt Barnes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Init synpress and playwright
parent
8fe39f7c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
4007 additions
and
181 deletions
+4007
-181
pnpm-lock.yaml
pnpm-lock.yaml
+3884
-180
.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
+7
-1
playwright.config.ts
ufm-test-services/metamask/playwright.config.ts
+47
-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-lock.yaml
View file @
a0f3febf
This source diff could not be displayed because it is too large. You can
view the blob
instead.
ufm-test-services/metamask/.env.example
0 → 100644
View file @
a0f3febf
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 @
a0f3febf
node_modules/
/test-results/
/playwright-report/
/playwright/.cache/
ufm-test-services/metamask/package.json
View file @
a0f3febf
...
...
@@ -13,9 +13,15 @@
"scripts"
:
{
"clean"
:
"rm -rf node_modules packages/*/node_modules && echo 'Finished cleaning'"
,
"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"
:
{
"@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"
}
}
ufm-test-services/metamask/playwright.config.ts
0 → 100644
View file @
a0f3febf
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/tests/metamask.spec.ts
0 → 100644
View file @
a0f3febf
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 @
a0f3febf
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