Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
before(async function () {
udid = await simctl.createDevice('ios-simulator testing',
deviceType.device,
deviceType.version,
{timeout: 20000});
// just need a little more space in the logs
console.log('\n\n'); // eslint-disable-line no-console
});
before(async function () {
sim = await getExistingSim(DEVICE_NAME, PLATFORM_VERSION);
if (!sim) {
const udid = await createDevice(SIM_NAME, DEVICE_NAME, PLATFORM_VERSION);
sim = await getSimulator(udid);
simCreated = true;
}
// on certain system, particularly Xcode 11 on Travis, starting the sim fails
await retry(4, async function () {
try {
await sim.run({
startupTimeout: 60000,
});
} catch (err) {
await sim.shutdown();
throw err;
}
});
const port = await startHttpServer();
before(async function () {
const udid = await createDevice(
SIM_DEVICE_NAME,
translateDeviceName(UICATALOG_SIM_CAPS.platformVersion, UICATALOG_SIM_CAPS.deviceName),
UICATALOG_SIM_CAPS.platformVersion
);
baseCaps = Object.assign({}, UICATALOG_SIM_CAPS, {udid});
caps = Object.assign({
usePrebuiltWDA: true,
agentPath: path.join(TEMP_FOLDER, 'WebDriverAgent.xcodeproj'),
derivedDataPath: path.join(TEMP_FOLDER, 'DerivedData', 'WebDriverAgent')
}, baseCaps);
// copy existing WebDriverAgent to the selected derivedDataPath folder
const wda_path = path.join(process.cwd(), 'WebDriverAgent');
fs.symlinkSync(wda_path, TEMP_FOLDER);
});
after(async function () {
before(async function () {
let simUdid = await createDevice(
SIM_DEVICE_NAME,
translateDeviceName(PLATFORM_VERSION, DEVICE_NAME),
PLATFORM_VERSION
);
device = await getSimulator(simUdid);
});
async function createDevice () {
return await createDeviceNodeSimctl(
SIM_DEVICE_NAME,
translateDeviceName(UICATALOG_SIM_CAPS.platformVersion, UICATALOG_SIM_CAPS.deviceName),
UICATALOG_SIM_CAPS.platformVersion
);
}
beforeEach(async function () {
await killAllSimulators();
let udid = await simctl.createDevice('ios-simulator testing',
'iPhone 6s',
deviceVersion,
{timeout: 20000});
sim = await getSimulator(udid);
await sim.run({startupTimeout: LONG_TIMEOUT});
});
afterEach(async function () {
before(async function () {
if (_.isEmpty(xcodeVersion)) {
xcodeVersion = await xcode.getVersion(true);
}
if (xcodeVersion.major < 9) {
return this.skip();
}
await killAllSimulators();
for (let i = 0; i < DEVICES_COUNT; i++) {
const udid = await simctl.createDevice(`ios-simulator_${i}_testing`,
deviceType.device,
deviceType.version);
simulatorsMapping[udid] = await getSimulator(udid);
}
});
after(async function () {
before(async function () {
await killAllSimulators();
let udid = await simctl.createDevice('ios-simulator testing',
deviceType.device,
deviceType.version);
sim = await getSimulator(udid);
await sim.run({
startupTimeout: LONG_TIMEOUT,
});
});
after(async function () {
function createDevice(prefix, deviceType) {
return simctl.createDevice(
prefix + " " + deviceType,
deviceType,
getRuntime()
);
}