我的功能文件目前的编写方式如下:
Feature: Running Cucumber with Protractor
Scenario Outline: Check logging in page
Given I go on "/login"
Then the title should equal <pageTitle>
Examples:
|pageTitle |
|Case Management|
@refresh
Scenario Outline: Check logging in as any user
Given I go on "/login"
When I enter <username> into the username field
And I enter <password> into the password field
And I click sign in
Then I should arrive on the "/landing" page
Examples:
|username |password |
|user1 |pass |
|user2 |pass |
Scenario Outline: User1 should be able to see all the Subtypes listed in this table
Given I am on the "/landing" page
When I open the Menu
And I click New
And I enter a Title
And I choose the Type <type>
Then I should see the Subtypes <subtype>
Examples:
|type |subtype |
|Case |blah blah File |
|Case |blah blah File 2 |
|Case |blah blah File 3 |
|Case |blah blah File 4 |
Scenario Outline: User2 should be able to see all the Subtypes listed in this table
Given I am on the "/landing" page
When I open the Menu
And I click New
And I enter a Title
And I choose the Type <type>
Then I should see the Subtypes <subtype>
Examples:
|type |subtype |
|Case |blah blah File |
|Case |blah blah File 2 |
Scenario Outline: User2 should not be able to see the Subtypes listed in this table
Given I am on the "/landing" page
When I open the Menu
And I click New
And I enter a Title
And I choose the Type <type>
Then I should see the Subtypes <subtype>
Examples:
|type |subtype |
|Case |blah blah File 3 |
|Case |blah blah File 4 |
如何添加标记钩子以便只能执行相对于用户的场景。
我想我会在登录Scenario时添加@ user1,@ user2标签,然后将@ user1标签添加到User1场景,将@ user2标签添加到User2场景。
但是我需要编写什么javaScript来使测试流程如此:
也许我完全错了,需要为每个用户提供不同的功能文件?
任何建议都会很棒。