Skip to content

Commit

Permalink
feat: add waiters for set up wallet (#151)
Browse files Browse the repository at this point in the history
* feat: add waiters for set up wallet

* fix: fix locator

* added test manual job

* try new

* Improve

* Publish alpha version

* fix

* Fix name NPM_TOKEN

* fix publish

* fix token

* debug publish

* fix npmrc

* Debug publish

* added develop env

* change version

* removed debug infos

* fixed path

* Fixes

* up version

* Update package.json

* Update package.json

* downgrade

* Up alpha

* up version

* Fix type

* change job rule

* Remove pr trigger

* return versions

* fix: remove yarn cmds

* fix: return axios

* fix: remove cmd

* fix: conditin main

* fix: got it banner
  • Loading branch information
Vorobeyko authored Jun 13, 2024
1 parent 4b892e9 commit fbab371
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 7 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/alpha-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish Beta version to registry
on:
workflow_dispatch:

permissions:
contents: write

jobs:
publish:
runs-on: ubuntu-latest
environment: develop
# restricts job to main branch
if: github.ref != 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 16
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build
run: yarn build

- name: Authenticate in npm
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
echo "workspaces-update=false" >> .npmrc
echo "provenance=true" >> .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish Alpha
run: yarn multi-semantic-release --deps.bump=override --deps.release=patch --sequential-init
env:
NPM_CONFIG_PROVENANCE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion packages/wallets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"repository": {
"type": "git",
"url": "https://github.com/lidofinance/wallets-testing-modules.git",
"directory": "packages/nodes"
"directory": "packages/wallets"
},
"bugs": {
"url": "https://github.com/lidofinance/wallets-testing-modules/issues"
Expand Down
16 changes: 13 additions & 3 deletions packages/wallets/src/metamask/metamask.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ export class MetamaskPage implements WalletPage {
this.extensionUrl + this.config.COMMON.EXTENSION_START_PATH,
{ waitUntil: 'load' },
);
await this.closePopover();
await this.page
.locator('button[data-testid="app-header-logo"]')
.waitFor({ state: 'visible' });
await this.unlock();
if (await this.page.getByTestId('network-display').isVisible()) {
await this.closePopover();
}
});
}

Expand All @@ -45,6 +50,7 @@ export class MetamaskPage implements WalletPage {
if ((await this.page.locator('id=password').count()) > 0) {
await this.page.fill('id=password', this.config.PASSWORD);
await this.page.click('text=Unlock');
await this.page.waitForURL('**/home.html#');
await this.closePopover();
}
});
Expand All @@ -63,15 +69,15 @@ export class MetamaskPage implements WalletPage {
async isPopoverVisible() {
try {
const popoverContent = this.page.getByTestId('popover-close');
await popoverContent.waitFor({ state: 'visible', timeout: 5000 });
await popoverContent.waitFor({ state: 'visible', timeout: 1000 });
return true;
} catch (error) {
return false;
}
}

async closePopover() {
await test.step('Close popover if exists', async () => {
await test.step('Close popover if it exists', async () => {
if (!this.page) throw "Page isn't ready";

if (await this.isPopoverVisible()) {
Expand All @@ -89,6 +95,9 @@ export class MetamaskPage implements WalletPage {

if (await this.page.getByText('Not right now').isVisible())
await this.page.click('text=Not right now');

const gotItBtn = await this.page.getByText('Got it');
if (await gotItBtn.first().isVisible()) await gotItBtn.first().click();
});
}

Expand Down Expand Up @@ -124,6 +133,7 @@ export class MetamaskPage implements WalletPage {
await this.page.getByTestId('onboarding-complete-done').click();
await this.page.getByTestId('pin-extension-next').click();
await this.page.getByTestId('pin-extension-done').click();
await this.page.waitForURL('**/home.html#');
await this.closePopover();
});
}
Expand Down
31 changes: 28 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9300,7 +9300,16 @@ string-length@^4.0.1:
char-regex "^1.0.2"
strip-ansi "^6.0.0"

"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -9355,7 +9364,14 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -10258,7 +10274,7 @@ wordwrap@^1.0.0:
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -10276,6 +10292,15 @@ wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.0.1, wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down

0 comments on commit fbab371

Please sign in to comment.