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

chore(appium): refactor tests for less time retriability #673

Merged
merged 37 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
808ff26
chore(appium): refactor tests for less time retriability
luisecm Mar 27, 2024
3e9f350
Merge branch 'dev' into luis/share-did
luisecm Mar 28, 2024
b173f30
Merge branch 'dev' into luis/share-did
luisecm Mar 28, 2024
8b33d47
Merge branch 'dev' into luis/share-did
luisecm Apr 10, 2024
5b18f46
test(update): fixing conflicts on pr
luisecm Apr 15, 2024
432597e
Merge branch 'dev' into luis/share-did
luisecm Apr 15, 2024
67b240e
Merge branch 'dev' into luis/share-did
luisecm Apr 17, 2024
c992c90
test(update): remove this retries and pass it to config file
luisecm Apr 18, 2024
cc54e09
test(update): update tests for indicator offline
luisecm Apr 18, 2024
7fe88ff
test(update): use launch app instead of activate app
luisecm Apr 18, 2024
129ae4f
chore(appium): independent chat spec files
luisecm Apr 19, 2024
277c492
test(update): fixing missing steps in modified tests
luisecm Apr 19, 2024
ee6ef91
test(update): splitting tests into more it blocks to avoid timeouts
luisecm Apr 19, 2024
b5f4141
test(update): fixing chat replies tests
luisecm Apr 19, 2024
b7b4c3a
chore(appium): fix error on config spec files name
luisecm Apr 19, 2024
f3fd509
test(update): fixing errors on chats tests updated
luisecm Apr 20, 2024
4221cdf
test(update): fixes for flaky tests on chats
luisecm Apr 22, 2024
331bf9a
test(update): breaking tests into smaller steps to avoid timeout on CI
luisecm Apr 22, 2024
b875d08
chore(appium): temporarily change spec file retries to zero
luisecm Apr 22, 2024
11dd93d
test(update): fix appium tests
luisecm Apr 22, 2024
cd63543
chore(appium): update allure report configuration
luisecm Apr 22, 2024
d747dd0
chore(appium): update config files and fix settings issue
luisecm Apr 22, 2024
5cc4fc4
chore(appium): update config file and failing test
luisecm Apr 23, 2024
aff3812
chore(appium): fix configuration files
luisecm Apr 23, 2024
e5404a3
chore(appium): do not delete files on beginning
luisecm Apr 23, 2024
4347154
chore(appium): move close steps to on worker end hook
luisecm Apr 23, 2024
e466085
chore(appium): update terminate app methods
luisecm Apr 23, 2024
3a7bd56
Merge branch 'dev' into luis/share-did
luisecm Apr 23, 2024
5e5fe00
chore(appium): test changes for screenshots
luisecm Apr 23, 2024
835445b
chore(appium): take screenshots if tests are not passed
luisecm Apr 24, 2024
f52cf9f
chore(appium): fix config files identation error
luisecm Apr 24, 2024
ace6828
chore(appium): add spec file retries to two
luisecm Apr 24, 2024
4c2fc05
chore(appium): update config files and skip accessibility tests
luisecm Apr 24, 2024
dac90e0
test(update): skip failing test
luisecm Apr 24, 2024
b205b67
chore(appium): delete data before starting
luisecm Apr 24, 2024
215ae05
chore(appium): spec file retries defered on 0
luisecm Apr 25, 2024
6dd8ad7
chore(appium): update config file for chats tests
luisecm Apr 25, 2024
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
13 changes: 1 addition & 12 deletions .github/workflows/ui-automated-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -459,16 +459,6 @@ jobs:
name: appium-log-macos-chats
path: ./appium.log

- name: Upload Uplink Logs if test fails πŸ“·
uses: actions/upload-artifact@v3
if: failure()
with:
name: uplink-logs
path: |
~/.uplink/.user/debug.log
~/.uplinkUserB/.user/debug.log
~/.uplinkUserC/.user/debug.log

- name: Add label if any of test jobs failed
if: failure()
uses: buildsville/[email protected]
Expand Down Expand Up @@ -697,7 +687,7 @@ jobs:
allure_results: testing-uplink/allure
allure_report: allure-report
allure_history: allure-history
keep_reports: 20
keep_reports: 100

- name: Deploy report to Github Pages
if: success()
Expand Down Expand Up @@ -746,7 +736,6 @@ jobs:
test-allure-mac-ci
test-allure-mac-chats
test-allure-windows-ci
uplink-logs

- name: Remove label if all test jobs succeeded
uses: buildsville/[email protected]
Expand Down
14 changes: 10 additions & 4 deletions config/wdio.mac.app.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,16 @@ export const config: WebdriverIO.Config = {
}
},

afterTest: async function (test, describe, { error }) {
if (error) {
afterTest: async function (
test,
context,
{ error, result, duration, passed, retries },
) {
if (!passed) {
let imageFile = await driver.takeScreenshot();
const imageFolder = join(
process.cwd(),
"./test-results/macos-app",
"./test-results/macos",
test.parent,
);
const imageTitle = test.title + " - Failed.png";
Expand All @@ -144,8 +148,10 @@ export const config: WebdriverIO.Config = {
// Add to Screenshot to Allure Reporter
const data = await readFileSync(`${imageFolder}/${imageTitle}`);
allureReporter.addAttachment(imageTitle, data, "image/png");
}

// Close application if still open
if (error) {
// Close applications if open
await terminateApplication(MACOS_BUNDLE_ID);
}
},
Expand Down
17 changes: 11 additions & 6 deletions config/wdio.mac.ci.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,12 @@ export const config: WebdriverIO.Config = {
/**
* Function to be executed after a test (in Mocha/Jasmine).
*/
afterTest: async function (test, describe, { error }) {
if (error) {
// If test fails, take a screenshot, make a folder with the test name and save it there
afterTest: async function (
test,
context,
{ error, result, duration, passed, retries },
) {
if (!passed) {
let imageFile = await driver.takeScreenshot();
const imageFolder = join(
process.cwd(),
Expand All @@ -146,10 +149,12 @@ export const config: WebdriverIO.Config = {
);

// Add to Screenshot to Allure Reporter
const dataImage = await readFileSync(`${imageFolder}/${imageTitle}`);
allureReporter.addAttachment(imageTitle, dataImage, "image/png");
const data = await readFileSync(`${imageFolder}/${imageTitle}`);
allureReporter.addAttachment(imageTitle, data, "image/png");
}

// Close application if still open
if (error) {
// Close applications if open
await terminateApplication(MACOS_BUNDLE_ID);
}
},
Expand Down
41 changes: 23 additions & 18 deletions config/wdio.mac.multiremote.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const config: WebdriverIO.Config = {
// then the current working directory is where your `package.json` resides, so `wdio`
// will be called from there.
//
specs: [join(process.cwd(), "./tests/suites/Chats/01-Chats.suite.ts")],
specs: [join(process.cwd(), "./tests/specs/reusable-accounts/*.spec.ts")],
// Patterns to exclude.
exclude: [
// 'path/to/excluded/files'
Expand Down Expand Up @@ -92,6 +92,10 @@ export const config: WebdriverIO.Config = {
],
],
maxInstances: 1,
// The number of times to retry the entire specfile when it fails as a whole
specFileRetries: 1,
// Delay in seconds between the spec file retry attempts
specFileRetriesDelay: 0,
//
// =====
// Hooks
Expand All @@ -100,7 +104,10 @@ export const config: WebdriverIO.Config = {
// it and to build services around it. You can either apply a single function or an array of
// methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
// resolved to continue.
onPrepare: async function () {
/**
* Function to be executed after a test (in Mocha/Jasmine).
*/
onPrepare: async function (config, capabilities) {
const cacheFolderUserA = homedir() + "/.uplink/.user";
const cacheFolderUserB = homedir() + "/.uplinkUserB/.user";
const cacheFolderUserC = homedir() + "/.uplinkUserC/.user";
Expand All @@ -126,12 +133,14 @@ export const config: WebdriverIO.Config = {
);
}
},
/**
* Function to be executed after a test (in Mocha/Jasmine).
*/
afterTest: async function (test, describe, { error }) {
if (error) {
let imageFile = await driver.takeScreenshot();

afterTest: async function (
test,
context,
{ error, result, duration, passed, retries },
) {
if (!passed) {
let imageFile = await browser.takeScreenshot();
const imageFolder = join(
process.cwd(),
"./test-results/macos-multiremote",
Expand All @@ -148,19 +157,15 @@ export const config: WebdriverIO.Config = {
// Add to Screenshot to Allure Reporter
const data = await readFileSync(`${imageFolder}/${imageTitle}`);
allureReporter.addAttachment(imageTitle, data, "image/png");

// Close applications if open
await terminateApplication(MACOS_USER_A_BUNDLE_ID);
await terminateApplication(MACOS_USER_B_BUNDLE_ID);
await terminateApplication(MACOS_USER_C_BUNDLE_ID);
}
},
},

afterSuite: async function (suite) {
// Close second and third applications if open
await terminateApplication(MACOS_USER_B_BUNDLE_ID);
await terminateApplication(MACOS_USER_C_BUNDLE_ID);
afterSuite: async function (suite) {
// Close applications if open
await terminateApplication(MACOS_USER_A_BUNDLE_ID);
await terminateApplication(MACOS_USER_B_BUNDLE_ID);
await terminateApplication(MACOS_USER_C_BUNDLE_ID);
},
},
};

Expand Down
12 changes: 8 additions & 4 deletions config/wdio.windows.app.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,16 @@ export const config: WebdriverIO.Config = {
}
},

afterTest: async function (test, describe, { error }) {
if (error) {
afterTest: async function (
test,
context,
{ error, result, duration, passed, retries },
) {
if (!passed) {
let imageFile = await driver.takeScreenshot();
let imageFolder = join(
const imageFolder = join(
process.cwd(),
"./test-results/windows-app",
"./test-results/windows",
test.parent,
);
const imageTitle = test.title + " - Failed.png";
Expand Down
31 changes: 20 additions & 11 deletions config/wdio.windows.ci.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,11 @@ export const config: WebdriverIO.Config = {
]);
},

afterTest: async function (test, describe, { error }) {
afterTest: async function (
test,
context,
{ error, result, duration, passed, retries },
) {
// Stop video recording and saved it into base64 format
const base64Video = await driver.executeScript(
"windows: stopRecordingScreen",
Expand All @@ -174,21 +178,18 @@ export const config: WebdriverIO.Config = {
},
],
);
if (error) {
let imageFile = await driver.takeScreenshot();
let imageFolder = join(
if (!passed) {
await driver.takeScreenshot();
const imageFile = await driver.takeScreenshot();
const imageFolder = join(
process.cwd(),
"./test-results/windows-ci",
test.parent,
);

const imageTitle = test.title + " - Failed.png";
const videoTitle = test.title + " - Failed.mp4";
await fsp.mkdir(imageFolder, { recursive: true });
await fsp.writeFile(
imageFolder + "/" + imageTitle,
imageFile,
"base64",
);

// Write Video File if test failure and add it to failed screenshots folder
await fsp.writeFile(
Expand All @@ -197,12 +198,20 @@ export const config: WebdriverIO.Config = {
"base64",
);

await fsp.writeFile(
imageFolder + "/" + imageTitle,
imageFile,
"base64",
);

// Add to Screenshot to Allure Reporter
const data = await readFileSync(`${imageFolder}/${imageTitle}`);
const dataVideo = await readFileSync(`${imageFolder}/${videoTitle}`);
allureReporter.addAttachment(imageTitle, data, "image/png");
allureReporter.addAttachment(videoTitle, dataVideo, "video/mp4");

// Add to Screenshot to Allure Reporter
const data = await readFileSync(`${imageFolder}/${imageTitle}`);
allureReporter.addAttachment(imageTitle, data, "image/png");

// Close application if still open
await driver.executeScript("windows: closeApp", [
{
Expand Down
8 changes: 6 additions & 2 deletions config/wdio.windows.onetime.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,12 @@ export const config: WebdriverIO.Config = {
}
},

afterTest: async function (test, describe, { error }) {
if (error) {
afterTest: async function (
test,
context,
{ error, result, duration, passed, retries },
) {
if (!passed) {
let imageFile = await driver.takeScreenshot();
let imageFolder = join(
process.cwd(),
Expand Down
Loading
Loading