Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix stepFn use this.parameter('xx', 'xx') do not work。 #914

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

mind029
Copy link
Contributor

@mind029 mind029 commented Mar 21, 2024

This PR contains the following updates:

  • Enable the attach method in the AllureCommandSteps class to support passing custom names.
  • Fix the issue in the step function of the AllureCommandSteps class where calling this.parameters('xx', 'xxx') doesn't take effect.

How to reproduce

example code

describe("page1", () => {
  test("test1", async () => {
    await allure.step('s1', async (s1) => {
      await s1.step('s1_1', async (s1_1) => {
        // this do not work
        s1_1.parameter('123', 's1_1')
        expect(1).toEqual(1)
      })

      expect(1).toEqual(1)
    })

    expect(1).toEqual(1)
  })
})

After running the test code, the output JSON result is as follows:

You can see that the content of s1_1.parameter is empty. It's expected to have data.

expect:

{
  "uuid": "c891d5db-7e97-4c9d-8467-f56e075a99cf",
  "historyId": "5d5234ef12c604daeee410751924bbf2:d41d8cd98f00b204e9800998ecf8427e",
  "status": "passed",
  "statusDetails": {},
  "stage": "finished",
  "steps": [
    {
      "name": "s1",
      "start": 1711010566264,
      "stop": 1711010566265,
      "stage": "finished",
      "status": "passed",
      "statusDetails": {},
      "attachments": [],
      "parameters": [],
      "steps": [
        {
          "name": "s1_1",
          "start": 1711010566264,
          "stop": 1711010566265,
          "stage": "finished",
          "status": "passed",
          "statusDetails": {},
          "attachments": [],
          "parameters": [
            {
              "name": "123",
              "value": "\"s1_1\"",
              "excluded": false
            }
          ],
          "steps": [],
          "description": ""
        }
      ],
      "description": ""
    }
  ],
  "attachments": [],
  "parameters": [],
  "labels": [
    {
      "name": "language",
      "value": "javascript"
    },
    {
      "name": "framework",
      "value": "jest"
    },
    {
      "name": "package",
      "value": "tests"
    },
    {
      "name": "thread",
      "value": "1"
    },
    {
      "name": "host",
      "value": "wang"
    },
    {
      "name": "parentSuite",
      "value": "page1"
    }
  ],
  "links": [],
  "start": 1711010566262,
  "name": "test1",
  "fullName": "page1 test1",
  "stop": 1711010566267
}

now:

{
  "uuid": "c891d5db-7e97-4c9d-8467-f56e075a99cf",
  "historyId": "5d5234ef12c604daeee410751924bbf2:d41d8cd98f00b204e9800998ecf8427e",
  "status": "passed",
  "statusDetails": {},
  "stage": "finished",
  "steps": [
    {
      "name": "s1",
      "start": 1711010566264,
      "stop": 1711010566265,
      "stage": "finished",
      "status": "passed",
      "statusDetails": {},
      "attachments": [],
      "parameters": [],
      "steps": [
        {
          "name": "s1_1",
          "start": 1711010566264,
          "stop": 1711010566265,
          "stage": "finished",
          "status": "passed",
          "statusDetails": {},
          "attachments": [],
          "parameters": [
         
          ],
          "steps": [],
          "description": ""
        }
      ],
      "description": ""
    }
  ],
  "attachments": [],
  "parameters": [],
  "labels": [
    {
      "name": "language",
      "value": "javascript"
    },
    {
      "name": "framework",
      "value": "jest"
    },
    {
      "name": "package",
      "value": "tests"
    },
    {
      "name": "thread",
      "value": "1"
    },
    {
      "name": "host",
      "value": "wang"
    },
    {
      "name": "parentSuite",
      "value": "page1"
    }
  ],
  "links": [],
  "start": 1711010566262,
  "name": "test1",
  "fullName": "page1 test1",
  "stop": 1711010566267
}

before:

image

The effect after fixing it is shown in the image:

image

@CLAassistant
Copy link

CLAassistant commented Mar 21, 2024

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the theme:api Javascript API related issue label Mar 21, 2024
@baev baev requested a review from epszaw March 21, 2024 11:25
@epszaw epszaw added the type:bug Something isn't working label Mar 21, 2024
Copy link
Member

@epszaw epszaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix! Could you run yarn prettier:format && yarn lint:fix locally, to fix the failed job before we continue?

@mind029 mind029 force-pushed the fix/allureCommandSteps-mind branch from 65d1316 to 4231f5b Compare March 21, 2024 15:42
@mind029
Copy link
Contributor Author

mind029 commented Mar 21, 2024

Thank you for the fix! Could you run yarn prettier:format && yarn lint:fix locally, to fix the failed job before we continue?

i fix it,you can continue。@epszaw

@epszaw epszaw merged commit 571389b into allure-framework:main Mar 25, 2024
8 checks passed
@epszaw
Copy link
Member

epszaw commented Mar 25, 2024

Good job, @mind029! Thank you for the contribution!

@mind029 mind029 deleted the fix/allureCommandSteps-mind branch March 26, 2024 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme:api Javascript API related issue type:bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants