Skip to content

Commit

Permalink
test - 9
Browse files Browse the repository at this point in the history
  • Loading branch information
yasserfaraazkhan committed Dec 21, 2023
1 parent 06fd1a8 commit 3a81a12
Show file tree
Hide file tree
Showing 2 changed files with 153 additions and 145 deletions.
290 changes: 145 additions & 145 deletions .github/workflows/e2e-functional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,167 +108,167 @@ jobs:
npm run test:e2e || true # making job pass even if the tests fail due to flakyness
npm run test:e2e:send-report
e2e-macos:
if: |
(
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && github.ref == 'refs/heads/e2e_nightly') ||
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Run Desktop E2E Tests'))
)
runs-on: macos-13
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: Cache Electron Headers
uses: actions/cache@v2
with:
path: |
~/.electron
~/.cache/electron
key: electron-headers-${{ runner.os }}-${{ hashFiles('**/*.gyp') }}
# e2e-macos:
# if: |
# (
# github.event_name == 'workflow_dispatch' ||
# (github.event_name == 'push' && github.ref == 'refs/heads/e2e_nightly') ||
# (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Run Desktop E2E Tests'))
# )
# runs-on: macos-13
# steps:
# - name: ci/checkout-repo
# uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
# - name: ci/setup-node
# uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
# with:
# node-version-file: "package.json"
# cache: "npm"
# cache-dependency-path: package-lock.json
# - name: Cache Electron Headers
# uses: actions/cache@v2
# with:
# path: |
# ~/.electron
# ~/.cache/electron
# key: electron-headers-${{ runner.os }}-${{ hashFiles('**/*.gyp') }}

- name: Setup Go environment
uses: actions/setup-go@v4.0.1
with:
go-version: '1.20'
# - name: Setup Go environment
# uses: actions/setup-go@v4.0.1
# with:
# go-version: '1.20'

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x
# - name: Set up Python
# uses: actions/setup-python@v2
# with:
# python-version: 3.x

- name: ci/install-dependencies
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
jq '.mac.target=["zip"]' electron-builder.json | jq '.mac.gatekeeperAssess=false' > /tmp/electron-builder.json && cp /tmp/electron-builder.json .
npm install
npm install -g node-gyp
npm i robotjs
npm i -D electron-rebuild
npx electron-rebuild -f -t prod,optional,dev -w robotjs
# - name: ci/install-dependencies
# env:
# PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
# run: |
# jq '.mac.target=["zip"]' electron-builder.json | jq '.mac.gatekeeperAssess=false' > /tmp/electron-builder.json && cp /tmp/electron-builder.json .
# npm install
# npm install -g node-gyp
# npm i robotjs
# npm i -D electron-rebuild
# npx electron-rebuild -f -t prod,optional,dev -w robotjs

- name: Set Environment Variables
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
echo "BUILD_SUFFIX=desktop-pr" >> $GITHUB_ENV
# - name: Set Environment Variables
# run: |
# if [ "${{ github.event_name }}" == "pull_request" ]; then
# echo "BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
# echo "BUILD_SUFFIX=desktop-pr" >> $GITHUB_ENV

elif [ "${{ github.event_name }}" == "release" ]; then
echo "BRANCH=${{ github.ref }}" >> $GITHUB_ENV
echo "BUILD_SUFFIX=desktop-release" >> $GITHUB_ENV
echo "TYPE=RELEASE" >> $GITHUB_ENV
echo "ZEPHYR_ENABLE=true" >> $GITHUB_ENV
# elif [ "${{ github.event_name }}" == "release" ]; then
# echo "BRANCH=${{ github.ref }}" >> $GITHUB_ENV
# echo "BUILD_SUFFIX=desktop-release" >> $GITHUB_ENV
# echo "TYPE=RELEASE" >> $GITHUB_ENV
# echo "ZEPHYR_ENABLE=true" >> $GITHUB_ENV

elif [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == "refs/heads/e2e_nightly" ]; then
echo "BRANCH=${{ github.ref }}" >> $GITHUB_ENV
echo "TYPE=MASTER" >> $GITHUB_ENV
echo "BUILD_SUFFIX=desktop-master-push" >> $GITHUB_ENV
echo "ZEPHYR_ENABLE=true" >> $GITHUB_ENV
# elif [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == "refs/heads/e2e_nightly" ]; then
# echo "BRANCH=${{ github.ref }}" >> $GITHUB_ENV
# echo "TYPE=MASTER" >> $GITHUB_ENV
# echo "BUILD_SUFFIX=desktop-master-push" >> $GITHUB_ENV
# echo "ZEPHYR_ENABLE=true" >> $GITHUB_ENV

elif [ "${{ github.event_name }}" == "schedule" ]; then
echo "BRANCH=${{ github.ref }}" >> $GITHUB_ENV
echo "BUILD_SUFFIX=desktop-nightly" >> $GITHUB_ENV
fi
# elif [ "${{ github.event_name }}" == "schedule" ]; then
# echo "BRANCH=${{ github.ref }}" >> $GITHUB_ENV
# echo "BUILD_SUFFIX=desktop-nightly" >> $GITHUB_ENV
# fi

echo "BUILD_ID=${{ github.run_id }}-${BUILD_SUFFIX}-${{ runner.os }}" >> $GITHUB_ENV
echo "BUILD_TAG=${GITHUB_SHA::7}" >> $GITHUB_ENV
echo "PULL_REQUEST=${PULL_REQUEST_BASE_URL}${{ github.event.pull_request.number }}" >> $GITHUB_ENV
# echo "BUILD_ID=${{ github.run_id }}-${BUILD_SUFFIX}-${{ runner.os }}" >> $GITHUB_ENV
# echo "BUILD_TAG=${GITHUB_SHA::7}" >> $GITHUB_ENV
# echo "PULL_REQUEST=${PULL_REQUEST_BASE_URL}${{ github.event.pull_request.number }}" >> $GITHUB_ENV

- name: Run Playwright tests (macOS)
run: |
npm run test:e2e || true # making job pass even if the tests fail due to flakyness
npm run test:e2e:send-report
# - name: Run Playwright tests (macOS)
# run: |
# npm run test:e2e || true # making job pass even if the tests fail due to flakyness
# npm run test:e2e:send-report

e2e-windows:
if: |
(
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && github.ref == 'refs/heads/e2e_nightly') ||
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Run Desktop E2E Tests'))
)
runs-on: windows-2022
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
# e2e-windows:
# if: |
# (
# github.event_name == 'workflow_dispatch' ||
# (github.event_name == 'push' && github.ref == 'refs/heads/e2e_nightly') ||
# (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Run Desktop E2E Tests'))
# )
# runs-on: windows-2022
# steps:
# - name: ci/checkout-repo
# uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
# - name: ci/setup-node
# uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
# with:
# node-version-file: "package.json"
# cache: "npm"
# cache-dependency-path: package-lock.json

- name: ci/cache-node-modules
id: cache-node-modules
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
with:
path: node_modules
key: ${{ runner.os }}-build-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-node-modules
${{ runner.os }}-build-
${{ runner.os }}-
# - name: ci/cache-node-modules
# id: cache-node-modules
# uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
# with:
# path: node_modules
# key: ${{ runner.os }}-build-node-modules-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-build-node-modules
# ${{ runner.os }}-build-
# ${{ runner.os }}-

- name: ci/install-node-gyp
if: steps.cache-node-modules.outputs.cache-hit != 'true'
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
choco install yq --version 4.15.1 -y
npm i -g node-gyp
node-gyp install
node-gyp install --devdir="C:\Users\runneradmin\.electron-gyp" --target=$(jq -r .devDependencies.electron package.json) --dist-url="https://electronjs.org/headers"
node-gyp install --devdir="C:\Users\runneradmin\.electron-gyp" --target=$(jq -r .devDependencies.electron package.json) --dist-url="https://electronjs.org/headers" --arch arm64
node-gyp install --devdir="C:\Users\runneradmin\.electron-gyp" --target=$(jq -r .devDependencies.electron package.json) --dist-url="https://electronjs.org/headers" --arch ia32
npm ci --openssl_fips=''
# - name: ci/install-node-gyp
# if: steps.cache-node-modules.outputs.cache-hit != 'true'
# env:
# PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
# run: |
# choco install yq --version 4.15.1 -y
# npm i -g node-gyp
# node-gyp install
# node-gyp install --devdir="C:\Users\runneradmin\.electron-gyp" --target=$(jq -r .devDependencies.electron package.json) --dist-url="https://electronjs.org/headers"
# node-gyp install --devdir="C:\Users\runneradmin\.electron-gyp" --target=$(jq -r .devDependencies.electron package.json) --dist-url="https://electronjs.org/headers" --arch arm64
# node-gyp install --devdir="C:\Users\runneradmin\.electron-gyp" --target=$(jq -r .devDependencies.electron package.json) --dist-url="https://electronjs.org/headers" --arch ia32
# npm ci --openssl_fips=''

- name: Set Environment Variables
shell: bash
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
echo "BUILD_SUFFIX=desktop-pr" >> $GITHUB_ENV
# - name: Set Environment Variables
# shell: bash
# run: |
# if [ "${{ github.event_name }}" == "pull_request" ]; then
# echo "BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
# echo "BUILD_SUFFIX=desktop-pr" >> $GITHUB_ENV

elif [ "${{ github.event_name }}" == "release" ]; then
echo "BRANCH=${{ github.ref }}" >> $GITHUB_ENV
echo "BUILD_SUFFIX=desktop-release" >> $GITHUB_ENV
echo "TYPE=RELEASE" >> $GITHUB_ENV
echo "ZEPHYR_ENABLE=true" >> $GITHUB_ENV
# elif [ "${{ github.event_name }}" == "release" ]; then
# echo "BRANCH=${{ github.ref }}" >> $GITHUB_ENV
# echo "BUILD_SUFFIX=desktop-release" >> $GITHUB_ENV
# echo "TYPE=RELEASE" >> $GITHUB_ENV
# echo "ZEPHYR_ENABLE=true" >> $GITHUB_ENV

elif [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == "refs/heads/e2e_nightly" ]; then
echo "BRANCH=${{ github.ref }}" >> $GITHUB_ENV
echo "TYPE=MASTER" >> $GITHUB_ENV
echo "BUILD_SUFFIX=desktop-master-push" >> $GITHUB_ENV
echo "ZEPHYR_ENABLE=true" >> $GITHUB_ENV
# elif [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == "refs/heads/e2e_nightly" ]; then
# echo "BRANCH=${{ github.ref }}" >> $GITHUB_ENV
# echo "TYPE=MASTER" >> $GITHUB_ENV
# echo "BUILD_SUFFIX=desktop-master-push" >> $GITHUB_ENV
# echo "ZEPHYR_ENABLE=true" >> $GITHUB_ENV

elif [ "${{ github.event_name }}" == "schedule" ]; then
echo "BRANCH=${{ github.ref }}" >> $GITHUB_ENV
echo "BUILD_SUFFIX=desktop-nightly" >> $GITHUB_ENV
fi
# elif [ "${{ github.event_name }}" == "schedule" ]; then
# echo "BRANCH=${{ github.ref }}" >> $GITHUB_ENV
# echo "BUILD_SUFFIX=desktop-nightly" >> $GITHUB_ENV
# fi

echo "BUILD_ID=${{ github.run_id }}-${BUILD_SUFFIX}-${{ runner.os }}" >> $GITHUB_ENV
echo "BUILD_TAG=${GITHUB_SHA::7}" >> $GITHUB_ENV
echo "PULL_REQUEST=${PULL_REQUEST_BASE_URL}${{ github.event.pull_request.number }}" >> $GITHUB_ENV
# echo "BUILD_ID=${{ github.run_id }}-${BUILD_SUFFIX}-${{ runner.os }}" >> $GITHUB_ENV
# echo "BUILD_TAG=${GITHUB_SHA::7}" >> $GITHUB_ENV
# echo "PULL_REQUEST=${PULL_REQUEST_BASE_URL}${{ github.event.pull_request.number }}" >> $GITHUB_ENV

- name: Run Playwright tests (Windows OS)
run: |
npm run test:e2e || true
npm run test:e2e:send-report
shell: bash
# - name: Run Playwright tests (Windows OS)
# run: |
# npm run test:e2e || true
# npm run test:e2e:send-report
# shell: bash

e2e-remove-label:
if: ${{ github.event_name == 'pull_request' && github.event.label.name == 'Run Desktop E2E Tests' }}
needs: [e2e-linux, e2e-macos, e2e-windows]
runs-on: ubuntu-latest
steps:
- name: Remove "Run Desktop E2E Tests" label
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: |
Run Desktop E2E Tests
# e2e-remove-label:
# if: ${{ github.event_name == 'pull_request' && github.event.label.name == 'Run Desktop E2E Tests' }}
# needs: [e2e-linux, e2e-macos, e2e-windows]
# runs-on: ubuntu-latest
# steps:
# - name: Remove "Run Desktop E2E Tests" label
# uses: actions-ecosystem/action-remove-labels@v1
# with:
# labels: |
# Run Desktop E2E Tests
8 changes: 8 additions & 0 deletions e2e/save_report.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,15 @@ const saveReport = async () => {

// Send test report to "QA: UI Test Automation" channel via webhook
if (TYPE && TYPE !== 'NONE' && WEBHOOK_URL) {
console.log("*******************");
console.log(WEBHOOK_URL);
console.log("*******************");
console.log(testCycle);
console.log("*******************");
const data = generateTestReport(summary, result && result.success, result && result.reportLink, testCycle.key);
console.log("*******************");
console.log(data);
console.log("*******************");
await sendReport('summary report to Community channel', WEBHOOK_URL, data);
}

Expand Down

0 comments on commit 3a81a12

Please sign in to comment.