Skip to content

Commit

Permalink
split e2e serial (#797)
Browse files Browse the repository at this point in the history
Co-authored-by: Bruno Barbieri <[email protected]>
  • Loading branch information
derHowie and brunobar79 authored Jul 25, 2023
1 parent f092c94 commit 8079dc5
Show file tree
Hide file tree
Showing 16 changed files with 600 additions and 295 deletions.
50 changes: 50 additions & 0 deletions .github/actions/testSetup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: 'test setup'
description: 'runs test setup'
inputs:
gh-access-token:
description: 'Github Access Token'
required: true
runs:
using: 'composite'
steps:
- uses: actions/setup-node@v3
with:
node-version: "16.20.0"
cache: 'yarn'
- name: Download deps cache artifacts
uses: actions/download-artifact@v3
with:
name: node_modules.tar.gz
- name: Unzip node_modules
shell: 'bash'
run: tar xzvf node_modules.tar.gz
- name: Install latest chromedriver
shell: 'bash'
run: yarn upgrade chromedriver --latest --chromedriver_version=LATEST && yarn setup
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: rainbowbx-${{ github.sha }}.zip
path: build
- name: Setup xvfb
shell: 'bash'
run: |
sudo apt-get install -y xvfb libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0
# start xvfb in the background
sudo /usr/bin/Xvfb $DISPLAY -screen 0 1280x1024x24 &
- name: Install chrome
uses: browser-actions/setup-chrome@latest
with:
chrome-version: 'stable'
- name: Install Anvil
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- uses: actions/checkout@v3
with:
repository: 'rainbow-me/browser-extension-env'
token: ${{ inputs.gh-access-token }}
path: tmp
- name: Copy dotenv
shell: 'bash'
run: cat tmp/dotenv >> .env && rm -rf tmp
106 changes: 58 additions & 48 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,72 +68,82 @@ jobs:
name: rainbowbx-${{ github.sha }}.zip
path: build/
# CHROME TESTS
chrome-e2e:
runs-on: ubuntu-latest
timeout-minutes: 23
chrome-e2e-parallel:
runs-on: beefy-runner-bx
timeout-minutes: 16
needs: [build]
env:
DISPLAY: :0
VITEST_SEGFAULT_RETRY: 3
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16.20.0"
cache: 'yarn'
- name: Download deps cache artifacts
uses: actions/download-artifact@v3
- uses: ./.github/actions/testSetup
with:
name: node_modules.tar.gz
- name: Unzip node_modules
run: tar xzvf node_modules.tar.gz
- name: Install latest chromedriver
run: yarn upgrade chromedriver --latest --chromedriver_version=LATEST && yarn setup
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: rainbowbx-${{ github.sha }}.zip
path: build
- name: Setup xvfb
gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
- name: Run e2e parallel (Chrome)
run: |
sudo apt-get install -y xvfb libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0
# start xvfb in the background
sudo /usr/bin/Xvfb $DISPLAY -screen 0 1280x1024x24 &
- name: Install chrome
uses: browser-actions/setup-chrome@latest
with:
chrome-version: 'stable'
- name: Install Anvil
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
export BROWSER=chrome
export OS=linux
export CHROMIUM_BIN=$(which chrome)
yarn vitest:parallel --retry=5
chrome-e2e-swap:
runs-on: beefy-runner-bx
timeout-minutes: 25
needs: [build]
env:
DISPLAY: :0
VITEST_SEGFAULT_RETRY: 3
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/testSetup
with:
repository: 'rainbow-me/browser-extension-env'
token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
path: tmp
- name: Copy dotenv
run: cat tmp/dotenv >> .env && rm -rf tmp
- name: Run e2e parallel (Chrome)
gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
- name: Run e2e swap (Chrome)
uses: nick-fields/retry@v2
with:
timeout_minutes: 20
max_attempts: 3
command: |
timeout_minutes: 25
max_attempts: 2
command: |
export BROWSER=chrome
export OS=linux
export CHROMIUM_BIN=$(which chrome)
yarn vitest:parallel
- name: Run e2e serial (Chrome)
uses: nick-fields/retry@v2
yarn vitest:swap
chrome-e2e-send:
runs-on: beefy-runner-bx
timeout-minutes: 25
needs: [build]
env:
DISPLAY: :0
VITEST_SEGFAULT_RETRY: 3
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/testSetup
with:
timeout_minutes: 20
max_attempts: 3
command: |
gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
- name: Run e2e send (Chrome)
run: |
export BROWSER=chrome
export OS=linux
export CHROMIUM_BIN=$(which chrome)
yarn vitest:send --retry=5
chrome-e2e-dappInteractions:
runs-on: beefy-runner-bx
timeout-minutes: 25
needs: [build]
env:
DISPLAY: :0
VITEST_SEGFAULT_RETRY: 3
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/testSetup
with:
gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
- name: Run e2e dappInteractions (Chrome)
run: |
export BROWSER=chrome
export OS=linux
export CHROMIUM_BIN=$(which chrome)
yarn vitest:serial
yarn vitest:dappInteractions --retry=5
# BRAVE TESTS
# brave-e2e:
# needs: [build]
Expand Down Expand Up @@ -263,7 +273,7 @@ jobs:
run: yarn typecheck
cleanup:
runs-on: ubuntu-latest
needs: [chrome-e2e, unit-tests, ci-checks]
needs: [chrome-e2e-parallel, chrome-e2e-swap, chrome-e2e-send, chrome-e2e-dappInteractions, unit-tests, ci-checks]
steps:
- uses: geekyeggo/delete-artifact@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions e2e/parallel/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mergeConfig } from 'vite';
import { UserConfig, mergeConfig } from 'vite';
import { defineConfig } from 'vitest/config';

import viteConfig from '../vitest.config';
Expand All @@ -9,5 +9,5 @@ export default mergeConfig(
test: {
threads: false,
},
}),
}) as UserConfig,
);
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import {
switchWallet,
typeOnTextInput,
waitAndClick,
} from '../helpers';
import { TEST_VARIABLES } from '../walletVariables';
} from '../../helpers';
import { TEST_VARIABLES } from '../../walletVariables';

const TYPED_MESSAGE = {
domain: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import {
transactionStatus,
typeOnTextInput,
waitAndClick,
} from '../helpers';
import { TEST_VARIABLES } from '../walletVariables';
} from '../../helpers';
import { TEST_VARIABLES } from '../../walletVariables';

let rootURL = 'chrome-extension://';
let driver: WebDriver;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import {
querySelector,
typeOnTextInput,
waitAndClick,
} from '../helpers';
import { TEST_VARIABLES } from '../walletVariables';
} from '../../helpers';
import { TEST_VARIABLES } from '../../walletVariables';

let rootURL = 'chrome-extension://';
let driver: WebDriver;
Expand Down Expand Up @@ -190,7 +190,7 @@ it('should be able to select token on send flow', async () => {
});
// dai
await findElementByTestIdAndClick({
id: 'token-input-asset-0x6b175474e89094c44da98b954eedeac495271d0f_1',
id: 'token-input-asset-eth_1',
driver,
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import {
querySelector,
typeOnTextInput,
waitAndClick,
} from '../helpers';
import { convertRawAmountToDecimalFormat, subtract } from '../numbers';
import { SWAP_VARIABLES, TEST_VARIABLES } from '../walletVariables';
} from '../../helpers';
import { convertRawAmountToDecimalFormat, subtract } from '../../numbers';
import { SWAP_VARIABLES, TEST_VARIABLES } from '../../walletVariables';

let rootURL = 'chrome-extension://';
let driver: WebDriver;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import {
typeOnTextInput,
waitAndClick,
waitUntilElementByTestIdIsPresent,
} from '../helpers';
import { convertRawAmountToDecimalFormat, subtract } from '../numbers';
import { SWAP_VARIABLES, TEST_VARIABLES } from '../walletVariables';
} from '../../helpers';
import { convertRawAmountToDecimalFormat, subtract } from '../../numbers';
import { SWAP_VARIABLES, TEST_VARIABLES } from '../../walletVariables';

let rootURL = 'chrome-extension://';
let driver: WebDriver;
Expand Down
4 changes: 2 additions & 2 deletions e2e/serial/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mergeConfig } from 'vite';
import { UserConfig, mergeConfig } from 'vite';
import { defineConfig } from 'vitest/config';

import viteConfig from '../vitest.config';
Expand All @@ -20,5 +20,5 @@ export default mergeConfig(
},
},
},
}),
}) as UserConfig,
);
4 changes: 3 additions & 1 deletion e2e/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { UserConfig } from 'vitest';
import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
include: ['./**/**/*.test.ts'],
testTimeout: 90_000,
watch: false,
retry: 2,
},
});
}) as UserConfig;
36 changes: 18 additions & 18 deletions lavamoat/build-webpack/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@
},
"packages": {
"css-loader>postcss>nanoid": true,
"css-loader>postcss>picocolors": true,
"css-loader>postcss>source-map-js": true
"css-loader>postcss>source-map-js": true,
"vitest>picocolors": true
}
},
"css-loader>postcss-modules-local-by-default": {
Expand All @@ -397,16 +397,6 @@
"css-loader>icss-utils": true
}
},
"css-loader>postcss>picocolors": {
"builtin": {
"tty.isatty": true
},
"globals": {
"process.argv.includes": true,
"process.env": true,
"process.platform": true
}
},
"dotenv-webpack": {
"builtin": {
"fs": true
Expand Down Expand Up @@ -1344,6 +1334,11 @@
"jest>@jest/core>jest-runner>source-map-support": true
}
},
"vitest>acorn-walk": {
"globals": {
"define": true
}
},
"vitest>debug": {
"builtin": {
"tty.isatty": true,
Expand All @@ -1363,6 +1358,16 @@
"vitest>debug>ms": true
}
},
"vitest>picocolors": {
"builtin": {
"tty.isatty": true
},
"globals": {
"process.argv.includes": true,
"process.env": true,
"process.platform": true
}
},
"vitest>vite>terser": {
"globals": {
"Buffer.from": true,
Expand Down Expand Up @@ -1522,7 +1527,7 @@
"packages": {
"eslint>chalk": true,
"lodash": true,
"webpack-bundle-analyzer>acorn-walk": true,
"vitest>acorn-walk": true,
"webpack-bundle-analyzer>gzip-size": true,
"webpack-bundle-analyzer>opener": true,
"webpack-bundle-analyzer>sirv": true,
Expand All @@ -1531,11 +1536,6 @@
"webpack>acorn": true
}
},
"webpack-bundle-analyzer>acorn-walk": {
"globals": {
"define": true
}
},
"webpack-bundle-analyzer>gzip-size": {
"builtin": {
"fs.createReadStream": true,
Expand Down
Loading

0 comments on commit 8079dc5

Please sign in to comment.