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): use two GH runners to run chats tests on macos #514

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1c24a58
chore(appium): use two GH runners to run chats tests on macos
luisecm Oct 31, 2023
872c3e3
chore(appium): update tests to save user keys
luisecm Oct 31, 2023
9db4acb
chore(appium): update max instances on config file
luisecm Oct 31, 2023
5956977
chore(appium): copy correct data for chat users
luisecm Oct 31, 2023
cfd6d4c
chore(appium): list files extracted
luisecm Oct 31, 2023
71c875e
chore(appium): try using two workflows to improve speed on test
luisecm Oct 31, 2023
0a70db8
chore(appium): craete new config files for accounts
luisecm Nov 1, 2023
3817afe
chore(appium): ensure accounts are extracted
luisecm Nov 1, 2023
ab3c5af
chore(appium): fixing copy directories
luisecm Nov 1, 2023
9ed0634
chore(appium): remove show files steps not required
luisecm Nov 1, 2023
c95c9e2
Merge branch 'dev' into luis/two-runners-chats
luisecm Nov 1, 2023
ec114c3
test(update): start adding tests to execute on two runners
luisecm Nov 1, 2023
9531656
Merge branch 'dev' into luis/two-runners-chats
luisecm Nov 3, 2023
8cfda3a
Merge branch 'dev' into luis/two-runners-chats
luisecm Nov 3, 2023
5b1ab56
test(update): finishing dividing tests into two specs
luisecm Nov 3, 2023
194eefd
chore(appium): just attempt the first set of tests
luisecm Nov 6, 2023
3505d19
chore(appium): increase timeouts on remote wait methods
luisecm Nov 6, 2023
9a55fa1
test(update): adjust chats tests to two GH runners
luisecm Nov 6, 2023
8f2123a
test(update): update locator for button
luisecm Nov 7, 2023
446e3f4
screenobject(update): update waitUntil methods and click on emoji
luisecm Nov 7, 2023
126333e
screenobject(update): add custom timeouts for methods
luisecm Nov 7, 2023
f8865c5
test(update): fix chat test for user A to go to incoming list
luisecm Nov 7, 2023
eb0848e
chore(appium): update toolchain and type did method
luisecm Nov 7, 2023
dc0bf46
test(update): add validation before clicking
luisecm Nov 7, 2023
5860a1c
Merge branch 'dev' into luis/two-runners-chats
luisecm Nov 7, 2023
17b3796
chore(appium): fixing conflicts
luisecm Nov 7, 2023
6be5095
Merge branch 'dev' into luis/two-runners-chats
luisecm Nov 7, 2023
fb6abae
Merge branch 'dev' into luis/two-runners-chats
luisecm Nov 8, 2023
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
385 changes: 65 additions & 320 deletions .github/workflows/ui-automated-tests.yml

Large diffs are not rendered by default.

451 changes: 451 additions & 0 deletions .github/workflows/ui-automated-windows.yml

Large diffs are not rendered by default.

143 changes: 143 additions & 0 deletions config/macos-chats/wdio.mac.chatA.conf.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
import "module-alias/register";
import allureReporter from '@wdio/allure-reporter'
import { config as sharedConfig } from '@config/wdio.shared.conf';
import { join } from "path";
import { MACOS_BUNDLE_ID, MACOS_DRIVER } from "@helpers/constants";
const fsp = require("fs").promises;
const { readFileSync, rmSync } = require("fs");

// @ts-expect-error
export const config: WebdriverIO.Config = {
...sharedConfig,
...{
//
// ==================
// Specify Test Files
// ==================
// Define which test specs should run. The pattern is relative to the directory
// from which `wdio` was called.
//
// The specs are defined as an array of spec files (optionally using wildcards
// that will be expanded). The test for each spec file will be run in a separate
// worker process. In order to have a group of spec files run in the same worker
// process simply enclose them in an array within the specs array.
//
// If you are calling `wdio` from an NPM script (see https://docs.npmjs.com/cli/run-script),
// 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/02-ChatsUserA.suite.ts")],
// Patterns to exclude.
exclude: [
// 'path/to/excluded/files'
],
specFileRetries: 0,
// Options to be passed to Mocha.
mochaOpts: {
ui: "bdd",
/**
* NOTE: This has been increased for more stable Appium Native app
* tests because they can take a bit longer.
*/
timeout: 300000, // 5min
bail: true,
},
//
// ============
// Capabilities
// ============
// Define your capabilities here. WebdriverIO can run multiple capabilities at the same
// time. Depending on the number of capabilities, WebdriverIO launches several test
// sessions. Within your capabilities you can overwrite the spec and exclude options in
// order to group specific specs to a specific capability.
//
//
// If you have trouble getting all important capabilities together, check out the
// Sauce Labs platform configurator - a great tool to configure your capabilities:
// https://docs.saucelabs.com/reference/platforms-configurator
//
port: 4723,
path: '/',
capabilities: {
userA: {
capabilities: {
platformName: "mac",
"appium:automationName": MACOS_DRIVER,
"appium:bundleId": MACOS_BUNDLE_ID,
"appium:systemPort": 4724,
}
},
}
,
//
// ===================
// Test Configurations
// ===================
// Define all options that are relevant for the WebdriverIO instance here
//
reporters: [
["spec",
{
showPreface: false,
},
],
['allure',
{
outputDir: './allure-results',
disableWebdriverStepsReporting: true,
disableWebdriverScreenshotsReporting: false,
}
],
['junit',
{
outputDir: './test-report/',
outputFileFormat: function (options) {
return `test-results-macos-chatA-${options.cid}.xml`;
}
}
],
],
//
// =====
// Hooks
// =====
// WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
// 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() {
const allureResultsFolder = join(process.cwd(), "./allure-results");
const testReportFolder = join(process.cwd(), "./test-report");
const testResultsFolder = join(process.cwd(), "./test-results");
try {
await rmSync(allureResultsFolder, { recursive: true, force: true });
await rmSync(testReportFolder, { recursive: true, force: true });
await rmSync(testResultsFolder, { recursive: true, force: true });
console.log("Deleted Artifacts Folders Successfully!");
} catch (error) {
console.error(
`Got an error trying to delete artifacts folders: ${error.message}`
);
}
},

afterTest: async function (test, describe, { error }) {
if (error) {
let imageFile = await driver.takeScreenshot();
const imageFolder = join(process.cwd(), "./test-results/macos-chatA", test.parent);
const imageTitle = test.title + " - Failed.png"
await fsp.mkdir(imageFolder, {recursive: true});
await fsp.writeFile(
imageFolder + "/" + imageTitle,
imageFile,
"base64"
);

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

}
144 changes: 144 additions & 0 deletions config/macos-chats/wdio.mac.chatB.conf.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
import "module-alias/register";
import allureReporter from '@wdio/allure-reporter'
import { config as sharedConfig } from '@config/wdio.shared.conf';
import { homedir } from "os";
import { join } from "path";
import { MACOS_BUNDLE_ID, MACOS_DRIVER } from "@helpers/constants";
const fsp = require("fs").promises;
const { readFileSync, rmSync } = require("fs");

// @ts-expect-error
export const config: WebdriverIO.Config = {
...sharedConfig,
...{
//
// ==================
// Specify Test Files
// ==================
// Define which test specs should run. The pattern is relative to the directory
// from which `wdio` was called.
//
// The specs are defined as an array of spec files (optionally using wildcards
// that will be expanded). The test for each spec file will be run in a separate
// worker process. In order to have a group of spec files run in the same worker
// process simply enclose them in an array within the specs array.
//
// If you are calling `wdio` from an NPM script (see https://docs.npmjs.com/cli/run-script),
// 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/03-ChatsUserB.suite.ts")],
// Patterns to exclude.
exclude: [
// 'path/to/excluded/files'
],
specFileRetries: 0,
// Options to be passed to Mocha.
mochaOpts: {
ui: "bdd",
/**
* NOTE: This has been increased for more stable Appium Native app
* tests because they can take a bit longer.
*/
timeout: 300000, // 5min
bail: true,
},
//
// ============
// Capabilities
// ============
// Define your capabilities here. WebdriverIO can run multiple capabilities at the same
// time. Depending on the number of capabilities, WebdriverIO launches several test
// sessions. Within your capabilities you can overwrite the spec and exclude options in
// order to group specific specs to a specific capability.
//
//
// If you have trouble getting all important capabilities together, check out the
// Sauce Labs platform configurator - a great tool to configure your capabilities:
// https://docs.saucelabs.com/reference/platforms-configurator
//
port: 4723,
path: '/',
capabilities: {
userA: {
capabilities: {
platformName: "mac",
"appium:automationName": MACOS_DRIVER,
"appium:bundleId": MACOS_BUNDLE_ID,
"appium:systemPort": 4724,
}
},
}
,
//
// ===================
// Test Configurations
// ===================
// Define all options that are relevant for the WebdriverIO instance here
//
reporters: [
["spec",
{
showPreface: false,
},
],
['allure',
{
outputDir: './allure-results',
disableWebdriverStepsReporting: true,
disableWebdriverScreenshotsReporting: false,
}
],
['junit',
{
outputDir: './test-report/',
outputFileFormat: function (options) {
return `test-results-macos-chatB-${options.cid}.xml`;
}
}
],
],
//
// =====
// Hooks
// =====
// WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
// 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() {
const allureResultsFolder = join(process.cwd(), "./allure-results");
const testReportFolder = join(process.cwd(), "./test-report");
const testResultsFolder = join(process.cwd(), "./test-results");
try {
await rmSync(allureResultsFolder, { recursive: true, force: true });
await rmSync(testReportFolder, { recursive: true, force: true });
await rmSync(testResultsFolder, { recursive: true, force: true });
console.log("Deleted Artifacts Folders Successfully!");
} catch (error) {
console.error(
`Got an error trying to delete artifacts folders: ${error.message}`
);
}
},

afterTest: async function (test, describe, { error }) {
if (error) {
let imageFile = await driver.takeScreenshot();
const imageFolder = join(process.cwd(), "./test-results/macos-chatB", test.parent);
const imageTitle = test.title + " - Failed.png"
await fsp.mkdir(imageFolder, {recursive: true});
await fsp.writeFile(
imageFolder + "/" + imageTitle,
imageFile,
"base64"
);

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

}
Loading
Loading