Goal

Create new tests for search and view services. Understand how to:

  • Add a file to a common repository
  • Upload multiple files
  • Add repeaters

Starting code

Start tag: lesson/10-testing-only

Steps

Now we are in lesson 5 new functionality is added on the screen. We are going to discover Document upload and Repeaters

Scenario description

We are going to create 2 scenarios for this lesson

  • Scenario: Login as Internal User, Select Registrar option and Upload the 3 files
  • Scenario: Login as Internal User, Select Registrar option and add a Secret identity via repeater

The first scenario will be created in H005 folder with name UploadFiles.feature and the second RepeaterTesting.feature

Upload files

As we mention earlier the file name for the first scenario will be UploadFiles and we are going to include the scenario description below
Scenario Description: The scenario name must be short and descriptive of what needs to be achieved.
Scenario: Login as Internal User, Select Registrar option and Upload the 3 files
Actions: We are going to concentrate on submit a form with 3 upload files using the step below: I upload file <file> to <label>
Before start the test we want to add a new pdf file to the project. To do this we are going to use the file located test.pdf. The steps to add a new resource is:
  1. Right click over common folder > New > Resource
2. Select Markdown file and set as a path /tests/hercules/resources/uploads add as a name resources
3. Inside of the file created we are going to add some documentation
# Repository for test files
* PDF
* JPEG 

The files described above are the only types accepted by the application
Once the text is entered on md file and click on the icon documentation will show something like this.
Now with the folder added we can move our file in.
4. Right click over the folder file and select copy path
5. Open any available file explorer on your Operating system and copy the pdf file inside the directory. The test file can be download from here:
6. Now the file should show inside of Magellan right click over the file and copy the relative path
Because the file is ignored we cannot get the path. For this, we need to copy the path of resources.md and replace the test with the path/test.pdf and remove the resource.md filename

Upload the file

Now we have the relative path we can use the pdf file to upload. For example the relative path on the step will look like:
And I upload file common/tests/hercules/resources/uploads/test.pdf to Supporting documents 
Please note this test used a login for internal user.
  Scenario: Login as Internal User, Select Registrar option and Upload the 3 files
    Given I set application to heroes
    Then I logon as sysadmin@fostermoore.com with password Registry01
      And I click menu Online Services
      And I click menu Register a Super Hero
    Then I select radio button The registrar in radio button group Who is this application on behalf of?
      And I upload file common/tests/hercules/resources/uploads/test.pdf to Supporting documents
      And I upload file common/tests/hercules/resources/uploads/test.pdf to Supporting documents
      And I upload file common/tests/hercules/resources/uploads/test.pdf to Supporting documents
In the screen 3 uploaded files will show up

Repeaters

Basically a repeater gives users ability to add, edit or delete multiple records of the same type where each individual record has multiple input fields, for example directors with names, dates and addresses. The repeater on super heroes is type Inline repeater
Our scenario will be created under H005/RepeaterTesting
Scenario Description: The scenario name must be short and descriptive of what needs to be achieved.
 Scenario: Login as Internal User, Select Registrar option and add a Secret identity via repeater
Actions: We are going to concentrate on add 1 repeater with the details for that repeater I click button <repeater name>
To open the repeater we are going to use When I click button Add Secret Identity
  Scenario: Login as Internal User, Select Registrar option and add a Secret identity
    Given I set application to heroes
    Then I logon as sysadmin@fostermoore.com with password Registry01
      And I click menu Online Services
      And I click menu Register a Super Hero
    Then I select radio button The registrar in radio button group Who is this application on behalf of?
      And I enter text VerneMax in Super Hero Name
     When I click button Add Secret Identity
    Then I enter text Clark in Secret Identity > First name
      And I enter text Test in Secret Identity > Middle name(s)
      And I enter text Verne in Secret Identity > Last name

The screen will look like the following screenshot after complete the fields for Repeater

Recap

In this lessons we discover a few things:

  • How to add files to our common repository
  • Documented the files inside the common repository using .md files (md = Metadata files)
  • How to test uploading a document
  • Add a record to a repeater by clicking Add Secret Identity button.
0
0

Jump to Section