0

I have this test e2e in protractor:

describe('My App', () => {
 beforeEach(() => {
   // browser.waitForAngularEnabled(false);
 });
 let page: AppPage;
 it('Debe Crear una nueva especie', () => {
   page = new AppPage();
   page.navigateTo().then(() => {
     // if (!browser.waitForAngularEnabled()) { browser.waitForAngularEnabled(true); } 
    });
    page.getLinkEspecies().click().then(() => {
      console.log("HIZO CLICK")
      //Presiona boton 'Nueva Especie'
      page.getButtonNuevaEspecie().click();
      // browser.sleep(1000)
      //Setear categoria, especie y modelo
      page.getOptionCategoria().click();
      // browser.sleep(1000)
      page.getOptionTipoEspecie().click();
      // browser.sleep(1000)
      page.getOptionEspecieComoModelo().click();
      // browser.sleep(1000)
      //Presiona boton 'Continuar'
      page.getButtonContinuar().click();
      // browser.sleep(1000)
      //Presiona boton 'Guardar especie'
      page.getButtonGuardarEspecie().click().then(
        () => {
          browser.wait(page.getAlertMessage().isPresent(), 20000, "FALLO").then(
            () => {
              // browser.sleep(2000)
              page.getAlertMessage().getText().then(
                (texto: string) => {
                  expect(texto).toEqual('Se creo correctamente')
                }
              )
            }
          );
          expect(browser.getCurrentUrl()).toMatch('/#/especies');
        }
      );
    });
  });

});

My conf of protractor is:

exports.config = {
  allScriptsTimeout: 300000,
  seleniumServerStartTimeout: 0,
  specs: [
    './e2e/**/*.e2e-spec.ts'
  ],
  capabilities: {
    'browserName': "chrome",
    // this takes seconds so 120 would be 120 seconds.
    // 'idleTimeout': '10'
  },
  directConnect: true,
  baseUrl: 'http://localhost:4200/',
  framework: 'jasmine',
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 300000,
    print: function() {}
  },
  // SELENIUM_PROMISE_MANAGER: false,
  onPrepare() {
    require('ts-node').register({
      project: 'e2e/tsconfig.e2e.json'
    });
    jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
    browser.manage().window().setSize(1600, 1000);
    // browser.waitForAngularEnabled(false);
  }
};

WellI have two settings to run the test. One is emulated and the other not emulated. With the emulated the requests are made locally, with the non-emulated they are made to the backend In the emulated context the test take around 90 second to start. Browser is up, show me the home page but start to do it the test 90 second past to start. In the non-emulated context the test take more time for each time to request the backend. This is when start:

here it stop to wait until start the process

And past 90 seconds resolve it in 15 seconds:

finish process

In the non-emulated context, time is greater. But the test ends successfully as well

  • If I understood correctly, you say tests which actually request real backend take longer than others. It seems like the cause of this is the network. If that's the case, you can't do much then, except to bundle requests up for minimizing overhead. But I am not experienced in that context. Anyways, You should measure time which requests itself take. So you can compare emulated and real environment. Again, I don't know if I understood you clearly. The latest lines of the questions are not very clear for me. – Silvan Bregy Oct 10 '18 at 19:58
  • Yes, it's the real backend. The real backend takes as long as it is taking you to the test. There is a lot of time difference with the same request. Also at the beginning of the emulation mode I have the same problem. – Bruno Méndez Oct 10 '18 at 20:45

0 Answers0