I am using a protractor and ECMAScript 6 to develop end to end tests. But when the test is finished I see the error:
Message:
Error: Timeout - Async callback was not invoked within the timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
I tried all solutions that I find on the StackOverflow and GitHub. For example, an add jasmineNodsOption to the config file, add parameters done to the test function, add timeouts to the functions nothing help.
test.js
import { doubleClick, isDisplayed, waitToBeVisible } from '../page_objects/base_page';
import HairLossPage from '../page_objects/HairLossPage';
import CartComponent from '../page_objects/components/CartComponent';
/*global expect describe beforeAll it browser*/
describe('Hair-loss. Question pages', () => {
const heirLoss = new HairLossPage();
const cartComponent = new CartComponent();
beforeAll(() => {
browser.waitForAngularEnabled(false);
heirLoss.get();
});
it('Check the "CheckOut" button in the mini-cart with product', () => {
doubleClick(heirLoss.header.card);
waitToBeVisible(cartComponent.header.title);
expect(isDisplayed(cartComponent.header.title)).toBe(true);
expect(isDisplayed(cartComponent.content.shopHair)).toBe(true);
expect(isDisplayed(cartComponent.content.shopEd)).toBe(true);
expect(isDisplayed(cartComponent.content.shopSkin)).toBe(true);
expect(isDisplayed(cartComponent.content.shopDailyHealt)).toBe(true);
});
});
config.js
require("@babel/register");
require("protractor");
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['./src/tests/**.e2e.js'],
multiCapabilities: [{
browserName: 'chrome'
}],
//Global configuration
baseUrl: 'https:/facebook.com/',
//Allure configuration
/*global jasmine browser allure*/
onPrepare: () => {
browser.manage().window().maximize();
var AllureReporter = require('jasmine-allure-reporter');
jasmine.getEnv().addReporter(new AllureReporter());
jasmine.getEnv().afterEach((done) => {
if (done.status === "failed") {
browser.takeScreenshot().then((png) => {
allure.createAttachment('Screenshot', () => new Buffer(png, 'base64'), 'image/png')();
done();
});
}
});
}
};