admiralfeb
admiralfeb

Reputation: 153

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);
    }
};

Upvotes: 8

Views: 1993

Answers (1)

Martin Roob
Martin Roob

Reputation: 266

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.

Upvotes: 7

Related Questions