mmisty / cypress-allure-adapter

Apache License 2.0
23 stars 7 forks source link

Missing long assertion messages for steps (assert) #34

Closed MDzyga closed 1 year ago

MDzyga commented 1 year ago

Hello @mmisty :) We noticed that sometimes assert is empty in Allure. Do you know why it can happen? I'm not sure where is an issue. We're using the latest verion of allure plugin for jenkins and cypress in version 13.0.0. image

1st issue - marked expect with custom message is missing image image

The 2nd issue - it's more strange - in this case all marked asserts disappeared image image

mmisty commented 1 year ago

Hi @MDzyga,

Thank you for reporting that. I noticed that in reports earlier, but I could not reproduce.

Could you please provide whole test that reproduces the problem, also screenshot of cypress command log with that assertions (or even better video of running test).

Thank you

MDzyga commented 1 year ago

AdaptersService:

export class AdaptersService {
  readonly URL: string = `${Global.API_URL}${Endpoints.ADAPTERS}`;

  getAll(): Cypress.Chainable<Cypress.Response<IAdapter[]>> {
    return cy.request<IAdapter[]>({
      method: Methods.GET,
      url: this.URL,
    });
  };
}

1st issue:

it('Get All Adapters', () => {
        const assertions: IAdapter[] = [
          {
            name: "CSV",
            modes: [LimsMode.Download],
          },
          {
            name: "HL7 2.5.1",
            modes: [LimsMode.Broadcast, LimsMode.Query],
          },
          {
            name: "XML",
            modes: [LimsMode.Download],
          },
        ];

        service
          .getAll()
          .then((response: Cypress.Response<IAdapter[]>) => {
            expect(response.status, "Response status").to.equal(200);

            assertions.forEach((expectedAdapter: IAdapter) => {
              const adapter: IAdapter = response.body.find((item: IAdapter) => item.name === expectedAdapter.name);

              expect(adapter, `Adapter with name: ${expectedAdapter.name} exist`).to.exist;

              expectedAdapter.modes.forEach((expectedMode: string) => {
                const mode: string = adapter.modes.find((item: string) => item === expectedMode);
                expect(mode, `Mode: ${mode} found in adapter: ${expectedAdapter.name}`).to.exist;
              });
            });
          });
      });

2nd issue:

it('Adapters versioning', () => {
        const assertionsDuplicated: IAdapter[] = [
          {
            name: "Qiagen.CI.LIMSconnector.Adapters.CSV.v1",
            message: "Duplicated",
            modes: [],
          },
          {
            name: "Qiagen.CI.LIMSconnector.Adapters.HL7_2_5_1.v1",
            message: "Duplicated",
            modes: [],
          },
          {
            name: "Qiagen.CI.LIMSconnector.Adapters.XML.v1",
            message: "Duplicated",
            modes: [],
          },
        ];

        const assertionsIncompatible: IAdapter[] = [
          {
            name: "Qiagen.CI.LIMSconnector.Adapters.CSV.v0",
            message: "Incompatible with current version",
            modes: [],
          }, {
            name: "Qiagen.CI.LIMSconnector.Adapters.HL7_2.5.1.v0",
            message: "Incompatible with current version",
            modes: [],
          }, {
            name: "Qiagen.CI.LIMSconnector.Adapters.XML.v0",
            message: "Incompatible with current version",
            modes: [],
          },
        ];

        service
          .getAll()
          .then((response: Cypress.Response<IAdapter[]>) => {
            expect(response.status, "Response status").to.equal(200);
            expect(response.body.length, "Number of available adapters").to.equal(9);

            assertionsIncompatible.forEach((expectedAdapter: IAdapter) => {
              const adapter: IAdapter = response.body.find((item: IAdapter) => item.name === expectedAdapter.name);

              expect(adapter, `Adapter with name ${expectedAdapter.name} exist`).to.exist;
              expect(adapter.message, `Message error for adapter with name ${expectedAdapter.name}`).to.equal(expectedAdapter.message);
            });

            assertionsDuplicated.forEach((expectedAdapter: IAdapter) => {
              const adapter: IAdapter = response.body.find((item: IAdapter) => item.name === expectedAdapter.name);

              expect(adapter, `Adapter with name ${expectedAdapter.name} exist`).to.exist;
              expect(adapter.message, `Message error for adapter with name ${expectedAdapter.name}`).to.equal(expectedAdapter.message);
            });
          });
      });
    });

allure-results.zip https://github.com/mmisty/cypress-allure-adapter/assets/38663990/77a6102d-88d8-4e6b-a8a6-89e0f3023562

Let me know if you need something more

MDzyga commented 1 year ago

Screenshots image image image

mmisty commented 1 year ago

@MDzyga, thank you for provided artifacts. I still could not reproduce, but I tried to fix that in version 0.10.6. Could you please check and confirm whether the issue still exist or not. Thank you

mmisty commented 1 year ago

@MDzyga sorry, I found steps, 0.10.6 doesn't fix that. I will try to do fix tomorrow

mmisty commented 1 year ago

@MDzyga issue was fixed in 0.10.7 version. Could you please try. Thanks.

MDzyga commented 1 year ago

Confirm :) Thank you :)

jprealini commented 11 months ago

@MDzyga wonder if you could share the basic configuration for allowing the adapter to generate results and the report in Jenkins... I just posted an issue where I am running the jenkins job, but there are no results generated in the allure-results folder... Thanks