0

我有一个场景,我需要传递一个随机的 getSimpleRandomName(textType) 文本需要在 Feature 文件中可用。我能够为场景 1 获取附加到自动化人员的随机文本。如何使相同的文本可用于我的其余场景?

import { Then, When, And } from "cypress-cucumber-preprocessor/steps";

Then("I type unique {string} in {string} field", (textType, textboxname) => {
  cy.getSimpleRandomName(textType).then(($value) => {
    cy.get("#content_container")
      .parent()
      .type($value);
  });
});


Feature: Create, Update
 
Background: 
  Given I open the build URL
  When I logged in as user "qa.team" 

Scenario: Create a new person
When I click on the left menu "People" > "Create New" > "Person"
And I should see "Person / New Person" page
And I type unique "Automation Person" in "* Person Name" field
Then I should see "Testing Automation Person-RedQwE" in the results table 

Scenario: Update existing person
When I click on the left menu "People" > "Open" > "Person"
And I should see "Person" page
And I type "Testing Automation Person-???" in search field  // how can I get the same text here ?
4

0 回答 0