diff --git a/.eslintrc.js b/.eslintrc.js index 16654a99e5..6628b28c14 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -40,6 +40,7 @@ module.exports = { "promise/param-names": 0, "react-hooks/rules-of-hooks": "error", // Checks rules of Hooks "react-hooks/exhaustive-deps": "warn", // Checks effect dependencies + "jest/no-done-callback": 0, }, settings: { react: { diff --git a/.github/actions/comment/index.js b/.github/actions/comment/index.js index af7a65e9ee..96aebdd5f2 100644 --- a/.github/actions/comment/index.js +++ b/.github/actions/comment/index.js @@ -15,7 +15,7 @@ const main = async () => { if (imgChanged.length === 1 && imgChanged[0] === "") { imgChanged = []; } - } catch(e) { + } catch (e) { imgChanged = []; } const testoutput = await fs.readFile(core.getInput("testoutput"), "utf8"); diff --git a/.github/actions/prepare-comment/action.yml b/.github/actions/prepare-comment/action.yml new file mode 100644 index 0000000000..6a0f4b5221 --- /dev/null +++ b/.github/actions/prepare-comment/action.yml @@ -0,0 +1,54 @@ +name: prepare comment body +description: prepare comment for reporting +author: valpinkman +outputs: + bodySlack: + description: message formatted body for slack + bodySlackAuthor: + description: message formatted body for slack author + slackAuthor: + description: slack handle of the author +inputs: + sha: + description: prNumber + required: true + images: + description: stringified array of images to include in body of comment + required: true + fullrepo: + description: full repo name + required: true + runId: + description: runId + required: true + from: + description: from + required: true + to: + description: to + required: true + pullId: + description: pullId + required: true + author: + description: author + required: true + imgChanged: + description: imgChanged + required: true + testoutput: + description: testoutput + required: true + lintoutput: + description: lintoutput + required: true + jestoutput: + description: jestoutput + required: true +runs: + using: node12 + main: index.js + +branding: + icon: align-center + color: white diff --git a/.github/actions/prepare-comment/index.js b/.github/actions/prepare-comment/index.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.github/actions/upload-images/index.js b/.github/actions/upload-images/index.js index 53f228148f..363ae39265 100644 --- a/.github/actions/upload-images/index.js +++ b/.github/actions/upload-images/index.js @@ -10,10 +10,6 @@ const uploadImage = async () => { const path = core.getInput("path"); const fullPath = resolve(path); - // if (fs.existsSync(fullPath)) { - // throw new Error("the path provided does not exists"); - // } - const upload = async (file, i = 0) => { if (i > 2) { return "error"; @@ -43,16 +39,31 @@ const uploadImage = async () => { } }; + const getAllFiles = currentPath => { + let results = []; + const dirents = fs.readdirSync(currentPath, { withFileTypes: true }); + dirents.forEach(dirent => { + const newPath = resolve(currentPath, dirent.name); + const stat = fs.statSync(newPath); + if (stat && stat.isDirectory()) { + results = results.concat(getAllFiles(newPath)); + } else { + results.push(newPath); + } + }); + return results; + }; + let files; try { - files = fs.readdirSync(fullPath, { withFileTypes: true }); - files = files.filter(f => f.isFile()).map(f => f.name); + files = getAllFiles(fullPath); + console.log(files); } catch { return core.setOutput("images", []); } - const resultsP = files.map(file => { - const img = fs.readFileSync(`${fullPath}/${file}`); + const resultsP = files.map(async file => { + const img = fs.readFileSync(`${file}`); return upload(img); }); diff --git a/.github/workflows/bundle-app.yml b/.github/workflows/bundle-app.yml index f9bc4437f5..cf440fcb56 100644 --- a/.github/workflows/bundle-app.yml +++ b/.github/workflows/bundle-app.yml @@ -1,4 +1,4 @@ -name: bundle app +name: Bundle App on: pull_request: branches: @@ -15,7 +15,6 @@ jobs: steps: - name: Cancel Previous Runs run: curl -i -L -X GET 'https://github-actions-live.ledger.tools/api/cancel-previous-run?runId=${{ github.run_id }}&owner=LedgerHQ&repo=ledger-live-desktop&branch=${{ github.event.pull_request.head.ref }}&headSha=${{ github.event.pull_request.head.sha }}' - bundle-macos: runs-on: macos-latest needs: cancel-previous @@ -47,7 +46,7 @@ jobs: restore-keys: | ${{ runner.os }}-yarn- - name: install dependencies - run: JOBS=max yarn --frozen-lockfile + run: JOBS=max yarn --frozen-lockfile --network-timeout 100000 - uses: ledgerhq/actions/get-package-infos@v2.0.0 id: version - name: set beta name @@ -133,6 +132,8 @@ jobs: run: | git config user.email "team-live@ledger.fr" git config user.name "Team Live" + - name: kill apt-get + run: sudo killall apt-get apt || echo OK - name: install linux dependencies run: sudo apt-get update && sudo apt-get install libudev-dev libusb-1.0-0-dev - name: install and switch to GCC 5.4 @@ -147,7 +148,7 @@ jobs: restore-keys: | ${{ runner.os }}-yarn- - name: install dependencies - run: JOBS=max yarn --frozen-lockfile + run: JOBS=max yarn --frozen-lockfile --network-timeout 100000 - uses: ledgerhq/actions/get-package-infos@v2.0.0 id: version - name: set beta name @@ -222,7 +223,7 @@ jobs: - name: install dependencies env: JOBS: max - run: yarn --frozen-lockfile + run: yarn --frozen-lockfile --network-timeout 100000 - uses: ledgerhq/actions/get-package-infos@v2.0.0 id: version - name: set beta name diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml deleted file mode 100644 index 901af6258a..0000000000 --- a/.github/workflows/checks.yml +++ /dev/null @@ -1,159 +0,0 @@ -name: CI -on: - pull_request: - branches: - - develop - - master - push: - branches: - - develop - - master - -jobs: - start-runner: - name: start self-hosted EC2 runner - runs-on: [ledger-live-desktop] - outputs: - label: ${{ steps.start-ec2-runner.outputs.label }} - ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} - steps: - - name: get latest LLD runner AMI id - id: get-ami-id - run: | - echo "::set-output name=ami-id::$(aws ec2 describe-images --filters 'Name=name,Values=ledger-live-runner' --query 'Images[*].ImageId' --output text)" - - name: start EC2 runner - id: start-ec2-runner - uses: machulav/ec2-github-runner@v2 - with: - mode: start - github-token: ${{ secrets.CI_BOT_TOKEN }} - ec2-image-id: ${{ steps.get-ami-id.outputs.ami-id }} - ec2-instance-type: c5.4xlarge - subnet-id: subnet-03b7b4dff904e0142 # production-shared-private-eu-west-1a - security-group-id: sg-010daba499648d1e7 # infra-gha-runner-sg - - name: get volume-id - id: get-volume-id - run: | - echo "::set-output name=volume-id::$(aws ec2 describe-instances --instance-ids ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} --query 'Reservations[*].Instances[*].BlockDeviceMappings[*].Ebs.VolumeId' --output text)" - - name: resize rootfs - env: - VOLUME_ID: ${{ steps.get-volume-id.outputs.volume-id }} - run: | - aws ec2 modify-volume --size 30 --volume-id $VOLUME_ID - - test: - name: run UI tests - runs-on: ${{ needs.start-runner.outputs.label }} - needs: start-runner - steps: - - name: prepare runner - run: | - sudo growpart /dev/nvme0n1 1 - sudo resize2fs /dev/nvme0n1p1 - - uses: actions/checkout@v2 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: actions/setup-node@main - with: - node-version: 14.x - - name: install yarn - if: always() - run: npm install --global yarn - - name: install and switch to GCC 5.4 - if: always() - run: ./tools/g++-5.4/install.sh - - name: install dependencies - if: always() - env: - JOBS: max - run: yarn --frozen-lockfile - - name: run code checks - if: always() - run: yarn ci 2> >(tee lint.txt) - - name: check build - if: always() - env: - INSTRUMENT_BUILD: true - run: yarn build - - name: Tests - if: always() - run: yarn test 2> >(tee jest.txt) - - name: start electron webdriver - if: always() - env: - DISPLAY: :99.0 - TZ: America/New_York - run: | - xvfb-run -a --server-args="-screen 0 1024x788x24 -ac +extension RANDR" node_modules/electron-chromedriver/chromedriver.js --port=9515 --whitelisted-ips="" --url-base=/ & - - name: wait for webdriver - if: always() - run: bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9515)" != "404" ]]; do sleep 5; done' - - name: run spectron - if: always() - run: yarn spectron --no-color 2> >(tee output.txt) - - name: run coverage generation - if: always() && github.event_name == 'push' - run: yarn spectron-coverage - env: - CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} - - name: upload diffs to imgur - if: always() - uses: ./.github/actions/upload-images - id: imgur - with: - path: tests/specs/__image_snapshots__/__diff_output__ - - name: clean diff - if: always() - run: rm -f tests/specs/__image_snapshots__/__diff_output__/*.png - - name: upload ci suggested screenshots - uses: actions/upload-artifact@v2 - if: always() - with: - name: ci-suggested-screenshots - path: tests/specs/__image_snapshots__/__diff_output__/ - - name: generate imgChanged - run: | - git remote add ledger https://github.com/LedgerHQ/ledger-live-desktop.git - git fetch ledger - git diff --name-only ledger/${{github.base_ref}}..${{github.event.pull_request.head.sha}} -- tests/specs/__image_snapshots__ >imgChanged.txt - if: always() && github.event_name == 'pull_request' - - name: send comment - if: always() - id: comment - uses: ./.github/actions/comment - with: - images: ${{ steps.imgur.outputs.images }} - fullrepo: ${{ github.repository }} - runId: ${{ github.run_id }} - testoutput: ./output.txt - lintoutput: ./lint.txt - jestoutput: ./jest.txt - imgChanged: ./imgChanged.txt - author: ${{github.event.sender.login}} - pullId: ${{github.event.number}} - from: ${{github.base_ref}} - to: ${{github.event.pull_request.head.sha}} - sha: ${{ github.event.pull_request.head.sha || github.sha }} - - name: Send message to Slack channel - uses: archive/github-actions-slack@v1.0.3 - if: always() && github.event_name == 'push' - id: notify - with: - slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_USER_OAUTH_ACCESS_TOKEN }} - slack-channel: live-ui-tests - slack-text: ${{ steps.comment.outputs.bodySlack }} - - stop-runner: - name: Stop self-hosted EC2 runner - needs: [start-runner, test] - runs-on: [ledger-live-desktop] - if: ${{ always() }} - steps: - - name: Stop EC2 runner - uses: machulav/ec2-github-runner@v2 - with: - mode: stop - github-token: ${{ secrets.CI_BOT_TOKEN }} - label: ${{ needs.start-runner.outputs.label }} - ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }} diff --git a/.github/workflows/generate-screenshots-temp.yml b/.github/workflows/generate-screenshots-temp.yml index db18d7af54..5a4f60aec9 100644 --- a/.github/workflows/generate-screenshots-temp.yml +++ b/.github/workflows/generate-screenshots-temp.yml @@ -7,22 +7,130 @@ on: required: true jobs: + cancel-previous: + runs-on: ubuntu-20.04 + steps: + - name: Cancel Previous Runs + run: curl -i -L -X GET 'https://github-actions-live.ledger.tools/api/cancel-previous-run?runId=${{ github.run_id }}&owner=LedgerHQ&repo=ledger-live-desktop&branch=${{ github.event.pull_request.head.ref }}&headSha=${{ github.event.pull_request.head.sha }}' + + start-runner: + name: start self-hosted EC2 runner + needs: cancel-previous + runs-on: [ledger-live-desktop] + outputs: + label: ${{ steps.start-ec2-runner.outputs.label }} + ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} + steps: + - name: get latest LLD runner AMI id + id: get-ami-id + run: | + echo "::set-output name=ami-id::$(aws ec2 describe-images --filters 'Name=name,Values=ledger-live-runner' --query 'Images[*].ImageId' --output text)" + - name: start EC2 runner + id: start-ec2-runner + uses: machulav/ec2-github-runner@v2 + with: + mode: start + github-token: ${{ secrets.CI_BOT_TOKEN }} + ec2-image-id: ${{ steps.get-ami-id.outputs.ami-id }} + ec2-instance-type: c5.4xlarge + subnet-id: subnet-03b7b4dff904e0142 # production-shared-private-eu-west-1a + security-group-id: sg-010daba499648d1e7 # infra-gha-runner-sg + - name: get volume-id + id: get-volume-id + run: | + echo "::set-output name=volume-id::$(aws ec2 describe-instances --instance-ids ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} --query 'Reservations[*].Instances[*].BlockDeviceMappings[*].Ebs.VolumeId' --output text)" + - name: resize rootfs + env: + VOLUME_ID: ${{ steps.get-volume-id.outputs.volume-id }} + run: | + aws ec2 modify-volume --size 30 --volume-id $VOLUME_ID + + stop-runner: + name: Stop self-hosted EC2 runner + needs: [start-runner, generate-screenshots-linux] + runs-on: [ledger-live-desktop] + if: ${{ always() }} + steps: + - name: Stop EC2 runner + uses: machulav/ec2-github-runner@v2 + with: + mode: stop + github-token: ${{ secrets.CI_BOT_TOKEN }} + label: ${{ needs.start-runner.outputs.label }} + ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }} + + generate-screenshots-linux: + name: screenshots linux + needs: [start-runner] + runs-on: ${{ needs.start-runner.outputs.label }} + + steps: + - name: prepare runner + run: | + sudo growpart /dev/nvme0n1 1 + sudo resize2fs /dev/nvme0n1p1 + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: set git user + run: | + git config user.email "team-live@ledger.fr" + git config user.name "Team Live" + - name: kill apt-get + run: sudo killall apt-get apt || echo OK + - name: install gh + run: | + curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null + sudo apt-get update + sudo apt-get install -y gh + - name: checkout PR + run: gh pr checkout ${{ github.event.inputs.number }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/setup-node@v2 + with: + node-version: 14.x + - name: install yarn + run: npm i -g yarn + - name: install dependencies + run: yarn --frozen-lockfile --network-timeout 100000 + env: + JOBS: max + - name: install operating system dependencies + run: npx playwright install-deps + - name: build electron app + run: yarn build + - name: generate new screenshots (Linux) + run: xvfb-run --auto-servernum -- yarn playwright-update-snapshots --retries 0 + - name: status + id: status + run: echo "::set-output name=status::$(git status --porcelain | wc -l)" + - name: commit + if: steps.status.outputs.status != 0 + run: | + git add . + git commit -m 'update screenshots (Linux)' + git pull --rebase + git push + generate-screenshots: name: screenshots strategy: fail-fast: false matrix: - os: [ubuntu-20.04, macos-latest, windows-latest] + # os: [macos-latest, windows-latest] + os: [windows-latest] runs-on: ${{ matrix.os }} steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: set git user run: | git config user.email "team-live@ledger.fr" git config user.name "Team Live" - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - name: checkout PR run: gh pr checkout ${{ github.event.inputs.number }} env: @@ -35,20 +143,20 @@ jobs: - name: install dependencies env: JOBS: max - run: yarn --frozen-lockfile + run: yarn --frozen-lockfile --network-timeout 100000 - name: build electron app run: yarn build - - name: run ui tests (Linux) - if: matrix.os == 'ubuntu-20.04' - run: DEBUG=pw:browser xvfb-run --auto-servernum -- yarn playwright-update-snapshots - - name: run ui tests (macOS & Windows) - if: matrix.os != 'ubuntu-20.04' - run: yarn playwright-update-snapshots + - name: generate new screenshots (${{ matrix.os }}) + run: yarn playwright-update-snapshots --retries 0 env: - DEBUG: pw:api + DEBUG: pw:browser + - name: status + id: status + run: echo "::set-output name=status::$(git status --porcelain | wc -l)" - name: commit + if: steps.status.outputs.status != 0 run: | - git status git add . - git commit -m 'update screenshots' + git commit -m 'update screenshots (${{ matrix.os }})' + git pull --rebase git push diff --git a/.github/workflows/generate-screenshots.yml b/.github/workflows/generate-screenshots.yml index 611138fffd..8d899d262a 100644 --- a/.github/workflows/generate-screenshots.yml +++ b/.github/workflows/generate-screenshots.yml @@ -1,10 +1,17 @@ -name: Generate Screenshots +name: Update UI tests snapshots on: issue_comment: types: [created] jobs: + cancel-previous: + runs-on: ubuntu-20.04 + steps: + - name: Cancel Previous Runs + run: curl -i -L -X GET 'https://github-actions-live.ledger.tools/api/cancel-previous-run?runId=${{ github.run_id }}&owner=LedgerHQ&repo=ledger-live-desktop&branch=${{ github.event.pull_request.head.ref }}&headSha=${{ github.event.pull_request.head.sha }}' + add-reaction: + needs: [cancel-previous] name: add reaction to comment if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/generate-screenshots') runs-on: ubuntu-latest @@ -20,26 +27,152 @@ jobs: content: 'rocket' }) + start-runner: + name: start self-hosted EC2 runner + needs: [cancel-previous, add-reaction] + runs-on: [ledger-live-desktop] + outputs: + label: ${{ steps.start-ec2-runner.outputs.label }} + ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} + steps: + - name: get latest LLD runner AMI id + id: get-ami-id + run: | + echo "::set-output name=ami-id::$(aws ec2 describe-images --filters 'Name=name,Values=ledger-live-runner' --query 'Images[*].ImageId' --output text)" + - name: start EC2 runner + id: start-ec2-runner + uses: machulav/ec2-github-runner@v2 + with: + mode: start + github-token: ${{ secrets.CI_BOT_TOKEN }} + ec2-image-id: ${{ steps.get-ami-id.outputs.ami-id }} + ec2-instance-type: c5.4xlarge + subnet-id: subnet-03b7b4dff904e0142 # production-shared-private-eu-west-1a + security-group-id: sg-010daba499648d1e7 # infra-gha-runner-sg + - name: get volume-id + id: get-volume-id + run: | + echo "::set-output name=volume-id::$(aws ec2 describe-instances --instance-ids ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} --query 'Reservations[*].Instances[*].BlockDeviceMappings[*].Ebs.VolumeId' --output text)" + - name: resize rootfs + env: + VOLUME_ID: ${{ steps.get-volume-id.outputs.volume-id }} + run: | + aws ec2 modify-volume --size 30 --volume-id $VOLUME_ID + + stop-runner: + name: Stop self-hosted EC2 runner + needs: [start-runner, generate-screenshots-linux] + runs-on: [ledger-live-desktop] + if: ${{ always() }} + steps: + - name: Stop EC2 runner + uses: machulav/ec2-github-runner@v2 + with: + mode: stop + github-token: ${{ secrets.CI_BOT_TOKEN }} + label: ${{ needs.start-runner.outputs.label }} + ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }} + + generate-screenshots-linux: + name: screenshots linux + needs: [start-runner] + runs-on: ${{ needs.start-runner.outputs.label }} + + steps: + - name: prepare runner + run: | + sudo growpart /dev/nvme0n1 1 + sudo resize2fs /dev/nvme0n1p1 + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: set git user + run: | + git config user.email "team-live@ledger.fr" + git config user.name "Team Live" + - name: kill apt-get + run: sudo killall apt-get apt || echo OK + - name: install gh + run: | + curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null + sudo apt-get update + sudo apt-get install -y gh + - name: checkout PR + run: gh pr checkout ${{ github.event.inputs.number }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/setup-node@v2 + with: + node-version: 14.x + - name: install yarn + run: npm i -g yarn + - name: install dependencies + run: yarn --frozen-lockfile --network-timeout 100000 + env: + JOBS: max + - name: install operating system dependencies + run: npx playwright install-deps + - name: build electron app + run: yarn build + - name: generate new screenshots (Linux) + run: xvfb-run --auto-servernum -- yarn playwright-update-snapshots --retries 0 + - name: status + id: status + run: echo "::set-output name=status::$(git status --porcelain | wc -l)" + - name: commit + if: steps.status.outputs.status != 0 + run: | + git add . + git commit -m 'update screenshots (Linux)' + git pull --rebase + git push + generate-screenshots: needs: [add-reaction] name: screenshots strategy: fail-fast: false matrix: - os: [ubuntu-20.04, macos-latest, windows-latest] - runs-on: ubuntu-20.04 + # os: [macos-latest, windows-latest] + os: [windows-latest] + runs-on: ${{ matrix.os }} steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: set git user run: | git config user.email "team-live@ledger.fr" git config user.name "Team Live" - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - name: checkout PR - run: gh pr checkout ${{ github.event.issue.number }} + run: gh pr checkout ${{ github.event.inputs.number }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: show branch - run: git branch -v + - uses: actions/setup-node@v2 + with: + node-version: 14.x + - name: install yarn + run: npm i -g yarn + - name: install dependencies + run: yarn --frozen-lockfile --network-timeout 100000 + env: + JOBS: max + - name: install operating system dependencies + run: npx playwright install-deps + - name: build electron app + run: yarn build + - name: generate new screenshots (${{ matrix.os }}) + if: matrix.os != 'ubuntu-20.04' + run: yarn playwright-update-snapshots --retries 0 + - name: status + id: status + run: echo "::set-output name=status::$(git status --porcelain | wc -l)" + - name: commit + if: steps.status.outputs.status != 0 + run: | + git add . + git commit -m 'update screenshots (Linux)' + git pull --rebase + git push diff --git a/.github/workflows/post-ui-test.yml b/.github/workflows/post-ui-test.yml new file mode 100644 index 0000000000..9de33a2dec --- /dev/null +++ b/.github/workflows/post-ui-test.yml @@ -0,0 +1,60 @@ +name: "PR Reporting" +on: + workflow_dispatch: + inputs: + runId: + description: run id + required: true + + workflow_run: + workflows: ["UI tests"] + types: + - "completed" + +jobs: + comment-on-pr: + # if: github.event.workflow_run.event == 'pull_request' + strategy: + fail-fast: false + matrix: + # os: [ubuntu-20.04, macos-latest, windows-latest] + os: [ubuntu-20.04, windows-latest] + runs-on: ubuntu-20.04 + steps: + - name: download artifacts + uses: actions/github-script@v3.1.0 + with: + script: | + const fs = require('fs'); + const artifacts = await github.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: ${{github.event.workflow_run.id || github.event.inputs.runId }}, + }); + const reportArtifacts = artifacts.data.artifacts.filter((artifact) => { + return artifact.name == "report-${{ matrix.os }}" + })[0]; + const playwrightArtifacts artifacts.data.artifacts.filter((artifact) => { + return artifact.name == "playwright-results-${{ matrix.os }}" + })[0]; + const downloadReport = await github.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: reportArtifacts.id, + archive_format: 'zip', + }); + const downloadPlaywright = await github.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: reportArtifacts.id, + archive_format: 'zip', + }); + + fs.writeFileSync('${{github.workspace}}/report-${{ matrix.os }}.zip', Buffer.from(downloadReport.data)); + fs.writeFileSync('${{github.workspace}}/playwright-results-${{ matrix.os }}.zip', Buffer.from(downloadPlaywright.data)); + - name: unzip stuff + run: | + unzip report-${{ matrix.os }}.zip + unzip playwright-results-${{ matrix.os }}.zip + - name: ls on files + run: ls diff --git a/.github/workflows/sync-nightly-develop.yml b/.github/workflows/sync-nightly-develop.yml index 3914327133..8418cf5bb3 100644 --- a/.github/workflows/sync-nightly-develop.yml +++ b/.github/workflows/sync-nightly-develop.yml @@ -1,7 +1,7 @@ name: Sync Nightly Develop on: schedule: - - cron: "*/15 * * * *" + - cron: "0 */2 * * *" workflow_dispatch: jobs: diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml new file mode 100644 index 0000000000..7c339c9282 --- /dev/null +++ b/.github/workflows/ui-tests.yml @@ -0,0 +1,203 @@ +name: UI tests +on: + pull_request: + branches: + - develop + - master + push: + branches: + - develop + - master + +jobs: + cancel-previous: + runs-on: ubuntu-20.04 + steps: + - name: Cancel Previous Runs + run: curl -i -L -X GET 'https://github-actions-live.ledger.tools/api/cancel-previous-run?runId=${{ github.run_id }}&owner=LedgerHQ&repo=ledger-live-desktop&branch=${{ github.event.pull_request.head.ref }}&headSha=${{ github.event.pull_request.head.sha }}' + + start-runner: + name: start self-hosted EC2 runner + needs: cancel-previous + runs-on: [ledger-live-desktop] + outputs: + label: ${{ steps.start-ec2-runner.outputs.label }} + ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} + steps: + - name: get latest LLD runner AMI id + id: get-ami-id + run: | + echo "::set-output name=ami-id::$(aws ec2 describe-images --filters 'Name=name,Values=ledger-live-runner' --query 'Images[*].ImageId' --output text)" + - name: start EC2 runner + id: start-ec2-runner + uses: machulav/ec2-github-runner@v2 + with: + mode: start + github-token: ${{ secrets.CI_BOT_TOKEN }} + ec2-image-id: ${{ steps.get-ami-id.outputs.ami-id }} + ec2-instance-type: c5.4xlarge + subnet-id: subnet-03b7b4dff904e0142 # production-shared-private-eu-west-1a + security-group-id: sg-010daba499648d1e7 # infra-gha-runner-sg + - name: get volume-id + id: get-volume-id + run: | + echo "::set-output name=volume-id::$(aws ec2 describe-instances --instance-ids ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} --query 'Reservations[*].Instances[*].BlockDeviceMappings[*].Ebs.VolumeId' --output text)" + - name: resize rootfs + env: + VOLUME_ID: ${{ steps.get-volume-id.outputs.volume-id }} + run: | + aws ec2 modify-volume --size 30 --volume-id $VOLUME_ID + + stop-runner: + name: Stop self-hosted EC2 runner + needs: [start-runner, ui-tests-linux] + runs-on: [ledger-live-desktop] + if: ${{ always() }} + steps: + - name: Stop EC2 runner + uses: machulav/ec2-github-runner@v2 + with: + mode: stop + github-token: ${{ secrets.CI_BOT_TOKEN }} + label: ${{ needs.start-runner.outputs.label }} + ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }} + + ui-tests-linux: + name: UI tests (Linux) + needs: [start-runner] + runs-on: ${{ needs.start-runner.outputs.label }} + steps: + - name: prepare runner + run: | + sudo growpart /dev/nvme0n1 1 + sudo resize2fs /dev/nvme0n1p1 + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{github.event.pull_request.head.repo.full_name}} + persist-credentials: false + - uses: actions/setup-node@v2 + if: always() + with: + node-version: 14.x + - name: install yarn + if: always() + run: npm install --global yarn + - name: set git user + run: | + git config user.email "team-live@ledger.fr" + git config user.name "Team Live" + - name: get yarn cache + id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + - uses: actions/cache@v2 + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - name: install dependencies + env: + JOBS: max + run: yarn --frozen-lockfile --network-timeout 100000 + - name: install operating system dependencies for playwright + run: npx playwright install-deps + - name: run code checks + if: always() + run: yarn ci 2> >(tee lint.txt) + - name: build electron app + env: + INSTRUMENT_BUILD: true + run: yarn build + - name: tests + if: always() + run: yarn test 2> >(tee jest.txt) + - name: run ui tests (Linux) + run: xvfb-run --auto-servernum -- yarn playwright + - name: upload diffs to imgur + if: always() + uses: ./.github/actions/upload-images + id: imgur + with: + path: playwright/artifacts/test-results + - name: save PR number + if: always() + run: | + mkdir -p ./pr + echo ${{ github.event.number }} > ./pr/NR + - name: upload tests data + if: always() + uses: actions/upload-artifact@v2 + with: + name: report- + path: | + lint.txt + jest.txt + pr/NR + - name: upload ci suggested screenshots + if: always() + uses: actions/upload-artifact@v2 + with: + name: playwright-results-ubuntu-20.04 + path: | + playwright/artifacts/test-results + playwright/artifacts/html-report + playwright/artifacts/coverage + playwright/artifacts/videos + + ui-tests: + needs: cancel-previous + name: UI tests (${{ matrix.os }}) + strategy: + fail-fast: false + matrix: + # os: [macos-latest, windows-latest] + os: [windows-latest] + runs-on: ${{ matrix.os}} + + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{github.event.pull_request.head.repo.full_name}} + persist-credentials: false + - uses: actions/setup-node@v2 + with: + node-version: 14.x + - name: get yarn cache + id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + - uses: actions/cache@v2 + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - name: install dependencies + env: + JOBS: max + run: yarn --frozen-lockfile --network-timeout 100000 + - name: install operating system dependencies + run: npx playwright install-deps + - name: build electron app + env: + INSTRUMENT_BUILD: true + run: yarn build + - name: run ui tests (${{ matrix.os }}) + run: yarn playwright + - name: upload diffs to imgur + if: always() + uses: ./.github/actions/upload-images + id: imgur + with: + path: playwright/artifacts/test-results + - name: upload ci suggested screenshots + if: always() + uses: actions/upload-artifact@v2 + with: + name: playwright-results-${{ matrix.os }} + path: | + playwright/artifacts/test-results + playwright/artifacts/html-report + playwright/artifacts/coverage + playwright/artifacts/videos diff --git a/.gitignore b/.gitignore index 577e578139..b5f42a6338 100644 --- a/.gitignore +++ b/.gitignore @@ -121,6 +121,8 @@ tests/coverage/ !tests/tmp/.gitkeep tests/docker-electron-webdriver/.lastbuild tests/docker-electron-webdriver/.lastyarn +playwright/artifacts/* +!playwright/artifacts/.gitkeep # Yalc .yalc diff --git a/.nycrc b/.nycrc new file mode 100644 index 0000000000..279c2266e2 --- /dev/null +++ b/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "include": [ + "src/" + ], + "reporter": [ "html" ], + "report-dir": "playwright/artifacts/coverage", + "temp-dir": "playwright/artifacts/.nyc_output" +} diff --git a/babel.config.js b/babel.config.js index ff8495dbe3..1ad4eb5811 100644 --- a/babel.config.js +++ b/babel.config.js @@ -20,6 +20,7 @@ module.exports = api => ], plugins: [ ...babelPlugins, + "istanbul", [ "module-resolver", { diff --git a/package.json b/package.json index 4dfc9271ef..cc0d00e8e5 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,10 @@ "spectron": "jest \"tests/specs/.*\\.spec\\.js\" --maxWorkers=16", "spectron-inband": "jest \"tests/specs/.*\\.spec\\.js\" --runInBand", "spectron-coverage": "nyc report --reporter=text-lcov --temp-dir=tests/coverage | codecov --pipe --disable=gcov", - "generate-screenshots": "PWD=$(pwd); cd docker; docker run -v \"$PWD:/github/workspace\" -w \"/github/workspace\" --rm -it $(docker build -q .)" + "generate-screenshots": "PWD=$(pwd); cd docker; docker run -v \"$PWD:/github/workspace\" -w \"/github/workspace\" --rm -it $(docker build -q .)", + "playwright": "nyc playwright test --config=playwright/playwright.config.ts", + "playwright-update-snapshots": "yarn playwright --update-snapshots", + "playwright-recorder": "playwright test playwright/specs/recorder.spec.ts" }, "dependencies": { "@electron/remote": "^1.2.1", @@ -146,6 +149,7 @@ "@babel/preset-flow": "^7.13.13", "@babel/preset-react": "^7.13.13", "@octokit/rest": "^18.12.0", + "@playwright/test": "^1.16.1", "@storybook/addon-actions": "^6.3.12", "@storybook/addon-essentials": "^6.3.12", "@storybook/addon-links": "^6.3.12", @@ -154,6 +158,7 @@ "babel-eslint": "^10.1.0", "babel-jest": "^27.3.1", "babel-loader": "^8.2.3", + "babel-plugin-istanbul": "^6.1.1", "babel-plugin-module-resolver": "^4.1.0", "babel-plugin-styled-components": "^1.13.3", "chalk": "^4.1.2", @@ -188,15 +193,17 @@ "html-webpack-plugin": "^3.2.0", "istanbul-instrumenter-loader": "^3.0.1", "jest": "^26.6.3", - "jest-image-snapshot": "https://github.com/machard/jest-image-snapshot#machard-patch-1", "listr": "^0.14.3", "listr-verbose-renderer": "^0.6.0", "nyc": "^15.1.0", + "playwright": "1.17", "prettier": "^1.19.1", "spectron": "^15.0.0", "style-loader": "^1.2.1", + "typescript": "^4.4.3", "unused-webpack-plugin": "^2.4.0", "url-loader": "^4.1.1", + "v8-to-istanbul": "^8.1.0", "webpack": "^4.44.1", "webpack-cli": "^3.3.11", "webpack-dev-middleware": "^3.7.2", diff --git a/playwright/artifacts/.gitkeep b/playwright/artifacts/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/playwright/fixtures/common.ts b/playwright/fixtures/common.ts new file mode 100644 index 0000000000..ce44d51836 --- /dev/null +++ b/playwright/fixtures/common.ts @@ -0,0 +1,121 @@ +import { _electron as electron } from "playwright"; +import { test as base, expect, Page, ElectronApplication } from "@playwright/test"; +import * as fs from "fs"; +import * as path from "path"; +import * as crypto from "crypto"; + +export function generateUUID(): string { + return crypto.randomBytes(16).toString("hex"); +} + +type TestFixtures = { + lang: string; + theme: "light" | "dark" | "no-preference" | undefined; + userdata: string; + userdataDestinationPath: string; + userdataOriginalFile: string; + userdataFile: any; + env: Record; + page: Page; +}; + +const test = base.extend({ + env: undefined, + lang: "en-US", + theme: "light", + userdata: undefined, + userdataDestinationPath: async ({}, use) => { + use(path.join(__dirname, "../artifacts/userdata", generateUUID())); + }, + userdataOriginalFile: async ({ userdata }, use) => { + use(path.resolve("playwright/userdata/", `${userdata}.json`)); + }, + userdataFile: async ({ userdataDestinationPath }, use) => { + const fullFilePath = path.join(userdataDestinationPath, 'app.json'); + use(fullFilePath); + }, + page: async ({ lang, theme, userdata, userdataDestinationPath, userdataOriginalFile, env }: TestFixtures, use: (page: Page) => void) => { + // create userdata path + fs.mkdirSync(userdataDestinationPath, { recursive: true }); + + if (userdata) { + fs.copyFileSync(userdataOriginalFile, `${userdataDestinationPath}/app.json`); + } + + // default environment variables + env = Object.assign( + { + ...process.env, + MOCK: true, + HIDE_DEBUG_MOCK: true, + CI: process.env.CI || undefined, + SPECTRON_RUN: true, + // SYNC_ALL_INTERVAL: 86400000, + // SYNC_BOOT_DELAY: 16, + }, + env, + ); + + // launch app + const window = { width: 1024, height: 768 }; + + const electronApp: ElectronApplication = await electron.launch({ + args: [ + "./.webpack/main.bundle.js", + `--user-data-dir=${userdataDestinationPath}`, + // `--window-size=${window.width},${window.height}`, // FIXME: Doesn't work, window size can't be forced? + "--force-device-scale-factor=1", + "--disable-dev-shm-usage", + // "--use-gl=swiftshader" + "--no-sandbox", + "--enable-logging", + ], + recordVideo: { + dir: "playwright/artifacts/videos/", + size: window, // FIXME: no default value, it could come from viewport property in conf file but it's not the case + }, + env, + colorScheme: theme, + locale: lang, + }); + + // app is ready + const page = await electronApp.firstWindow(); + + // start coverage + const istanbulCLIOutput = path.join("playwright/artifacts/.nyc_output"); + + await page.addInitScript(() => + window.addEventListener("beforeunload", () => + (window as any).collectIstanbulCoverage(JSON.stringify((window as any).__coverage__)), + ), + ); + await fs.promises.mkdir(istanbulCLIOutput, { recursive: true }); + await page.exposeFunction("collectIstanbulCoverage", (coverageJSON: string) => { + if (coverageJSON) + fs.writeFileSync( + path.join(istanbulCLIOutput, `playwright_coverage_${generateUUID()}.json`), + coverageJSON, + ); + }); + + // app is loaded + expect(await page.title()).toBe("Ledger Live"); + await page.waitForSelector("#__app__ready__", { state: "attached" }); + await page.waitForLoadState("domcontentloaded"); + await page.waitForSelector("#loader-container", { state: "hidden" }); + + // use page in the test + await use(page); + + // stop coverage + await page.evaluate(() => + (window as any).collectIstanbulCoverage(JSON.stringify((window as any).__coverage__)), + ); + + // close app + await electronApp.close(); + }, +}); + +export default test; diff --git a/playwright/models/AddAccountModal.ts b/playwright/models/AddAccountModal.ts new file mode 100644 index 0000000000..cf0129a0b4 --- /dev/null +++ b/playwright/models/AddAccountModal.ts @@ -0,0 +1,45 @@ +import { Page, Locator } from "@playwright/test"; +import { Modal } from "./Modal"; + +export class AddAccountModal extends Modal { + readonly page: Page; + readonly addAccountButton: Locator; + readonly selectAccount: Locator; + readonly selectAccountInput: Locator; + readonly addAccountsButton: Locator; + readonly stopButton: Locator; + readonly retryButton: Locator; + readonly addMoreButton: Locator; + readonly doneButton: Locator; + + constructor(page: Page) { + super(page); + this.page = page; + this.addAccountButton = page.locator('data-test-id=portfolio-empty-state-add-account-button'); + this.selectAccount = page.locator("text=Choose a crypto asset"); // FIXME: I need an id + this.selectAccountInput = page.locator('[placeholder="Search"]'); // FIXME: I need an id + this.addAccountsButton = page.locator('data-test-id=add-accounts-import-add-button'); + this.retryButton = page.locator('data-test-id=add-accounts-import-retry-button'); + this.stopButton = page.locator('data-test-id=add-accounts-import-stop-button'); + this.addMoreButton = page.locator('data-test-id=add-accounts-finish-add-more-button'); + this.doneButton = page.locator('data-test-id=add-accounts-finish-close-button'); + } + + async open() { + await this.addAccountButton.click(); + } + + async select(currency: string) { + await this.selectAccount.click(); + await this.selectAccountInput.fill(currency); + await this.selectAccountInput.press("Enter"); + } + + async addAccounts() { + await this.addAccountsButton.click(); + } + + async done() { + await this.doneButton.click(); + } +} diff --git a/playwright/models/DeviceAction.ts b/playwright/models/DeviceAction.ts new file mode 100644 index 0000000000..40c773fb46 --- /dev/null +++ b/playwright/models/DeviceAction.ts @@ -0,0 +1,77 @@ +import { Page, Locator } from "@playwright/test"; +import { + deviceInfo155 as deviceInfo, + mockListAppsResult, +} from "@ledgerhq/live-common/lib/apps/mock"; + +export class DeviceAction { + readonly page: Page; + readonly deviceActionLoader: Locator; + + constructor(page: Page) { + this.page = page; + this.deviceActionLoader = page.locator('#deviceAction-loading'); + } + + async openApp() { + await this.page.evaluate(() => { + (window as any).mock.events.mockDeviceEvent({ type: "opened" }); + }); + + await this.deviceActionLoader.waitFor({ state: "visible" }); + await this.deviceActionLoader.waitFor({ state: "detached" }); + } + + async genuineCheck(appDesc: string = "Bitcoin", installedDesc: string = "Bitcoin") { + const result = mockListAppsResult(appDesc, installedDesc, deviceInfo); + + await this.page.evaluate( + args => { + const [deviceInfo, result] = args; + + (window as any).mock.events.mockDeviceEvent( + { + type: "listingApps", + deviceInfo, + }, + { + type: "result", + result, + }, + { type: "complete" }, + ); + }, + [deviceInfo, result], + ); + + await this.deviceActionLoader.waitFor({ state: "hidden" }); + } + + async accessManager( + appDesc: string = "Bitcoin,Tron,Litecoin,Ethereum,Ripple,Stellar", + installedDesc: string = "Bitcoin,Litecoin,Ethereum (outdated)", + ) { + const result = mockListAppsResult(appDesc, installedDesc, deviceInfo); + + await this.page.evaluate( + args => { + const [deviceInfo, result] = args; + + (window as any).mock.events.mockDeviceEvent( + { + type: "listingApps", + deviceInfo, + }, + { + type: "result", + result, + }, + { type: "complete" }, + ); + }, + [deviceInfo, result], + ); + + await this.deviceActionLoader.waitFor({ state: "hidden" }); + } +} diff --git a/playwright/models/Layout.ts b/playwright/models/Layout.ts new file mode 100644 index 0000000000..3ddb89471c --- /dev/null +++ b/playwright/models/Layout.ts @@ -0,0 +1,81 @@ +import { Page, Locator } from '@playwright/test'; + +export class Layout { + readonly page: Page; + readonly totalBalance: Locator; + readonly loadingLogo: Locator; + readonly logo: Locator; + readonly inputError: Locator; + readonly inputWarning: Locator; + readonly drawerCollapseButton: Locator; + readonly drawerPortfolioButton: Locator; + readonly drawerAccountsButton: Locator; + readonly drawerSendButton: Locator; + readonly drawerReceiveButton: Locator; + readonly drawerManagerButton: Locator; + readonly drawerBuycryptoButton: Locator; + readonly drawerExperimentalButton: Locator; + readonly topbarDiscreetButton: Locator; + readonly topbarSynchronizeButton: Locator; + readonly topbarSettingsButton: Locator; + readonly topbarLockButton: Locator; + readonly bookmarkedAccountsList: Locator; + + constructor(page: Page) { + this.page = page; + + // portfolio + this.totalBalance = page.locator('data-test-id=total-balance'); + + // drawer + this.drawerCollapseButton = page.locator('data-test-id=drawer-collapse-button'); + this.drawerPortfolioButton = page.locator('data-test-id=drawer-dashboard-button'); + this.drawerAccountsButton = page.locator('data-test-id=drawer-accounts-button'); + this.drawerSendButton = page.locator('data-test-id=drawer-send-button'); + this.drawerReceiveButton = page.locator('data-test-id=drawer-receive-button'); + this.drawerManagerButton = page.locator('data-test-id=drawer-manager-button'); + this.drawerBuycryptoButton = page.locator('data-test-id=drawer-exchange-button'); + this.drawerExperimentalButton = page.locator('data-test-id=drawer-experimental-button'); + this.bookmarkedAccountsList = page.locator("data-test-id=bookmarked-accounts"); + + // topbar + this.topbarDiscreetButton = page.locator('data-test-id=topbar-discreet-button'); + this.topbarSynchronizeButton = page.locator('data-test-id=topbar-synchronize-button'); + this.topbarSettingsButton = page.locator('data-test-id=topbar-settings-button'); + this.topbarLockButton = page.locator('data-test-id=topbar-password-lock-button'); + + // general + this.loadingLogo = page.locator('id=loading-logo'); + this.logo = page.locator("data-test-id=logo"); + this.inputError = page.locator('id=input-error'); // no data-test-id because css style is applied + this.inputWarning = page.locator('id=input-warning'); // no data-test-id because css style is applied + } + + async goToPortfolio() { + await this.drawerPortfolioButton.click(); + } + + async goToAccounts() { + await this.drawerAccountsButton.click(); + } + + async goToManager() { + await this.drawerManagerButton.click(); + } + + async goToBuyCrypto() { + await this.drawerBuycryptoButton.click(); + } + + async toggleDiscreetMode() { + await this.topbarDiscreetButton.click(); + } + + async goToSettings() { + await this.topbarSettingsButton.click(); + } + + async lockApp() { + await this.topbarLockButton.click(); + } +}; diff --git a/playwright/models/LockscreenPage.ts b/playwright/models/LockscreenPage.ts new file mode 100644 index 0000000000..7463a9d451 --- /dev/null +++ b/playwright/models/LockscreenPage.ts @@ -0,0 +1,28 @@ +import { Page, Locator } from "@playwright/test"; +import { Layout } from "./Layout"; + +export class LockscreenPage extends Layout { + readonly page: Page; + readonly container: Locator; + readonly passwordInput: Locator; + readonly forgottenButton: Locator; + readonly loginButton: Locator; + + constructor(page: Page) { + super(page); + this.page = page; + this.container = page.locator('data-test-id=lockscreen-container'); + this.passwordInput = page.locator('data-test-id=lockscreen-password-input'); + this.forgottenButton = page.locator('data-test-id=lockscreen-forgotten-button'); + this.loginButton = page.locator('data-test-id=lockscreen-login-button'); + } + + async login(password: string) { + await this.passwordInput.fill(password); + await this.loginButton.click(); + } + + async lostPassword() { + await this.forgottenButton.click(); + } +} diff --git a/playwright/models/ManagerPage.ts b/playwright/models/ManagerPage.ts new file mode 100644 index 0000000000..7aa32013d0 --- /dev/null +++ b/playwright/models/ManagerPage.ts @@ -0,0 +1,65 @@ +import { Page, Locator } from "@playwright/test"; + +export class ManagerPage { + readonly page: Page; + readonly managerMenu: Locator; + readonly firmwareUpdateButton: Locator; + readonly installedAppsTab: Locator; + readonly catalogAppsTab: Locator; + readonly updateAllButton: Locator; + readonly appUpdateState: Locator; + readonly appInstallState: Locator; + readonly installAppButton: Function; + readonly uninstallAppButton: Function; + readonly uninstallAllAppsButton: Locator; + readonly confirmButton: Locator; + readonly installedAppEmptyState: Locator; + + constructor(page: Page) { + this.page = page; + this.managerMenu = page.locator('data-test-id=drawer-manager-button'); + this.firmwareUpdateButton = page.locator("#manager-update-firmware-button"); + this.installedAppsTab = page.locator('data-test-id=manager-installed-apps-tab'); + this.catalogAppsTab = page.locator('data-test-id=manager-app-catalog-tab'); + this.updateAllButton = page.locator('#managerAppsList-updateAll'); + this.appUpdateState = page.locator('text=Updating...').first(); + this.appInstallState = page.locator('text=Installing...').first(); + this.installAppButton = (currency: string) : Locator => page.locator(`#appActionsInstall-${currency}`); + this.uninstallAppButton = (currency: string) : Locator => page.locator(`#appActionsUninstall-${currency}`); + this.uninstallAllAppsButton = page.locator('button:has-text("Uninstall all")'); + this.confirmButton = page.locator('data-test-id=modal-confirm-button'); + this.installedAppEmptyState = page.locator("text=No apps installed on your device"); + } + + async navigate() { + await this.managerMenu.click(); + } + + async goToInstalledAppTab() { + await this.installedAppsTab.click(); + } + + async goToCatalogTab() { + await this.catalogAppsTab.click(); + } + + async updateAllApps() { + await this.updateAllButton.click(); + await this.appUpdateState.waitFor({ state: "detached" }); + } + + async installApp(currency: string) { + await this.installAppButton(currency).click(); + await this.appInstallState.waitFor({ state: "detached" }); + } + + async uninstallApp(currency: string) { + await this.uninstallAppButton(currency).click(); + } + + async uninstallAllApps() { + await this.uninstallAllAppsButton.click(); + await this.confirmButton.click(); + await this.installedAppEmptyState.waitFor({ state: "visible" }); + } +} diff --git a/playwright/models/Modal.ts b/playwright/models/Modal.ts new file mode 100644 index 0000000000..5130835884 --- /dev/null +++ b/playwright/models/Modal.ts @@ -0,0 +1,61 @@ +import { Page, Locator } from "@playwright/test"; + +export class Modal { + readonly page: Page; + readonly container: Locator; + readonly title: Locator; + readonly subtitle: Locator; + readonly content: Locator; + readonly backdrop: Locator; + readonly continueButton: Locator; + readonly saveButton: Locator; + readonly cancelButton: Locator; + readonly confirmButton: Locator; + readonly doneButton: Locator; + readonly closeButton: Locator; + readonly backButton: Locator; + + constructor(page: Page) { + this.page = page; + this.container = page.locator('[data-test-id=modal-container][style="opacity: 1; transform: scale(1);"]'); + this.title = page.locator('data-test-id=modal-title'); + this.subtitle = page.locator('data-test-id=modal-subtitle'); + this.content = page.locator('data-test-id=modal-content'); + this.backdrop = page.locator('data-test-id=modal-backdrop'); + this.continueButton = page.locator('data-test-id=modal-continue-button'); + this.saveButton = page.locator('data-test-id=modal-save-button'); + this.cancelButton = page.locator('data-test-id=modal-cancel-button'); + this.confirmButton = page.locator('data-test-id=modal-confirm-button'); + this.doneButton = page.locator('data-test-id=modal-done-button'); + this.closeButton = page.locator('data-test-id=modal-close-button'); + this.backButton = page.locator('data-test-id=modal-back-button'); + } + + async continue() { + await this.continueButton.click(); + } + + async save() { + await this.saveButton.click(); + } + + async cancel() { + await this.cancelButton.click(); + } + + async confirm() { + await this.confirmButton.click(); + } + + async done() { + await this.doneButton.click(); + } + + async back() { + await this.backButton.click(); + } + + async close() { + await this.closeButton.click(); + } +} diff --git a/playwright/models/OnboardingPage.ts b/playwright/models/OnboardingPage.ts new file mode 100644 index 0000000000..9364c1f496 --- /dev/null +++ b/playwright/models/OnboardingPage.ts @@ -0,0 +1,54 @@ +import { Page, Locator } from '@playwright/test'; + +export class OnboardingPage { + readonly page: Page; + readonly getStartedButton: Locator; + readonly termsCheckbox: Locator; + readonly termsSubmitButton: Locator; + readonly selectDeviceButton: Function; + readonly connectDeviceButton: Locator; + readonly modalContainer: Locator; + readonly checkMyNanoButton: Locator; + readonly continueButton: Locator; + + constructor(page: Page) { + this.page = page; + this.getStartedButton = page.locator('#onboarding-get-started-button'); + this.termsCheckbox = page.locator("#onboarding-terms-check"); + this.termsSubmitButton = page.locator('#onboarding-terms-submit'); + this.selectDeviceButton = (device: string): Locator => page.locator(`button:has-text("${device}")`); + this.connectDeviceButton = page.locator('button:has-text("Connect deviceConnect your Nano XIs your device already set up? Connect it to th")'); + this.modalContainer = page.locator('data-test-id=modal-container'); + this.checkMyNanoButton = page.locator('button:has-text("Check my Nano")'); + this.continueButton = page.locator('button:has-text("Continue")') + } + + async getStarted() { + await this.getStartedButton.click(); + } + + async acceptTerms() { + await this.termsCheckbox.click(); + await Promise.all([ + this.page.waitForResponse("**/*.svg"), + this.termsSubmitButton.click(), + ]); + } + + async selectDevice(device: "Nano S" | "Nano X" | "Blue") { + await this.selectDeviceButton(device).click(); + } + + async connectDevice() { + await this.connectDeviceButton.click(); + await this.modalContainer.waitFor({ state: 'visible' }); + } + + async checkDevice() { + await this.checkMyNanoButton.click(); + } + + async continue() { + await this.continueButton.click() + } +}; diff --git a/playwright/models/PasswordlockModal.ts b/playwright/models/PasswordlockModal.ts new file mode 100644 index 0000000000..23bbadb14e --- /dev/null +++ b/playwright/models/PasswordlockModal.ts @@ -0,0 +1,49 @@ +import { Page, Locator, expect } from "@playwright/test"; +import { Modal } from "./Modal"; + +export class PasswordlockModal extends Modal { + readonly page: Page; + readonly switchButton: Locator; + readonly changeButton: Locator; + readonly newPasswordInput: Locator; + readonly currentPasswordInput: Locator; + readonly confirmPasswordInput: Locator; + readonly disablePasswordInput: Locator; + + constructor(page: Page) { + super(page); + this.page = page; + this.switchButton = page.locator("data-test-id=settings-password-lock-switch"); + this.changeButton = page.locator("data-test-id=settings-password-change-button"); + this.newPasswordInput = page.locator('data-test-id=new-password-input'); + this.confirmPasswordInput = page.locator('data-test-id=confirm-password-input'); + this.currentPasswordInput = page.locator('data-test-id=current-password-input'); + this.disablePasswordInput = page.locator('data-test-id=disable-password-input'); + } + + async toggle() { + await this.switchButton.click(); + } + + async openChangePasswordModal() { + await this.changeButton.click(); + } + + async enablePassword(newPassword: string, confirmPassword: string) { + await this.newPasswordInput.fill(newPassword); + await this.confirmPasswordInput.fill(confirmPassword); + await this.saveButton.click(); + } + + async disablePassword(password: string) { + await this.disablePasswordInput.fill(password); + await this.saveButton.click(); + } + + async changePassword(currentPassword: string, newPassword: string, confirmPassword: string) { + await this.currentPasswordInput.fill(currentPassword); + await this.newPasswordInput.fill(newPassword); + await this.confirmPasswordInput.fill(confirmPassword); + await this.saveButton.click(); + } +} diff --git a/playwright/models/SettingsPage.ts b/playwright/models/SettingsPage.ts new file mode 100644 index 0000000000..37f20ec9ec --- /dev/null +++ b/playwright/models/SettingsPage.ts @@ -0,0 +1,35 @@ +import { Page, Locator } from '@playwright/test'; +import { Layout } from './Layout'; + +export class SettingsPage extends Layout { + readonly page: Page; + readonly accountsTab: Locator; + readonly aboutTab: Locator; + readonly helpTab: Locator; + readonly experimentalTab: Locator; + + constructor(page: Page) { + super(page); + this.page = page; + this.accountsTab = page.locator('data-test-id=settings-accounts-tab'); + this.aboutTab = page.locator('data-test-id=settings-about-tab'); + this.helpTab = page.locator('data-test-id=settings-help-tab'); + this.experimentalTab = page.locator('data-test-id=settings-experimental-tab'); + } + + async goToAccountsTab() { + await this.accountsTab.click(); + } + + async goToAboutTab() { + await this.aboutTab.click(); + } + + async goToHelpTab() { + await this.helpTab.click(); + } + + async goToExperimentalTab() { + await this.experimentalTab.click(); + } +} diff --git a/playwright/playwright.config.ts b/playwright/playwright.config.ts new file mode 100644 index 0000000000..269108da92 --- /dev/null +++ b/playwright/playwright.config.ts @@ -0,0 +1,32 @@ +import { PlaywrightTestConfig } from "@playwright/test"; + +const config: PlaywrightTestConfig = { + testDir: "specs/", + testIgnore: "specs/recorder.spec.ts", + outputDir: "./artifacts/test-results", + timeout: 60000, + globalTimeout: 0, + globalSetup: require.resolve("./utils/global-setup"), + globalTeardown: require.resolve("./utils/global-teardown"), + use: { + launchOptions: { // FIXME: launchOptions doesn't seem to work, go to fixtures/common.ts + slowMo: 100, + }, + viewport: { width: 1024, height: 768 }, // FIXME: viewport doesn't seem to work + ignoreHTTPSErrors: true, + screenshot: process.env.CI ? "on" : "off", + video: process.env.CI ? "on-first-retry" : "off", // FIXME: "off" doesn't seem to work + trace: process.env.CI ? "retain-on-failure" : "off", // FIXME: traceview doesn't seem to work + }, + forbidOnly: !!process.env.CI, + preserveOutput: process.env.CI ? "failures-only" : "always", + maxFailures: process.env.CI ? 5 : undefined, + reportSlowTests: process.env.CI ? { max: 0, threshold: 60000 } : null, + workers: process.env.CI ? 1 : 1, // NOTE: 'macos-latest' and 'windows-latest' can't run 3 concurrent workers + retries: process.env.CI ? 2 : 0, // FIXME: --update-snapshots doesn't work with --retries + reporter: process.env.CI + ? [["html", { open: "never", outputFolder: "playwright/artifacts/html-report" }], ["github"]] + : "list", +}; + +export default config; diff --git a/playwright/specs/account.spec.ts b/playwright/specs/account.spec.ts new file mode 100644 index 0000000000..62bbeff69b --- /dev/null +++ b/playwright/specs/account.spec.ts @@ -0,0 +1,55 @@ +import test from "../fixtures/common"; +import { expect } from "@playwright/test"; +import { AddAccountModal } from "../models/AddAccountModal"; +import { DeviceAction } from "../models/DeviceAction"; +import { Layout } from "../models/Layout"; + +test.use({ userdata: "skip-onboarding" }); + +const currencies = ["BTC", "LTC", "ETH", "ATOM", "XTZ", "XRP"]; + +test.describe.parallel("Accounts", () => { + for (const currency of currencies) { + test(`[${currency}] Add account`, async ({ page }) => { + const addAccountModal = new AddAccountModal(page); + const deviceAction = new DeviceAction(page); + const layout = new Layout(page); + + await test.step(`[${currency}] Open modal`, async () => { + await addAccountModal.open(); + expect(await addAccountModal.title.textContent()).toBe("Add accounts"); + expect(await addAccountModal.container.screenshot()).toMatchSnapshot(`open-modal.png`); + }); + + await test.step(`[${currency}] Select currency`, async () => { + await addAccountModal.select(currency); + expect(await addAccountModal.container.screenshot()).toMatchSnapshot( + `${currency}-select.png`, + ); + await addAccountModal.continue(); + }); + + await test.step(`[${currency}] Open device app`, async () => { + await deviceAction.openApp(); + await addAccountModal.stopButton.isVisible(); + await addAccountModal.addAccountsButton.waitFor({ state: "visible" }); + expect(await addAccountModal.container.screenshot()).toMatchSnapshot( + `${currency}-accounts-list.png`, + ); + }); + + await test.step(`[${currency}] Scan and add accounts`, async () => { + await addAccountModal.addAccounts(); + expect(await addAccountModal.container.screenshot()).toMatchSnapshot( + `${currency}-success.png`, + ); + }); + + await test.step(`[${currency}] Done`, async () => { + await addAccountModal.done(); + await layout.totalBalance.waitFor({ state: "visible" }); + expect(await page.screenshot()).toMatchSnapshot(`${currency}-complete.png`); + }); + }); + } +}); diff --git a/playwright/specs/account.spec.ts-snapshots/ATOM-accounts-list-darwin.png b/playwright/specs/account.spec.ts-snapshots/ATOM-accounts-list-darwin.png new file mode 100644 index 0000000000..f26e6ee8df Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ATOM-accounts-list-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ATOM-accounts-list-linux.png b/playwright/specs/account.spec.ts-snapshots/ATOM-accounts-list-linux.png new file mode 100644 index 0000000000..6662f0c0b1 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ATOM-accounts-list-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ATOM-accounts-list-win32.png b/playwright/specs/account.spec.ts-snapshots/ATOM-accounts-list-win32.png new file mode 100644 index 0000000000..8fbdc1da89 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ATOM-accounts-list-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ATOM-complete-darwin.png b/playwright/specs/account.spec.ts-snapshots/ATOM-complete-darwin.png new file mode 100644 index 0000000000..1540d23401 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ATOM-complete-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ATOM-complete-linux.png b/playwright/specs/account.spec.ts-snapshots/ATOM-complete-linux.png new file mode 100644 index 0000000000..5324e0c48f Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ATOM-complete-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ATOM-complete-win32.png b/playwright/specs/account.spec.ts-snapshots/ATOM-complete-win32.png new file mode 100644 index 0000000000..7919fc3ed9 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ATOM-complete-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ATOM-select-darwin.png b/playwright/specs/account.spec.ts-snapshots/ATOM-select-darwin.png new file mode 100644 index 0000000000..cfa12a7039 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ATOM-select-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ATOM-select-linux.png b/playwright/specs/account.spec.ts-snapshots/ATOM-select-linux.png new file mode 100644 index 0000000000..5674a19bd5 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ATOM-select-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ATOM-select-win32.png b/playwright/specs/account.spec.ts-snapshots/ATOM-select-win32.png new file mode 100644 index 0000000000..861c67001b Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ATOM-select-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ATOM-success-darwin.png b/playwright/specs/account.spec.ts-snapshots/ATOM-success-darwin.png new file mode 100644 index 0000000000..5bc7b63e12 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ATOM-success-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ATOM-success-linux.png b/playwright/specs/account.spec.ts-snapshots/ATOM-success-linux.png new file mode 100644 index 0000000000..a9a80728b1 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ATOM-success-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ATOM-success-win32.png b/playwright/specs/account.spec.ts-snapshots/ATOM-success-win32.png new file mode 100644 index 0000000000..b439048a7a Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ATOM-success-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/BTC-accounts-list-darwin.png b/playwright/specs/account.spec.ts-snapshots/BTC-accounts-list-darwin.png new file mode 100644 index 0000000000..fb868236a7 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/BTC-accounts-list-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/BTC-accounts-list-linux.png b/playwright/specs/account.spec.ts-snapshots/BTC-accounts-list-linux.png new file mode 100644 index 0000000000..4d367f4995 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/BTC-accounts-list-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/BTC-accounts-list-win32.png b/playwright/specs/account.spec.ts-snapshots/BTC-accounts-list-win32.png new file mode 100644 index 0000000000..c01c866e07 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/BTC-accounts-list-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/BTC-complete-darwin.png b/playwright/specs/account.spec.ts-snapshots/BTC-complete-darwin.png new file mode 100644 index 0000000000..7bbe952da9 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/BTC-complete-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/BTC-complete-linux.png b/playwright/specs/account.spec.ts-snapshots/BTC-complete-linux.png new file mode 100644 index 0000000000..c8abb7dc18 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/BTC-complete-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/BTC-complete-win32.png b/playwright/specs/account.spec.ts-snapshots/BTC-complete-win32.png new file mode 100644 index 0000000000..a193b489ee Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/BTC-complete-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/BTC-select-darwin.png b/playwright/specs/account.spec.ts-snapshots/BTC-select-darwin.png new file mode 100644 index 0000000000..4096c48bdc Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/BTC-select-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/BTC-select-linux.png b/playwright/specs/account.spec.ts-snapshots/BTC-select-linux.png new file mode 100644 index 0000000000..7703d66cc9 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/BTC-select-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/BTC-select-win32.png b/playwright/specs/account.spec.ts-snapshots/BTC-select-win32.png new file mode 100644 index 0000000000..517dcb338d Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/BTC-select-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/BTC-success-darwin.png b/playwright/specs/account.spec.ts-snapshots/BTC-success-darwin.png new file mode 100644 index 0000000000..3ed2c5e238 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/BTC-success-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/BTC-success-linux.png b/playwright/specs/account.spec.ts-snapshots/BTC-success-linux.png new file mode 100644 index 0000000000..3b3b6c7028 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/BTC-success-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/BTC-success-win32.png b/playwright/specs/account.spec.ts-snapshots/BTC-success-win32.png new file mode 100644 index 0000000000..0269bd4ac5 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/BTC-success-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ETH-accounts-list-darwin.png b/playwright/specs/account.spec.ts-snapshots/ETH-accounts-list-darwin.png new file mode 100644 index 0000000000..7ef21e1218 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ETH-accounts-list-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ETH-accounts-list-linux.png b/playwright/specs/account.spec.ts-snapshots/ETH-accounts-list-linux.png new file mode 100644 index 0000000000..049a8882bd Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ETH-accounts-list-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ETH-accounts-list-win32.png b/playwright/specs/account.spec.ts-snapshots/ETH-accounts-list-win32.png new file mode 100644 index 0000000000..fe5686647b Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ETH-accounts-list-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ETH-complete-darwin.png b/playwright/specs/account.spec.ts-snapshots/ETH-complete-darwin.png new file mode 100644 index 0000000000..22ad7fbd2b Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ETH-complete-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ETH-complete-linux.png b/playwright/specs/account.spec.ts-snapshots/ETH-complete-linux.png new file mode 100644 index 0000000000..aaf2adb9ac Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ETH-complete-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ETH-complete-win32.png b/playwright/specs/account.spec.ts-snapshots/ETH-complete-win32.png new file mode 100644 index 0000000000..921658e312 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ETH-complete-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ETH-select-darwin.png b/playwright/specs/account.spec.ts-snapshots/ETH-select-darwin.png new file mode 100644 index 0000000000..5cf97dc7c5 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ETH-select-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ETH-select-linux.png b/playwright/specs/account.spec.ts-snapshots/ETH-select-linux.png new file mode 100644 index 0000000000..8b13ae9d49 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ETH-select-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ETH-select-win32.png b/playwright/specs/account.spec.ts-snapshots/ETH-select-win32.png new file mode 100644 index 0000000000..6706f83510 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ETH-select-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ETH-success-darwin.png b/playwright/specs/account.spec.ts-snapshots/ETH-success-darwin.png new file mode 100644 index 0000000000..675cdd99c7 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ETH-success-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ETH-success-linux.png b/playwright/specs/account.spec.ts-snapshots/ETH-success-linux.png new file mode 100644 index 0000000000..1e3fe11824 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ETH-success-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/ETH-success-win32.png b/playwright/specs/account.spec.ts-snapshots/ETH-success-win32.png new file mode 100644 index 0000000000..67283e97cf Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/ETH-success-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/LTC-accounts-list-darwin.png b/playwright/specs/account.spec.ts-snapshots/LTC-accounts-list-darwin.png new file mode 100644 index 0000000000..f3681835f6 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/LTC-accounts-list-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/LTC-accounts-list-linux.png b/playwright/specs/account.spec.ts-snapshots/LTC-accounts-list-linux.png new file mode 100644 index 0000000000..9351c0c8d5 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/LTC-accounts-list-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/LTC-accounts-list-win32.png b/playwright/specs/account.spec.ts-snapshots/LTC-accounts-list-win32.png new file mode 100644 index 0000000000..c864a1bf27 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/LTC-accounts-list-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/LTC-complete-darwin.png b/playwright/specs/account.spec.ts-snapshots/LTC-complete-darwin.png new file mode 100644 index 0000000000..69e90b373b Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/LTC-complete-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/LTC-complete-linux.png b/playwright/specs/account.spec.ts-snapshots/LTC-complete-linux.png new file mode 100644 index 0000000000..e055afa1a2 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/LTC-complete-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/LTC-complete-win32.png b/playwright/specs/account.spec.ts-snapshots/LTC-complete-win32.png new file mode 100644 index 0000000000..e5c7b4009c Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/LTC-complete-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/LTC-select-darwin.png b/playwright/specs/account.spec.ts-snapshots/LTC-select-darwin.png new file mode 100644 index 0000000000..46cd469a87 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/LTC-select-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/LTC-select-linux.png b/playwright/specs/account.spec.ts-snapshots/LTC-select-linux.png new file mode 100644 index 0000000000..a7f2505f6a Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/LTC-select-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/LTC-select-win32.png b/playwright/specs/account.spec.ts-snapshots/LTC-select-win32.png new file mode 100644 index 0000000000..2f87c0ff82 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/LTC-select-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/LTC-success-darwin.png b/playwright/specs/account.spec.ts-snapshots/LTC-success-darwin.png new file mode 100644 index 0000000000..58ff2b458a Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/LTC-success-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/LTC-success-linux.png b/playwright/specs/account.spec.ts-snapshots/LTC-success-linux.png new file mode 100644 index 0000000000..69411c689b Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/LTC-success-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/LTC-success-win32.png b/playwright/specs/account.spec.ts-snapshots/LTC-success-win32.png new file mode 100644 index 0000000000..262ed1f8a0 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/LTC-success-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XRP-accounts-list-darwin.png b/playwright/specs/account.spec.ts-snapshots/XRP-accounts-list-darwin.png new file mode 100644 index 0000000000..68ab1d0427 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XRP-accounts-list-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XRP-accounts-list-linux.png b/playwright/specs/account.spec.ts-snapshots/XRP-accounts-list-linux.png new file mode 100644 index 0000000000..dcceb5477c Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XRP-accounts-list-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XRP-accounts-list-win32.png b/playwright/specs/account.spec.ts-snapshots/XRP-accounts-list-win32.png new file mode 100644 index 0000000000..860b1981a5 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XRP-accounts-list-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XRP-complete-darwin.png b/playwright/specs/account.spec.ts-snapshots/XRP-complete-darwin.png new file mode 100644 index 0000000000..b018dde3c8 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XRP-complete-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XRP-complete-linux.png b/playwright/specs/account.spec.ts-snapshots/XRP-complete-linux.png new file mode 100644 index 0000000000..ff6dbd207b Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XRP-complete-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XRP-complete-win32.png b/playwright/specs/account.spec.ts-snapshots/XRP-complete-win32.png new file mode 100644 index 0000000000..d8c2e62e15 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XRP-complete-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XRP-select-darwin.png b/playwright/specs/account.spec.ts-snapshots/XRP-select-darwin.png new file mode 100644 index 0000000000..b05e6e4305 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XRP-select-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XRP-select-linux.png b/playwright/specs/account.spec.ts-snapshots/XRP-select-linux.png new file mode 100644 index 0000000000..285d391352 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XRP-select-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XRP-select-win32.png b/playwright/specs/account.spec.ts-snapshots/XRP-select-win32.png new file mode 100644 index 0000000000..9d548a06fa Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XRP-select-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XRP-success-darwin.png b/playwright/specs/account.spec.ts-snapshots/XRP-success-darwin.png new file mode 100644 index 0000000000..1d0adec16a Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XRP-success-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XRP-success-linux.png b/playwright/specs/account.spec.ts-snapshots/XRP-success-linux.png new file mode 100644 index 0000000000..8eba098d74 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XRP-success-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XRP-success-win32.png b/playwright/specs/account.spec.ts-snapshots/XRP-success-win32.png new file mode 100644 index 0000000000..1a6b420cdf Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XRP-success-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XTZ-accounts-list-darwin.png b/playwright/specs/account.spec.ts-snapshots/XTZ-accounts-list-darwin.png new file mode 100644 index 0000000000..c5d0769d28 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XTZ-accounts-list-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XTZ-accounts-list-linux.png b/playwright/specs/account.spec.ts-snapshots/XTZ-accounts-list-linux.png new file mode 100644 index 0000000000..a478a848e3 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XTZ-accounts-list-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XTZ-accounts-list-win32.png b/playwright/specs/account.spec.ts-snapshots/XTZ-accounts-list-win32.png new file mode 100644 index 0000000000..b76addaf3b Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XTZ-accounts-list-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XTZ-complete-darwin.png b/playwright/specs/account.spec.ts-snapshots/XTZ-complete-darwin.png new file mode 100644 index 0000000000..605090acb9 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XTZ-complete-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XTZ-complete-linux.png b/playwright/specs/account.spec.ts-snapshots/XTZ-complete-linux.png new file mode 100644 index 0000000000..9d12922569 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XTZ-complete-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XTZ-complete-win32.png b/playwright/specs/account.spec.ts-snapshots/XTZ-complete-win32.png new file mode 100644 index 0000000000..cf7a4b3196 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XTZ-complete-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XTZ-select-darwin.png b/playwright/specs/account.spec.ts-snapshots/XTZ-select-darwin.png new file mode 100644 index 0000000000..b1e62b299c Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XTZ-select-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XTZ-select-linux.png b/playwright/specs/account.spec.ts-snapshots/XTZ-select-linux.png new file mode 100644 index 0000000000..3458628611 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XTZ-select-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XTZ-select-win32.png b/playwright/specs/account.spec.ts-snapshots/XTZ-select-win32.png new file mode 100644 index 0000000000..5cf083ddb3 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XTZ-select-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XTZ-success-darwin.png b/playwright/specs/account.spec.ts-snapshots/XTZ-success-darwin.png new file mode 100644 index 0000000000..9ddb19feb8 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XTZ-success-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XTZ-success-linux.png b/playwright/specs/account.spec.ts-snapshots/XTZ-success-linux.png new file mode 100644 index 0000000000..7686e567e5 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XTZ-success-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/XTZ-success-win32.png b/playwright/specs/account.spec.ts-snapshots/XTZ-success-win32.png new file mode 100644 index 0000000000..488eb43763 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/XTZ-success-win32.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/open-modal-darwin.png b/playwright/specs/account.spec.ts-snapshots/open-modal-darwin.png new file mode 100644 index 0000000000..558fa8337b Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/open-modal-darwin.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/open-modal-linux.png b/playwright/specs/account.spec.ts-snapshots/open-modal-linux.png new file mode 100644 index 0000000000..b3a52c90ac Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/open-modal-linux.png differ diff --git a/playwright/specs/account.spec.ts-snapshots/open-modal-win32.png b/playwright/specs/account.spec.ts-snapshots/open-modal-win32.png new file mode 100644 index 0000000000..00e0fe2356 Binary files /dev/null and b/playwright/specs/account.spec.ts-snapshots/open-modal-win32.png differ diff --git a/playwright/specs/manager.spec.ts b/playwright/specs/manager.spec.ts new file mode 100644 index 0000000000..543b7a36ec --- /dev/null +++ b/playwright/specs/manager.spec.ts @@ -0,0 +1,57 @@ +import test from "../fixtures/common"; +import { expect } from "@playwright/test"; +import { ManagerPage } from "../models/ManagerPage"; +import { DeviceAction } from "../models/DeviceAction"; + +test.use({ userdata: "skip-onboarding" }); + +test("Manager", async ({ page }) => { + const managerPage = new ManagerPage(page); + const deviceAction = new DeviceAction(page); + + await test.step("can access manager", async () => { + await managerPage.navigate(); + await deviceAction.accessManager(); + await managerPage.firmwareUpdateButton.waitFor({ state: "visible" }); + expect(await page.screenshot()).toMatchSnapshot({ + name: "manager-app-catalog.png", + }); + }); + + await test.step("can install an app", async () => { + await managerPage.installApp("Tron"); + expect(await page.screenshot()).toMatchSnapshot({ + name: "manager-install-tron.png", + }); + }); + + await test.step("can access installed apps tab", async () => { + await managerPage.goToInstalledAppTab(); + expect(await page.screenshot()).toMatchSnapshot({ + name: "manager-installed-apps.png", + }); + }); + + await test.step("can uninstall an app", async () => { + await managerPage.uninstallApp("Tron"); + expect(await page.screenshot()).toMatchSnapshot({ + name: "manager-uninstall-tron.png", + }); + }); + + await test.step("can update all apps", async () => { + await managerPage.goToCatalogTab(); + await managerPage.updateAllApps(); + expect(await page.screenshot()).toMatchSnapshot({ + name: "manager-updateAll.png", + }); + }); + + await test.step("can uninstall all apps", async () => { + await managerPage.goToInstalledAppTab(); + await managerPage.uninstallAllApps(); + expect(await page.screenshot()).toMatchSnapshot({ + name: "manager-uninstallAll.png", + }); + }); +}); diff --git a/playwright/specs/manager.spec.ts-snapshots/manager-app-catalog-darwin.png b/playwright/specs/manager.spec.ts-snapshots/manager-app-catalog-darwin.png new file mode 100644 index 0000000000..7f87711d43 Binary files /dev/null and b/playwright/specs/manager.spec.ts-snapshots/manager-app-catalog-darwin.png differ diff --git a/playwright/specs/manager.spec.ts-snapshots/manager-app-catalog-linux.png b/playwright/specs/manager.spec.ts-snapshots/manager-app-catalog-linux.png new file mode 100644 index 0000000000..b7f06259e3 Binary files /dev/null and b/playwright/specs/manager.spec.ts-snapshots/manager-app-catalog-linux.png differ diff --git a/playwright/specs/manager.spec.ts-snapshots/manager-app-catalog-win32.png b/playwright/specs/manager.spec.ts-snapshots/manager-app-catalog-win32.png new file mode 100644 index 0000000000..af93d0c281 Binary files /dev/null and b/playwright/specs/manager.spec.ts-snapshots/manager-app-catalog-win32.png differ diff --git a/playwright/specs/manager.spec.ts-snapshots/manager-install-tron-darwin.png b/playwright/specs/manager.spec.ts-snapshots/manager-install-tron-darwin.png new file mode 100644 index 0000000000..059637c73e Binary files /dev/null and b/playwright/specs/manager.spec.ts-snapshots/manager-install-tron-darwin.png differ diff --git a/playwright/specs/manager.spec.ts-snapshots/manager-install-tron-linux.png b/playwright/specs/manager.spec.ts-snapshots/manager-install-tron-linux.png new file mode 100644 index 0000000000..9ecbf9f996 Binary files /dev/null and b/playwright/specs/manager.spec.ts-snapshots/manager-install-tron-linux.png differ diff --git a/playwright/specs/manager.spec.ts-snapshots/manager-install-tron-win32.png b/playwright/specs/manager.spec.ts-snapshots/manager-install-tron-win32.png new file mode 100644 index 0000000000..193b98b3b5 Binary files /dev/null and b/playwright/specs/manager.spec.ts-snapshots/manager-install-tron-win32.png differ diff --git a/playwright/specs/manager.spec.ts-snapshots/manager-installed-apps-darwin.png b/playwright/specs/manager.spec.ts-snapshots/manager-installed-apps-darwin.png new file mode 100644 index 0000000000..3b52d99973 Binary files /dev/null and b/playwright/specs/manager.spec.ts-snapshots/manager-installed-apps-darwin.png differ diff --git a/playwright/specs/manager.spec.ts-snapshots/manager-installed-apps-linux.png b/playwright/specs/manager.spec.ts-snapshots/manager-installed-apps-linux.png new file mode 100644 index 0000000000..fee7dd1263 Binary files /dev/null and b/playwright/specs/manager.spec.ts-snapshots/manager-installed-apps-linux.png differ diff --git a/playwright/specs/manager.spec.ts-snapshots/manager-installed-apps-win32.png b/playwright/specs/manager.spec.ts-snapshots/manager-installed-apps-win32.png new file mode 100644 index 0000000000..e6aedec28a Binary files /dev/null and b/playwright/specs/manager.spec.ts-snapshots/manager-installed-apps-win32.png differ diff --git a/playwright/specs/manager.spec.ts-snapshots/manager-uninstall-tron-darwin.png b/playwright/specs/manager.spec.ts-snapshots/manager-uninstall-tron-darwin.png new file mode 100644 index 0000000000..0470728595 Binary files /dev/null and b/playwright/specs/manager.spec.ts-snapshots/manager-uninstall-tron-darwin.png differ diff --git a/playwright/specs/manager.spec.ts-snapshots/manager-uninstall-tron-linux.png b/playwright/specs/manager.spec.ts-snapshots/manager-uninstall-tron-linux.png new file mode 100644 index 0000000000..f10e905fe7 Binary files /dev/null and b/playwright/specs/manager.spec.ts-snapshots/manager-uninstall-tron-linux.png differ diff --git a/playwright/specs/manager.spec.ts-snapshots/manager-uninstall-tron-win32.png b/playwright/specs/manager.spec.ts-snapshots/manager-uninstall-tron-win32.png new file mode 100644 index 0000000000..5e712d405b Binary files /dev/null and b/playwright/specs/manager.spec.ts-snapshots/manager-uninstall-tron-win32.png differ diff --git a/playwright/specs/manager.spec.ts-snapshots/manager-uninstallAll-darwin.png b/playwright/specs/manager.spec.ts-snapshots/manager-uninstallAll-darwin.png new file mode 100644 index 0000000000..0be45feb1a Binary files /dev/null and b/playwright/specs/manager.spec.ts-snapshots/manager-uninstallAll-darwin.png differ diff --git a/playwright/specs/manager.spec.ts-snapshots/manager-uninstallAll-linux.png b/playwright/specs/manager.spec.ts-snapshots/manager-uninstallAll-linux.png new file mode 100644 index 0000000000..4c04875d4e Binary files /dev/null and b/playwright/specs/manager.spec.ts-snapshots/manager-uninstallAll-linux.png differ diff --git a/playwright/specs/manager.spec.ts-snapshots/manager-uninstallAll-win32.png b/playwright/specs/manager.spec.ts-snapshots/manager-uninstallAll-win32.png new file mode 100644 index 0000000000..4e97f57e34 Binary files /dev/null and b/playwright/specs/manager.spec.ts-snapshots/manager-uninstallAll-win32.png differ diff --git a/playwright/specs/manager.spec.ts-snapshots/manager-updateAll-darwin.png b/playwright/specs/manager.spec.ts-snapshots/manager-updateAll-darwin.png new file mode 100644 index 0000000000..9a78240406 Binary files /dev/null and b/playwright/specs/manager.spec.ts-snapshots/manager-updateAll-darwin.png differ diff --git a/playwright/specs/manager.spec.ts-snapshots/manager-updateAll-linux.png b/playwright/specs/manager.spec.ts-snapshots/manager-updateAll-linux.png new file mode 100644 index 0000000000..fe060275af Binary files /dev/null and b/playwright/specs/manager.spec.ts-snapshots/manager-updateAll-linux.png differ diff --git a/playwright/specs/manager.spec.ts-snapshots/manager-updateAll-win32.png b/playwright/specs/manager.spec.ts-snapshots/manager-updateAll-win32.png new file mode 100644 index 0000000000..5a0ab24e0e Binary files /dev/null and b/playwright/specs/manager.spec.ts-snapshots/manager-updateAll-win32.png differ diff --git a/playwright/specs/onboarding.spec.ts b/playwright/specs/onboarding.spec.ts new file mode 100644 index 0000000000..9a90a18faf --- /dev/null +++ b/playwright/specs/onboarding.spec.ts @@ -0,0 +1,47 @@ +import test from "../fixtures/common"; +import { expect } from "@playwright/test"; +import { OnboardingPage } from "../models/OnboardingPage"; +import { DeviceAction } from "../models/DeviceAction"; + +test("Onboarding", async ({ page }) => { + const onboardingPage = new OnboardingPage(page); + const deviceAction = new DeviceAction(page); + + await test.step("Get started", async () => { + expect(await onboardingPage.getStartedButton).toBeVisible(); + expect(await page.screenshot()).toMatchSnapshot(`getstarted.png`); + await onboardingPage.getStarted(); + }); + + await test.step("Terms of service", async () => { + expect(await page.screenshot()).toMatchSnapshot(`terms.png`); + await onboardingPage.acceptTerms(); + }); + + await test.step("Select Nano X", async () => { + expect(await page.screenshot()).toMatchSnapshot(`device-selection.png`); + await onboardingPage.selectDevice("Nano X"); + }); + + await test.step("Already set up", async () => { + expect(await page.screenshot()).toMatchSnapshot(`onboarding-nanox.png`); + await onboardingPage.connectDevice(); + }); + + await test.step("Device genuine check", async () => { + expect(await page.screenshot()).toMatchSnapshot(`connect-nanox.png`); + await onboardingPage.continue(); + await onboardingPage.checkDevice(); + expect(await page.screenshot()).toMatchSnapshot(`before-genuine-check.png`); + }); + + await test.step("Pass genuine check", async () => { + await deviceAction.genuineCheck(); + expect(await page.screenshot()).toMatchSnapshot("genuine-check-done.png"); + }); + + await test.step("Reach app", async () => { + await onboardingPage.continue(); + expect(await page.screenshot()).toMatchSnapshot(`onboarding-complete.png`); + }); +}); diff --git a/playwright/specs/onboarding.spec.ts-snapshots/before-genuine-check-darwin.png b/playwright/specs/onboarding.spec.ts-snapshots/before-genuine-check-darwin.png new file mode 100644 index 0000000000..1a38a8b315 Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/before-genuine-check-darwin.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/before-genuine-check-linux.png b/playwright/specs/onboarding.spec.ts-snapshots/before-genuine-check-linux.png new file mode 100644 index 0000000000..47bcbcb995 Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/before-genuine-check-linux.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/before-genuine-check-win32.png b/playwright/specs/onboarding.spec.ts-snapshots/before-genuine-check-win32.png new file mode 100644 index 0000000000..f41a9e5001 Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/before-genuine-check-win32.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/connect-nanox-darwin.png b/playwright/specs/onboarding.spec.ts-snapshots/connect-nanox-darwin.png new file mode 100644 index 0000000000..68464d238a Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/connect-nanox-darwin.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/connect-nanox-linux.png b/playwright/specs/onboarding.spec.ts-snapshots/connect-nanox-linux.png new file mode 100644 index 0000000000..0ca1227172 Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/connect-nanox-linux.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/connect-nanox-win32.png b/playwright/specs/onboarding.spec.ts-snapshots/connect-nanox-win32.png new file mode 100644 index 0000000000..4b557436ac Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/connect-nanox-win32.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/device-selection-darwin.png b/playwright/specs/onboarding.spec.ts-snapshots/device-selection-darwin.png new file mode 100644 index 0000000000..2f081cfa28 Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/device-selection-darwin.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/device-selection-linux.png b/playwright/specs/onboarding.spec.ts-snapshots/device-selection-linux.png new file mode 100644 index 0000000000..3617b80478 Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/device-selection-linux.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/device-selection-win32.png b/playwright/specs/onboarding.spec.ts-snapshots/device-selection-win32.png new file mode 100644 index 0000000000..eace9e79f0 Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/device-selection-win32.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/genuine-check-done-darwin.png b/playwright/specs/onboarding.spec.ts-snapshots/genuine-check-done-darwin.png new file mode 100644 index 0000000000..4bfdd0d4d6 Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/genuine-check-done-darwin.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/genuine-check-done-linux.png b/playwright/specs/onboarding.spec.ts-snapshots/genuine-check-done-linux.png new file mode 100644 index 0000000000..552cdff9f6 Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/genuine-check-done-linux.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/genuine-check-done-win32.png b/playwright/specs/onboarding.spec.ts-snapshots/genuine-check-done-win32.png new file mode 100644 index 0000000000..753abdc67e Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/genuine-check-done-win32.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/getstarted-darwin.png b/playwright/specs/onboarding.spec.ts-snapshots/getstarted-darwin.png new file mode 100644 index 0000000000..64e10d1130 Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/getstarted-darwin.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/getstarted-linux.png b/playwright/specs/onboarding.spec.ts-snapshots/getstarted-linux.png new file mode 100644 index 0000000000..869c5351b4 Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/getstarted-linux.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/getstarted-win32.png b/playwright/specs/onboarding.spec.ts-snapshots/getstarted-win32.png new file mode 100644 index 0000000000..f551907d75 Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/getstarted-win32.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/onboarding-complete-darwin.png b/playwright/specs/onboarding.spec.ts-snapshots/onboarding-complete-darwin.png new file mode 100644 index 0000000000..dd23311fac Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/onboarding-complete-darwin.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/onboarding-complete-linux.png b/playwright/specs/onboarding.spec.ts-snapshots/onboarding-complete-linux.png new file mode 100644 index 0000000000..a121dc9961 Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/onboarding-complete-linux.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/onboarding-complete-win32.png b/playwright/specs/onboarding.spec.ts-snapshots/onboarding-complete-win32.png new file mode 100644 index 0000000000..a394edd61c Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/onboarding-complete-win32.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/onboarding-nanox-darwin.png b/playwright/specs/onboarding.spec.ts-snapshots/onboarding-nanox-darwin.png new file mode 100644 index 0000000000..63c11def03 Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/onboarding-nanox-darwin.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/onboarding-nanox-linux.png b/playwright/specs/onboarding.spec.ts-snapshots/onboarding-nanox-linux.png new file mode 100644 index 0000000000..637ef45309 Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/onboarding-nanox-linux.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/onboarding-nanox-win32.png b/playwright/specs/onboarding.spec.ts-snapshots/onboarding-nanox-win32.png new file mode 100644 index 0000000000..e1c6f3443e Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/onboarding-nanox-win32.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/terms-darwin.png b/playwright/specs/onboarding.spec.ts-snapshots/terms-darwin.png new file mode 100644 index 0000000000..ca366312af Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/terms-darwin.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/terms-linux.png b/playwright/specs/onboarding.spec.ts-snapshots/terms-linux.png new file mode 100644 index 0000000000..844d4b3140 Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/terms-linux.png differ diff --git a/playwright/specs/onboarding.spec.ts-snapshots/terms-win32.png b/playwright/specs/onboarding.spec.ts-snapshots/terms-win32.png new file mode 100644 index 0000000000..88f04196d4 Binary files /dev/null and b/playwright/specs/onboarding.spec.ts-snapshots/terms-win32.png differ diff --git a/playwright/specs/passwordlock.spec.ts b/playwright/specs/passwordlock.spec.ts new file mode 100644 index 0000000000..b3e635502f --- /dev/null +++ b/playwright/specs/passwordlock.spec.ts @@ -0,0 +1,103 @@ +import test from "../fixtures/common"; +import { expect } from "@playwright/test"; +import { Layout } from "../models/Layout"; +import { Modal } from "../models/Modal"; +import { SettingsPage } from "../models/SettingsPage"; +import { PasswordlockModal } from "../models/PasswordlockModal"; +import { LockscreenPage } from "../models/LockscreenPage"; +import * as fs from "fs"; + +test.use({ userdata: "skip-onboarding" }); + +test("Enable password lock", async ({ page, userdataFile }) => { + const layout = new Layout(page); + const modal = new Modal(page); + const settingsPage = new SettingsPage(page); + const passwordlockModal = new PasswordlockModal(page); + const lockscreenPage = new LockscreenPage(page); + + function getUserdata() { + const jsonFile = fs.readFileSync(userdataFile, "utf-8"); + return JSON.parse(jsonFile); + } + + await test.step("Open password lock modal", async () => { + await settingsPage.goToSettings(); + await passwordlockModal.toggle(); + expect(await passwordlockModal.container.screenshot()).toMatchSnapshot( + "set-passwordlock-modal.png", + ); + }); + + await test.step("Enable password lock", async () => { + await passwordlockModal.enablePassword("password", "password"); + expect(await layout.topbarLockButton).toBeVisible(); + expect(await page.screenshot()).toMatchSnapshot("passwordlock-enabled.png"); + }); + + await test.step("User data should be encrypted", async () => { + expect(typeof getUserdata().data.accounts).toBe("string"); + }); + + await test.step("Open change password modal", async () => { + await passwordlockModal.openChangePasswordModal(); + expect(await passwordlockModal.container.screenshot()).toMatchSnapshot( + "changepassword-modal.png", + ); + }); + + await test.step("Change password", async () => { + await passwordlockModal.changePassword("password", "newpassword", "newpassword"); + expect(await layout.topbarLockButton).toBeVisible(); + }); + await test.step("Lock app", async () => { + await layout.lockApp(); + expect(await lockscreenPage.container).toBeVisible(); + expect(await lockscreenPage.logo).toBeVisible(); + expect(await page.screenshot()).toMatchSnapshot("app-locked.png"); + }); + + await test.step("I lost my password", async () => { + await lockscreenPage.lostPassword(); + expect(await modal.container.screenshot()).toMatchSnapshot("lockscreen-reset-app-modal.png"); + await modal.cancel(); + }); + + await test.step("Unlock with wrong password", async () => { + await lockscreenPage.login("wrong"); + expect(await layout.inputError).toBeVisible(); + await page.waitForTimeout(400); // weird 0.4s css transition on error message + expect(await page.screenshot()).toMatchSnapshot("lockscreen-wrong-password.png"); + }); + + await test.step("Unlock with correct password", async () => { + await lockscreenPage.login("newpassword"); + expect(await lockscreenPage.container).toBeHidden(); + expect(await page.screenshot()).toMatchSnapshot("lockscreen-unlocked.png"); + expect(await layout.topbarLockButton).toBeVisible(); + }); + + await test.step("Open disable password lock modal", async () => { + await passwordlockModal.toggle(); + expect(await modal.container.screenshot()).toMatchSnapshot("disablepassword-modal.png"); + }); + + await test.step("Disable password lock: Set wrong password", async () => { + await passwordlockModal.disablePassword("password"); + expect(await layout.inputError).toBeVisible(); + expect(await layout.topbarLockButton).toBeVisible(); + expect(await modal.container.screenshot()).toMatchSnapshot( + "passwordlock-disable-bad-password.png", + ); + }); + + await test.step("Disable password lock: Set correct password", async () => { + await passwordlockModal.disablePassword("newpassword"); + expect(await layout.topbarLockButton).toBeHidden(); + expect(await page.screenshot()).toMatchSnapshot("passwordlock-disabled.png"); + }); + + await test.step("User data shouldn't be encrypted", async () => { + expect(typeof getUserdata().data.accounts).toBe("object"); + }); +}); diff --git a/playwright/specs/passwordlock.spec.ts-snapshots/app-locked-linux.png b/playwright/specs/passwordlock.spec.ts-snapshots/app-locked-linux.png new file mode 100644 index 0000000000..93da40537a Binary files /dev/null and b/playwright/specs/passwordlock.spec.ts-snapshots/app-locked-linux.png differ diff --git a/playwright/specs/passwordlock.spec.ts-snapshots/app-locked-win32.png b/playwright/specs/passwordlock.spec.ts-snapshots/app-locked-win32.png new file mode 100644 index 0000000000..6679b210c7 Binary files /dev/null and b/playwright/specs/passwordlock.spec.ts-snapshots/app-locked-win32.png differ diff --git a/playwright/specs/passwordlock.spec.ts-snapshots/changepassword-modal-linux.png b/playwright/specs/passwordlock.spec.ts-snapshots/changepassword-modal-linux.png new file mode 100644 index 0000000000..49decde779 Binary files /dev/null and b/playwright/specs/passwordlock.spec.ts-snapshots/changepassword-modal-linux.png differ diff --git a/playwright/specs/passwordlock.spec.ts-snapshots/changepassword-modal-win32.png b/playwright/specs/passwordlock.spec.ts-snapshots/changepassword-modal-win32.png new file mode 100644 index 0000000000..0aeee7f3a2 Binary files /dev/null and b/playwright/specs/passwordlock.spec.ts-snapshots/changepassword-modal-win32.png differ diff --git a/playwright/specs/passwordlock.spec.ts-snapshots/disablepassword-modal-linux.png b/playwright/specs/passwordlock.spec.ts-snapshots/disablepassword-modal-linux.png new file mode 100644 index 0000000000..1bb3f6fd72 Binary files /dev/null and b/playwright/specs/passwordlock.spec.ts-snapshots/disablepassword-modal-linux.png differ diff --git a/playwright/specs/passwordlock.spec.ts-snapshots/disablepassword-modal-win32.png b/playwright/specs/passwordlock.spec.ts-snapshots/disablepassword-modal-win32.png new file mode 100644 index 0000000000..9c26b0f506 Binary files /dev/null and b/playwright/specs/passwordlock.spec.ts-snapshots/disablepassword-modal-win32.png differ diff --git a/playwright/specs/passwordlock.spec.ts-snapshots/lockscreen-reset-app-modal-linux.png b/playwright/specs/passwordlock.spec.ts-snapshots/lockscreen-reset-app-modal-linux.png new file mode 100644 index 0000000000..3fa41328c8 Binary files /dev/null and b/playwright/specs/passwordlock.spec.ts-snapshots/lockscreen-reset-app-modal-linux.png differ diff --git a/playwright/specs/passwordlock.spec.ts-snapshots/lockscreen-reset-app-modal-win32.png b/playwright/specs/passwordlock.spec.ts-snapshots/lockscreen-reset-app-modal-win32.png new file mode 100644 index 0000000000..6380cb00aa Binary files /dev/null and b/playwright/specs/passwordlock.spec.ts-snapshots/lockscreen-reset-app-modal-win32.png differ diff --git a/playwright/specs/passwordlock.spec.ts-snapshots/lockscreen-unlocked-linux.png b/playwright/specs/passwordlock.spec.ts-snapshots/lockscreen-unlocked-linux.png new file mode 100644 index 0000000000..bfcd7887a8 Binary files /dev/null and b/playwright/specs/passwordlock.spec.ts-snapshots/lockscreen-unlocked-linux.png differ diff --git a/playwright/specs/passwordlock.spec.ts-snapshots/lockscreen-unlocked-win32.png b/playwright/specs/passwordlock.spec.ts-snapshots/lockscreen-unlocked-win32.png new file mode 100644 index 0000000000..b82cf2e3c6 Binary files /dev/null and b/playwright/specs/passwordlock.spec.ts-snapshots/lockscreen-unlocked-win32.png differ diff --git a/playwright/specs/passwordlock.spec.ts-snapshots/lockscreen-wrong-password-linux.png b/playwright/specs/passwordlock.spec.ts-snapshots/lockscreen-wrong-password-linux.png new file mode 100644 index 0000000000..62c5dbae14 Binary files /dev/null and b/playwright/specs/passwordlock.spec.ts-snapshots/lockscreen-wrong-password-linux.png differ diff --git a/playwright/specs/passwordlock.spec.ts-snapshots/lockscreen-wrong-password-win32.png b/playwright/specs/passwordlock.spec.ts-snapshots/lockscreen-wrong-password-win32.png new file mode 100644 index 0000000000..edc8c75ed6 Binary files /dev/null and b/playwright/specs/passwordlock.spec.ts-snapshots/lockscreen-wrong-password-win32.png differ diff --git a/playwright/specs/passwordlock.spec.ts-snapshots/passwordlock-disable-bad-password-linux.png b/playwright/specs/passwordlock.spec.ts-snapshots/passwordlock-disable-bad-password-linux.png new file mode 100644 index 0000000000..421a360394 Binary files /dev/null and b/playwright/specs/passwordlock.spec.ts-snapshots/passwordlock-disable-bad-password-linux.png differ diff --git a/playwright/specs/passwordlock.spec.ts-snapshots/passwordlock-disable-bad-password-win32.png b/playwright/specs/passwordlock.spec.ts-snapshots/passwordlock-disable-bad-password-win32.png new file mode 100644 index 0000000000..16dfa2e044 Binary files /dev/null and b/playwright/specs/passwordlock.spec.ts-snapshots/passwordlock-disable-bad-password-win32.png differ diff --git a/playwright/specs/passwordlock.spec.ts-snapshots/passwordlock-disabled-linux.png b/playwright/specs/passwordlock.spec.ts-snapshots/passwordlock-disabled-linux.png new file mode 100644 index 0000000000..a2c432f9c0 Binary files /dev/null and b/playwright/specs/passwordlock.spec.ts-snapshots/passwordlock-disabled-linux.png differ diff --git a/playwright/specs/passwordlock.spec.ts-snapshots/passwordlock-disabled-win32.png b/playwright/specs/passwordlock.spec.ts-snapshots/passwordlock-disabled-win32.png new file mode 100644 index 0000000000..f9920539d2 Binary files /dev/null and b/playwright/specs/passwordlock.spec.ts-snapshots/passwordlock-disabled-win32.png differ diff --git a/playwright/specs/passwordlock.spec.ts-snapshots/passwordlock-enabled-linux.png b/playwright/specs/passwordlock.spec.ts-snapshots/passwordlock-enabled-linux.png new file mode 100644 index 0000000000..bfcd7887a8 Binary files /dev/null and b/playwright/specs/passwordlock.spec.ts-snapshots/passwordlock-enabled-linux.png differ diff --git a/playwright/specs/passwordlock.spec.ts-snapshots/passwordlock-enabled-win32.png b/playwright/specs/passwordlock.spec.ts-snapshots/passwordlock-enabled-win32.png new file mode 100644 index 0000000000..b82cf2e3c6 Binary files /dev/null and b/playwright/specs/passwordlock.spec.ts-snapshots/passwordlock-enabled-win32.png differ diff --git a/playwright/specs/passwordlock.spec.ts-snapshots/set-passwordlock-modal-linux.png b/playwright/specs/passwordlock.spec.ts-snapshots/set-passwordlock-modal-linux.png new file mode 100644 index 0000000000..5dca4297b8 Binary files /dev/null and b/playwright/specs/passwordlock.spec.ts-snapshots/set-passwordlock-modal-linux.png differ diff --git a/playwright/specs/passwordlock.spec.ts-snapshots/set-passwordlock-modal-win32.png b/playwright/specs/passwordlock.spec.ts-snapshots/set-passwordlock-modal-win32.png new file mode 100644 index 0000000000..262a8670e0 Binary files /dev/null and b/playwright/specs/passwordlock.spec.ts-snapshots/set-passwordlock-modal-win32.png differ diff --git a/playwright/specs/recorder.spec.ts b/playwright/specs/recorder.spec.ts new file mode 100644 index 0000000000..0649d97187 --- /dev/null +++ b/playwright/specs/recorder.spec.ts @@ -0,0 +1,23 @@ +/* eslint-disable jest/valid-expect */ +/* eslint-disable jest/no-standalone-expect */ +/* eslint-disable jest/no-done-callback */ +/* eslint-disable jest/expect-expect */ +import test from "../fixtures/common"; +// import { expect } from "@playwright/test"; +// import { DeviceAction } from "../models/DeviceAction"; + +// Comment out to disable recorder +process.env.PWDEBUG = "1"; + +// Use specific userdata +test.use({ userdata: "skip-onboarding" }); + +// app env +test.use({ env: { DEV_TOOLS: true, HIDE_DEBUG_MOCK: undefined } }); + +test("My test", async ({ page }) => { + test.setTimeout(6000000); + // const deviceAction = new DeviceAction(page); + + await page.pause(); +}); diff --git a/playwright/specs/settings.spec.ts b/playwright/specs/settings.spec.ts new file mode 100644 index 0000000000..4e1ee48147 --- /dev/null +++ b/playwright/specs/settings.spec.ts @@ -0,0 +1,34 @@ +import test from "../fixtures/common"; +import { expect } from "@playwright/test"; +import { SettingsPage } from "../models/SettingsPage"; + +test.use({ userdata: "skip-onboarding" }); + +test("Settings", async ({ page }) => { + const settingsPage = new SettingsPage(page); + + await test.step("go to settings", async () => { + await settingsPage.goToSettings(); + expect(await page.screenshot()).toMatchSnapshot("settings-general-page.png"); + }); + + await test.step("go to settings -> accounts", async () => { + await settingsPage.goToAccountsTab(); + expect(await page.screenshot()).toMatchSnapshot("settings-accounts-page.png"); + }); + + await test.step("go to settings -> about", async () => { + await settingsPage.goToAboutTab(); + expect(await page.screenshot()).toMatchSnapshot("settings-about-page.png"); + }); + + await test.step("go to settings -> help", async () => { + await settingsPage.goToHelpTab(); + expect(await page.screenshot()).toMatchSnapshot("settings-help-page.png"); + }); + + await test.step("go to settings -> experimental", async () => { + await settingsPage.goToExperimentalTab(); + expect(await page.screenshot()).toMatchSnapshot("settings-experimental-page.png"); + }); +}); diff --git a/playwright/specs/settings.spec.ts-snapshots/settings-about-page-linux.png b/playwright/specs/settings.spec.ts-snapshots/settings-about-page-linux.png new file mode 100644 index 0000000000..dc960d9ce2 Binary files /dev/null and b/playwright/specs/settings.spec.ts-snapshots/settings-about-page-linux.png differ diff --git a/playwright/specs/settings.spec.ts-snapshots/settings-about-page-win32.png b/playwright/specs/settings.spec.ts-snapshots/settings-about-page-win32.png new file mode 100644 index 0000000000..f27e3bffc4 Binary files /dev/null and b/playwright/specs/settings.spec.ts-snapshots/settings-about-page-win32.png differ diff --git a/playwright/specs/settings.spec.ts-snapshots/settings-accounts-page-linux.png b/playwright/specs/settings.spec.ts-snapshots/settings-accounts-page-linux.png new file mode 100644 index 0000000000..ad468eba48 Binary files /dev/null and b/playwright/specs/settings.spec.ts-snapshots/settings-accounts-page-linux.png differ diff --git a/playwright/specs/settings.spec.ts-snapshots/settings-accounts-page-win32.png b/playwright/specs/settings.spec.ts-snapshots/settings-accounts-page-win32.png new file mode 100644 index 0000000000..9619e5e921 Binary files /dev/null and b/playwright/specs/settings.spec.ts-snapshots/settings-accounts-page-win32.png differ diff --git a/playwright/specs/settings.spec.ts-snapshots/settings-experimental-page-linux.png b/playwright/specs/settings.spec.ts-snapshots/settings-experimental-page-linux.png new file mode 100644 index 0000000000..24fcf0488c Binary files /dev/null and b/playwright/specs/settings.spec.ts-snapshots/settings-experimental-page-linux.png differ diff --git a/playwright/specs/settings.spec.ts-snapshots/settings-experimental-page-win32.png b/playwright/specs/settings.spec.ts-snapshots/settings-experimental-page-win32.png new file mode 100644 index 0000000000..3e8b886b00 Binary files /dev/null and b/playwright/specs/settings.spec.ts-snapshots/settings-experimental-page-win32.png differ diff --git a/playwright/specs/settings.spec.ts-snapshots/settings-general-page-linux.png b/playwright/specs/settings.spec.ts-snapshots/settings-general-page-linux.png new file mode 100644 index 0000000000..71a8f4c368 Binary files /dev/null and b/playwright/specs/settings.spec.ts-snapshots/settings-general-page-linux.png differ diff --git a/playwright/specs/settings.spec.ts-snapshots/settings-general-page-win32.png b/playwright/specs/settings.spec.ts-snapshots/settings-general-page-win32.png new file mode 100644 index 0000000000..de198ad32e Binary files /dev/null and b/playwright/specs/settings.spec.ts-snapshots/settings-general-page-win32.png differ diff --git a/playwright/specs/settings.spec.ts-snapshots/settings-help-page-linux.png b/playwright/specs/settings.spec.ts-snapshots/settings-help-page-linux.png new file mode 100644 index 0000000000..f2587c52d9 Binary files /dev/null and b/playwright/specs/settings.spec.ts-snapshots/settings-help-page-linux.png differ diff --git a/playwright/specs/settings.spec.ts-snapshots/settings-help-page-win32.png b/playwright/specs/settings.spec.ts-snapshots/settings-help-page-win32.png new file mode 100644 index 0000000000..4898f75031 Binary files /dev/null and b/playwright/specs/settings.spec.ts-snapshots/settings-help-page-win32.png differ diff --git a/playwright/userdata/skip-onboarding.json b/playwright/userdata/skip-onboarding.json new file mode 100644 index 0000000000..e8f49f3e39 --- /dev/null +++ b/playwright/userdata/skip-onboarding.json @@ -0,0 +1,52 @@ +{ + "data": { + "SPECTRON_RUN": { + "localStorage": { + "acceptedTermsVersion": "2019-12-04" + } + }, + "settings": { + "hasCompletedOnboarding": true, + "counterValue": "USD", + "language": "en", + "theme": "light", + "region": null, + "orderAccounts": "balance|desc", + "countervalueFirst": false, + "autoLockTimeout": 10, + "selectedTimeRange": "month", + "marketIndicator": "western", + "currenciesSettings": {}, + "pairExchanges": {}, + "developerMode": false, + "loaded": true, + "shareAnalytics": true, + "sentryLogs": true, + "lastUsedVersion": "99.99.99", + "dismissedBanners": [], + "accountsViewMode": "list", + "showAccountsHelperBanner": true, + "hideEmptyTokenAccounts": false, + "sidebarCollapsed": false, + "discreetMode": false, + "preferredDeviceModel": "nanoS", + "hasInstalledApps": true, + "carouselVisibility": 0, + "hasAcceptedSwapKYC": false, + "lastSeenDevice": null, + "blacklistedTokenIds": [], + "swapAcceptedProviderIds": [], + "deepLinkUrl": null, + "firstTimeLend": false, + "swapProviders": [], + "showClearCacheBanner": false, + "starredAccountIds": [], + "hasPassword": false + }, + "user": { + "id": "08cf3393-c5eb-4ea7-92de-0deea22e3971" + }, + "accounts": [], + "countervalues": {} + } +} \ No newline at end of file diff --git a/playwright/utils/global-setup.ts b/playwright/utils/global-setup.ts new file mode 100644 index 0000000000..c50a91f7c0 --- /dev/null +++ b/playwright/utils/global-setup.ts @@ -0,0 +1,3 @@ +import { FullConfig } from "@playwright/test"; + +export default async function globalSetup(config: FullConfig) {} diff --git a/playwright/utils/global-teardown.ts b/playwright/utils/global-teardown.ts new file mode 100644 index 0000000000..92e0f6e88b --- /dev/null +++ b/playwright/utils/global-teardown.ts @@ -0,0 +1 @@ +export default async function globalTeardown() {} diff --git a/src/renderer/components/BalanceInfos/index.js b/src/renderer/components/BalanceInfos/index.js index af68483ee4..309ee1970a 100644 --- a/src/renderer/components/BalanceInfos/index.js +++ b/src/renderer/components/BalanceInfos/index.js @@ -87,6 +87,7 @@ export function BalanceTotal({ disableRounding showCode val={totalBalance} + data-test-id="total-balance" /> )} {withTransactionsPendingConfirmationWarning ? ( diff --git a/src/renderer/components/InputPassword.js b/src/renderer/components/InputPassword.js index dc44310f99..b63b8cdf2a 100644 --- a/src/renderer/components/InputPassword.js +++ b/src/renderer/components/InputPassword.js @@ -103,11 +103,7 @@ class InputPassword extends PureComponent { type={inputType} onChange={this.handleChange} renderRight={ - + {inputType === "password" ? : } } diff --git a/src/renderer/components/IsUnlocked.js b/src/renderer/components/IsUnlocked.js index 99a03f19b1..c0dac09bb8 100644 --- a/src/renderer/components/IsUnlocked.js +++ b/src/renderer/components/IsUnlocked.js @@ -102,7 +102,7 @@ export default function IsUnlocked({ children }: { children: any }) { if (isLocked) { return ( - +
@@ -135,7 +135,7 @@ export default function IsUnlocked({ children }: { children: any }) { primary flow={1} style={{ width: 46, height: 46, padding: 0, justifyContent: "center" }} - id="lockscreen-login-button" + data-test-id="lockscreen-login-button" > @@ -148,7 +148,7 @@ export default function IsUnlocked({ children }: { children: any }) { mt={3} small onClick={handleOpenHardResetModal} - id="lockscreen-forgotten-button" + data-test-id="lockscreen-forgotten-button" > {t("common.lockScreen.lostPassword")} diff --git a/src/renderer/components/LedgerLiveLogo.js b/src/renderer/components/LedgerLiveLogo.js index d0bffcc17c..6fc9e05a37 100644 --- a/src/renderer/components/LedgerLiveLogo.js +++ b/src/renderer/components/LedgerLiveLogo.js @@ -12,7 +12,7 @@ class LedgerLiveLogo extends PureComponent { render() { const { icon, ...p } = this.props; return ( -