How to use the appium-support.fs.mkdir function in appium-support

To help you get started, we’ve selected a few appium-support examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appium / appium-adb / test / functional / android-manifest-e2e-specs.js View on Github external
it.skip('should compile and insert manifest', async function () {
    let appPackage = 'com.example.android.contactmanager',
        newServerPath = path.resolve(tmpDir, `selendroid.${appPackage}.apk`),
        newPackage = 'com.example.android.contactmanager.selendroid',
        dstDir = path.resolve(tmpDir, appPackage),
        dstManifest = path.resolve(dstDir, 'AndroidManifest.xml');
    // deleting temp directory if present
    try {
      await fs.rimraf(tmpDir);
    } catch (e) {
      console.log(`Unable to delete temp directory. It might not be present. ${e.message}`); // eslint-disable-line no-console
    }
    await fs.mkdir(tmpDir);
    await fs.mkdir(dstDir);
    await fs.writeFile(dstManifest, await fs.readFile(srcManifest, 'utf8'), 'utf8');
    await adb.compileManifest(dstManifest, newPackage, appPackage);
    (await util.fileExists(dstManifest)).should.be.true;
    await adb.insertManifest(dstManifest, serverPath, newServerPath);
    (await util.fileExists(newServerPath)).should.be.true;
    // deleting temp directory
    try {
      await fs.rimraf(tmpDir);
    } catch (e) {
      console.log(`Unable to delete temp directory. It might not be present. ${e.message}`); // eslint-disable-line no-console
    }
  });
});
github appium / appium-adb / test / functional / android-manifest-e2e-specs.js View on Github external
it.skip('should compile and insert manifest', async function () {
    let appPackage = 'com.example.android.contactmanager',
        newServerPath = path.resolve(tmpDir, `selendroid.${appPackage}.apk`),
        newPackage = 'com.example.android.contactmanager.selendroid',
        dstDir = path.resolve(tmpDir, appPackage),
        dstManifest = path.resolve(dstDir, 'AndroidManifest.xml');
    // deleting temp directory if present
    try {
      await fs.rimraf(tmpDir);
    } catch (e) {
      console.log(`Unable to delete temp directory. It might not be present. ${e.message}`); // eslint-disable-line no-console
    }
    await fs.mkdir(tmpDir);
    await fs.mkdir(dstDir);
    await fs.writeFile(dstManifest, await fs.readFile(srcManifest, 'utf8'), 'utf8');
    await adb.compileManifest(dstManifest, newPackage, appPackage);
    (await util.fileExists(dstManifest)).should.be.true;
    await adb.insertManifest(dstManifest, serverPath, newServerPath);
    (await util.fileExists(newServerPath)).should.be.true;
    // deleting temp directory
    try {
      await fs.rimraf(tmpDir);
    } catch (e) {
      console.log(`Unable to delete temp directory. It might not be present. ${e.message}`); // eslint-disable-line no-console
    }
  });
});
github appium-boneyard / appium-instruments / test / e2e / basics-e2e-specs.js View on Github external
before(async function () {
      // travis can't write to /tmp, so let's create a tmp directory
      try {
        await fs.mkdir(TEMP_DIR);
      } catch (e) {}

      await fs.rimraf(altTmpDir);
    });
github appium / appium-ios-driver / test / e2e / driver / instruments / basics-e2e-specs.js View on Github external
before(async function () {
      // travis can't write to /tmp, so let's create a tmp directory
      try {
        await fs.mkdir(TEMP_DIR);
      } catch (e) {}

      await fs.rimraf(altTraceDir);
    });
github appium / appium-xcuitest-driver / test / functional / device / file-movement-e2e-specs.js View on Github external
it('should pull all the files in Library/AddressBook', async function () {
          const remotePath = `Library/AddressBook`;
          const data = await driver.pullFolder(remotePath);
          const tmpRoot = await tempDir.openDir();
          try {
            const zipPath = path.resolve(tmpRoot, 'data.zip');
            const extractedDataPath = path.resolve(tmpRoot, 'extracted_data');
            await fs.writeFile(zipPath, Buffer.from(data, 'base64'));
            await fs.mkdir(extractedDataPath);
            await zip.extractAllTo(zipPath, extractedDataPath);
            const itemsCount = (await fs.readdir(extractedDataPath)).length;
            itemsCount.should.be.above(1);
          } finally {
            await fs.rimraf(tmpRoot);
          }
        });
      });
github appium / appium-ios-simulator / test / unit / certificate-specs.js View on Github external
beforeEach(async function () {
    tempDirectory = `${assetsDir}/temp`;
    await fs.rimraf(tempDirectory);
    await fs.mkdir(tempDirectory);
  });
github appium / node-adb-client / test / functional / adb-e2e-specs.js View on Github external
before(async () => {
      await fs.mkdir(tempTestPath);
    });
    after(async () => {
github appium / appium-xcuitest-driver / lib / commands / file-movement.js View on Github external
await service.walkDir(relativePath, true, async (itemPath, isDir) => {
      const pathOnServer = path.join(tmpFolder, itemPath);
      if (isDir) {
        await fs.mkdir(pathOnServer);
      } else {
        const readStream = await service.createReadStream(itemPath, {autoDestroy: true });
        const writeStream = fs.createWriteStream(pathOnServer, {autoClose: true});
        promises.push(new B((resolve) => writeStream.on('close', resolve)));
        readStream.pipe(writeStream);
      }
    });
    try {
github appium / appium-uiautomator2-driver / lib / installer.js View on Github external
async function downloadUiAutomator2ServerApk () {
  await fs.mkdir(UI2_DIR);
  log.info(`downloading UiAutomator2 Server APK ${UI2_VER} : ${UI2_SERVER_DOWNLOAD}`);
  log.info(`downloading UiAutomator2 Server test APK ${UI2_VER} : ${UI2_SERVER_TEST_DOWNLOAD}`);
  let serverApk = await request.get({url: UI2_SERVER_DOWNLOAD, encoding: null});
  let serverTestApk = await request.get({url: UI2_SERVER_TEST_DOWNLOAD, encoding: null});
  if (!(serverApk instanceof Buffer)) {
    throw new Error(Object.prototype.toString.call(serverApk));
  }
  if (!(serverTestApk instanceof Buffer)) {
    throw new Error(Object.prototype.toString.call(serverTestApk));
  }
  let serverFingerprint = await sha512(serverApk);
  let serverTestFingerprint = await sha512(serverTestApk);

  if (serverFingerprint !== SERVER_DOWNLOAD_SHA512) {
    log.errorAndThrow(`bad Server SHA512 fingerprint: ${serverFingerprint}`);
    log.error("Stopping the installation");
github Samsung / appium-tizen-driver / lib / commands / action.js View on Github external
commands.pushFile = async function (file, base64Data) {
  const rootDir = path.resolve(__dirname, '..', '..', '..');
  const fileDir = path.resolve(rootDir, 'app');
  const localFile = path.resolve(fileDir, file);
  if (file.indexOf('/') > -1) {
    log.errorAndThrow(`It is expected that file point to a file and not to a folder. ` + `'${file}' is given instead`);
  }

  if (_.isArray(base64Data)) {
    base64Data = Buffer.from(base64Data).toString('utf8');
  }

  const content = Buffer.from(base64Data, 'base64');
  let isFileDir = await fs.exists(fileDir);
  if (!isFileDir) {
    await fs.mkdir(fileDir);
  }

  await fs.writeFile(localFile, content.toString('binary'), 'binary');

  return true;
};