/
conf.js
129 lines (123 loc) · 4.96 KB
/
conf.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
const path = require('path');
const Reporting = require('perfecto-reporting');
var reportingClient;
//1. Replace <<cloud name>> with your perfecto cloud name (e.g. demo is the cloudName of demo.perfectomobile.com).
var host = '<<cloud name>>';
// 2. Replace <<security token>> with your perfecto security token.
var securityToken = '<<security token>>';
host = process.env.HOST == null ? host : process.env.HOST;
securityToken = process.env.SECURITY_TOKEN == null ? securityToken : process.env.SECURITY_TOKEN;
//Define your global tags here:
const tags = ['SampleTag1'];
global.STEP_TIMEOUT = 900000;
global.IMPLICIT_TIMEOUT = 5000;
exports.config = {
securityToken: securityToken,
protocol: 'http',
hostname: host + '.perfectomobile.com',
path: '/nexperience/perfectomobile/wd/hub',
port: 80,
sync: true,
bail: 0,
exclude: [],
specs: [
'ios/native.js'
],
maxInstances: 1,
capabilities: [{
securityToken: securityToken,
automationName: 'Appium',
// 3. Set device capabilities.
platformName: 'iOS',
model: 'iPhone.*',
// 4. Set Perfecto Media repository path of App under test.
app: 'PUBLIC:ExpenseTracker/Native/iOS/InvoiceApp1.0.ipa',
// 5. Set the unique identifier of your app
bundleId: 'io.perfecto.expense.tracker',
appiumVersion: '1.20.2',
autoLaunch: true, // Whether to have Appium install and launch the app automatically.
iOSResign: true, // To work with hybrid applications, install the iOS/Android application as instrumented.
// fullReset: false, // Reset app state by uninstalling app
browserName: '',
takesScreenshot: false,
screenshotOnError: true,
openDeviceTimeout: 5
}, ],
// Default timeout for all waitFor* commands.
waitforTimeout: 30000,
// Default timeout in milliseconds for request
// if Selenium Grid doesn't send response
connectionRetryTimeout: 90000,
// Default request retries count
connectionRetryCount: 3,
framework: 'jasmine',
// Options to be passed to Jasmine.
jasmineNodeOpts: {
// Jasmine default timeout
defaultTimeoutInterval: 100000,
// The Jasmine framework allows interception of each assertion in order to log the state of the application
// or website depending on the result. For example, it is pretty handy to take a screenshot every time
// an assertion fails.
expectationResultHandler: function(passed, assertion) {
// do something
}
},
reporters: ['spec'],
//
// =====
// Hooks
// =====
// Gets executed before test execution begins. At this point you can access all global
// variables, such as `browser`. It is the perfect place to define custom commands.
before: function(capabilities, specs) {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;
if (process.env.jobName != null) {
reportingClient = new Reporting.Perfecto.PerfectoReportingClient(new Reporting.Perfecto.PerfectoExecutionContext({
webdriver: {
executeScript: (command, params) => {
return browser.execute(command, params);
}
},
job: new Reporting.Model.Job({
jobName: process.env.jobName,
buildNumber: parseInt(process.env.jobNumber)
}),
tags: tags
}));
} else {
reportingClient = new Reporting.Perfecto.PerfectoReportingClient(new Reporting.Perfecto.PerfectoExecutionContext({
webdriver: {
executeScript: (command, params) => {
return browser.execute(command, params);
}
},
tags: tags
}));
}
browser.reportingClient = reportingClient;
var myReporter = {
specStarted: function(result) {
reportingClient.testStart(result.fullName);
},
specDone: async function(result) {
if (result.status === 'failed') {
const failure = await result.failedExpectations[result.failedExpectations.length - 1];
await reportingClient.testStop({
status: Reporting.Constants.results.failed,
message: `${failure.message} ${failure.stack}`
});
} else {
await reportingClient.testStop({
status: Reporting.Constants.results.passed
});
}
}
}
jasmine.getEnv().addReporter(myReporter);
},
// Gets executed after all tests are done. You still have access to all global variables from
// the test.
after: async function(result, capabilities, specs) {
await console.log("\n\nReport: " + browser.capabilities['testGridReportUrl']);
},
}