appium-xcuitest-driver
Version:
Appium driver for iOS using XCUITest for backend
81 lines • 4.11 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const file_movement_1 = require("../../../lib/commands/file-movement");
const support_1 = require("appium/support");
const driver_1 = require("../../../lib/driver");
const chai_1 = __importStar(require("chai"));
const chai_as_promised_1 = __importDefault(require("chai-as-promised"));
chai_1.default.use(chai_as_promised_1.default);
describe('file-movement', function () {
describe('parseContainerPath', function () {
let driver;
beforeEach(function () {
driver = new driver_1.XCUITestDriver({});
});
afterEach(function () {
driver = null;
});
it('should parse with container', async function () {
const mntRoot = await support_1.tempDir.openDir();
const { bundleId, pathInContainer, containerType } = await file_movement_1.parseContainerPath.bind(driver)('@io.appium.example:app/Documents/file.txt', mntRoot);
(0, chai_1.expect)(bundleId).to.eql('io.appium.example');
(0, chai_1.expect)(pathInContainer).to.eql(`${mntRoot}/Documents/file.txt`);
(0, chai_1.expect)(containerType).to.eql('app');
});
it('should parse with container root', async function () {
const mntRoot = await support_1.tempDir.openDir();
const { bundleId, pathInContainer, containerType } = await file_movement_1.parseContainerPath.bind(driver)('@io.appium.example:documents/', mntRoot);
(0, chai_1.expect)(bundleId).to.eql('io.appium.example');
(0, chai_1.expect)(pathInContainer).to.eql(mntRoot);
(0, chai_1.expect)(containerType).to.eql('documents');
});
it('should parse without container', async function () {
const mntRoot = await support_1.tempDir.openDir();
const { bundleId, pathInContainer, containerType } = await file_movement_1.parseContainerPath.bind(driver)('@io.appium.example/Documents/file.txt', mntRoot);
(0, chai_1.expect)(bundleId).to.eql('io.appium.example');
(0, chai_1.expect)(pathInContainer).to.eql(`${mntRoot}/Documents/file.txt`);
(0, chai_1.expect)(containerType).equal(null);
});
it('should raise an error if no container path', async function () {
const mntRoot = await support_1.tempDir.openDir();
await (0, chai_1.expect)(file_movement_1.parseContainerPath.bind(driver)('@io.appium.example:documents', mntRoot)).to.be.rejected;
});
});
});
//# sourceMappingURL=file-movement-specs.js.map