Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qa update version test #2157

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,20 @@ workflows:
- tag: default
- abi: x86_64
- profile: pixel_4
_install-old-android-version:
steps:
- script-runner@0:
title: Update Android Test
is_always_run: true
inputs:
- file_path: e2e/tests/updateAppVersion/loginWithOlderVersion.sh
_install-latest-android-version:
steps:
- script-runner@0:
title: Update Android Test
is_always_run: true
inputs:
- file_path: e2e/tests/updateAppVersion/updateToLatestVersion.sh
_pull_app_files:
steps:
- pull-intermediate-files@1:
Expand Down Expand Up @@ -777,6 +791,8 @@ workflows:
- _pull_external_app_files
after_run:
- _run_android_detox_tests
- _install-old-android-version
- _install-latest-android-version
- _upload-detox-artifacts
- _send-test-result-notification-slack
envs:
Expand Down
20 changes: 20 additions & 0 deletions packages/core-mobile/detox.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ module.exports = {
'android/app/build/outputs/apk/internal/e2e/app-internal-e2e.apk',
testBinaryPath:
'android/app/build/outputs/apk/androidTest/internal/debug/app-internal-e2e-androidTest.apk'
},
'android.external.e2e.old_version': {
type: 'android.apk',
binaryPath:
'./e2e/tests/updateAppVersion/oldVersionApk/app-external-e2e-bitrise-signed.apk',
testBinaryPath:
'./e2e/tests/updateAppVersion/oldVersionApk/app-external-e2e-androidTest-bitrise-signed.apk'
}
},
artifacts: {
Expand Down Expand Up @@ -498,6 +505,19 @@ module.exports = {
'android.internal.e2e': {
device: 'emulator',
app: 'android.internal.e2e'
},
'android.external.e2e.old_version': {
device: 'emulator',
app: 'android.external.e2e.old_version',
artifacts: {
rootDir: './e2e/artifacts/android'
},
testRunner: {
$0: 'jest',
args: {
config: './e2e/configs/regressionConfig.json'
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
const { createWriteStream } = require('fs')
const axios = require('axios')

const slug = process.env.BITRISE_APP_SLUG
const artifactsToken = process.env.BITRISE_ARTIFACTS_TOKEN
const baseURL = 'https://api.bitrise.io/v0.1'

// Get the build slug of external e2e regression run by index
const getAndroidBuildSlug = async buildIndex => {
const response = await axios.get(
`${baseURL}/apps/${slug}/builds?sort_by=created_at&branch=main&workflow=android-external-e2e-regression-run`,
{
headers: { Authorization: `${artifactsToken}` }
}
)
const builds = response.data.data
return builds[buildIndex].slug
}

// Returns the apk build slug and the url to get the download link
async function getAndroidArtifacts(buildIndex) {
const latestAndroidBuildSlug = await getAndroidBuildSlug(buildIndex)
const url = `${baseURL}/apps/${slug}/builds/${latestAndroidBuildSlug}/artifacts`
const response = await axios.get(url, {
headers: { Authorization: `${artifactsToken}` }
})
const artifacts = response.data.data
// Filters the external build artifacts for the signed apk
const externalSignedApk = artifacts.find(
artifact =>
artifact.title.indexOf('app-external-e2e-bitrise-signed.apk') > -1 &&
artifact.artifact_type === 'android-apk'
)
// Filters the external build artifacts for the test apk
const androidTestApk = artifacts.find(
artifact =>
artifact.title.indexOf(
'app-external-e2e-androidTest-bitrise-signed.apk'
) > -1 && artifact.artifact_type === 'android-apk'
)
return {
url: url,
slug: externalSignedApk.slug,
testSlug: androidTestApk.slug
}
}

// Downloads the external signed and test apks
async function downloadExternalApk(buildIndex, apkName, testApkName) {
const writer = createWriteStream(apkName)
const testApkWriter = createWriteStream(testApkName)
const artifacts = await getAndroidArtifacts(buildIndex)
const apkSlug = artifacts.slug
const url = artifacts.url
const apkResponse = await axios.get(`${url}/${apkSlug}`, {
headers: { Authorization: `${artifactsToken}` }
})
const testApkResponse = await axios.get(`${url}/${artifacts.testSlug}`, {
headers: { Authorization: `${artifactsToken}` }
})
const testDownloadUrl = testApkResponse.data.data.expiring_download_url
const downloadUrl = apkResponse.data.data.expiring_download_url
const apkFile = await axios.get(downloadUrl, {
responseType: 'stream'
})
const testApkFile = await axios.get(testDownloadUrl, {
responseType: 'stream'
})
apkFile.data.pipe(writer)
testApkFile.data.pipe(testApkWriter)
}

// Downloads the latest and old versions of the external signed and test apks
async function setupApksForTesting() {
console.log('Downloading older version external apks for testing')
downloadExternalApk(
6,
'./e2e/tests/updateAppVersion/oldVersionApk/app-external-e2e-bitrise-signed.apk',
'./e2e/tests/updateAppVersion/oldVersionApk/app-external-e2e-androidTest-bitrise-signed.apk'
)
}

setupApksForTesting()
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import assertions from '../../helpers/assertions'
import { warmup } from '../../helpers/warmup'
import portfolioPage from '../../pages/portfolio.page'

describe('Install latest version of app and login', () => {
beforeAll(async () => {
await warmup()
console.log('Logged in successfully!')
})

it('Verify collectibles tab is displayed', async () => {
console.log('verifying collectibles tab is visible...')
await assertions.isVisible(portfolioPage.colectiblesTab)
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import assertions from '../../helpers/assertions'
import { warmup } from '../../helpers/warmup'
import portfolioPage from '../../pages/portfolio.page'

describe('Install older version of app and login', () => {
beforeAll(async () => {
await warmup()
console.log('Logged in successfully!')
})

it('Verify collectibles tab is displayed', async () => {
console.log('verifying collectibles tab is visible...')
await assertions.isVisible(portfolioPage.colectiblesTab)
await device.terminateApp()
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
set -o pipefail
if [ "$IS_REGRESSION_RUN" = true ]; then

npm rebuild detox
adb uninstall com.avaxwallet
npx ts-node ./e2e/tests/updateAppVersion/getOldAndroidVersion.js

adb install -r "./e2e/tests/updateAppVersion/oldVersionApk/app-external-e2e-bitrise-signed.apk"
adb install -r "./e2e/tests/updateAppVersion/oldVersionApk/app-external-e2e-androidTest-bitrise-signed.apk"

QT_QPA_PLATFORM=xcb ./node_modules/.bin/detox test loginWithOlderVersion.e2e.ts --configuration android.external.e2e.old_version; test_result=$? && sleep 5

if ((test_result != 0)); then
exit 1
fi
else
echo "This is not a regression run so not running the updateAppVersion tests"
fi
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
set -o pipefail
if [ "$IS_REGRESSION_RUN" = true ]; then
npm rebuild detox

adb install -r $BITRISE_APK_PATH
adb install -r $BITRISE_TEST_APK_PATH

QT_QPA_PLATFORM=xcb ./node_modules/.bin/detox test loginWithLatestVersion.e2e.ts --configuration android.external.release.ci --reuse; test_result=$? && sleep 5

npx ts-node ./e2e/attachLogsSendResultsToTestrail.ts

if ((test_result != 0)); then
exit 1
fi
else
echo "This is not a regression run so not running the updateAppVersion tests"
fi
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -26667,7 +26667,7 @@ react-native-webview@ava-labs/react-native-webview:
peerDependencies:
react: "*"
react-native: "*"
checksum: 6e268fad7aa8b8e56fd28cc95f94f35a33fdac4cec0085ae71a766d092760e3f9af35218706113ff7ae99a74baabc5112d32005dce9e66bdf4fda676fad9aa4e
checksum: 0efa24aa4da8f418f515b6be88e91948284856000fe5fde7026fa63ee814d84e7b7fbc1e8b8d98bc1833c05c9740a9fe2edf15b0909b77b4d012db22b75f5370
languageName: node
linkType: hard

Expand Down
Loading