I'm new to automation, and I'm running a very basic test, which was running fine, but just recently it stopped working and I keep receiving the following error :
Failed: script timeout: result was not received in 11 seconds
I looked it up and did some basic debugging and found out that Protractor is not finding the element I'm referring (element(by.id('mat-input-0')) - more below in spec.js code file).
I'm using the latest version of Protractor (5.4.2), along with Jasmine last version (3.4.0). I'm testing on the latest chrome browser.
I tried many online solutions (like using async/await, adding long allScriptsTimeout and defaultTimeoutInterval in the config file (as shown below), calling the element using different locators (by xpath, by id, by tagName,...), trying browser.waitForAngular(); or browser.ignoreSynchronization = true,...) but none worked, so I'm wondering if anyone has any input on what might be the solution? (or maybe what is the real problem?)
Element HTML
<input _ngcontent-mkt-c2="" class="mat-input-element mat-form-field-autofill-control cdk-text-field-autofill-monitored ng-pristine ng-invalid ng-touched" formcontrolname="email" matinput="" name="email" placeholder="Email" required="" type="text" id="mat-input-0" aria-invalid="true" aria-required="true">
Spec.js:
describe('Login', function(){
    it('test 1', async function(){
        await browser.get('the STG URL im testing');
    })
    it('set username', async function(){
        await element(by.id('mat-input-0')).sendKeys('root@user.com');
    })
    it('set password', async function(){
        await element(by.id('mat-input-1')).sendKeys('1234');
    })
})
Conf.js:
exports.config = {  
    seleniumAddress: 'http://localhost:4444/wd/hub',
    allScriptsTimeout: 80000,
    framework: 'jasmine',
    specs: ['spec.js'],
    SELENIUM_PROMISE_MANAGER: false,
    jasmineNodeOpts: {
      defaultTimeoutInterval: 50000
    }
  };