При загрузке файла возникает ошибка времени ожидания в автоматизации тестирования транспортира - PullRequest
0 голосов
/ 19 июня 2020

Я использовал код ниже. Конф. js

capabilities: {

    'browserName': 'chrome',
    'platform': 'ANY',
    'version': 'ANY',
    'chromeOptions': {
      args: ['--no-sandbox', '--test-type=browser'],
      prefs: {
       // 'plugins.plugins_disabled': 'Chrome PDF Viewer',
       // 'plugins.always_open_pdf_externally': true,
        'download': {
          'prompt_for_download': false,
         // 'directory_upgrade': true,
          'default_directory': 'D:\Automation\Protractor\test-suto'
        }
      }
    }
  },

SPE c

var fs = require('fs'),
    filename = 'test.pdf',
    
it('User should be able to download "Consignment Letters"', function () {
        browser.wait(EC.visibilityOf(orderNavigationListPage.btnAction), 50000, 'Element - Action Button - not Visible after 50000ms').then(function () {
            orderNavigationListPage.btnAction.click()
        });

        browser.sleep(1000);
        orderNavigationListPage.btnDownloadConsignmentLetter.click();

        browser.driver.wait(function () {
            return fs.existsSync(filename);
        }, 30000).then(function () {

            //expect(filename).toContain('ConsignmentDoc'+orderAfter+'.pdf');
            expect(fs.readFileSync(filename, { encoding: 'utf8' })).toEqual(
                "test.pdf"
            );
        });
    });
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...