Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protractor test fails in Firefox with "HTTP method not allowed"

How can I fix "HTTP method not allowed"? I'm using Angular 8, Firefox is v69.0 on Ubuntu 19.04. Protractor is 5.4.0. Jasmine-core is 3.4.0

The same e2e test works in Chrome. My unit tests using Karma launch and work with no problem in Firefox.

The repository is located at https://github.com/admiralfeb/ggtavern.pub

protractor-firefox-ci.conf.js

const { JUnitXmlReporter } = require('jasmine-reporters');
const { SpecReporter } = require('jasmine-spec-reporter');

/**
 * @type { import("protractor").Config }
 */
exports.config = {
    allScriptsTimeout: 11000,
    specs: [
        './src/**/*.e2e-spec.ts'
    ],
    capabilities: {
        browserName: 'firefox',
        marionette: true,
        firefoxOptions: {
            args: ['--headless']
        },
        'moz:firefoxOptions': {
            args: ['--headless']
        }
    },
    directConnect: true,
    baseUrl: 'http://localhost:4200/',
    framework: 'jasmine',
    jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: 30000,
        print: function () { }
    },
    onPrepare() {
        require('ts-node').register({
            project: require('path').join(__dirname, './tsconfig.json')
        });
        jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
        var junitreporter = new JUnitXmlReporter({
            savePath: require('path').join(__dirname, '../tests/e2e'),
            consolidateAll: true
        });
        jasmine.getEnv().addReporter(junitreporter);
    }
};
like image 589
Zachary Bryant Avatar asked Sep 24 '19 23:09

Zachary Bryant


1 Answers

I do have the same problem and for me it results from the afterEach function generated by ng cli: afterEach(async () => { // Assert that there are no errors emitted from the browser const logs = await browser.manage().logs().get(logging.Type.BROWSER); expect(logs).not.toContain(jasmine.objectContaining({ level: logging.Level.SEVERE, } as logging.Entry)); }); When you delete this, everythings is fine. Seems that the selenium driver for firefox is not able to ask the browser for the console logs.

like image 150
Martin Roob Avatar answered Nov 15 '22 10:11

Martin Roob