Comments

pradeeprkara’s picture

Status: Active » Needs review
StatusFileSize
new11.95 KB

As Multiple up-loader requires javascript, selenium is required for running this feature.

The multiple upload feature can be reused for any view:
The step definition is function iUpdloadTheFollowingFiles($type, TableNode $table)

Usage:
When I updload the following "project image"
| files | description | alt text |
| D:\Users\pradem\Desktop\logo\capgemini_logo\logo_3.jpg | Desert pic | Desert |
| D:\Users\pradem\Desktop\logo\capgemini_logo\logo_2.jpg | Hydrangeas pic | Hydrangeas |
| D:\Users\pradem\Desktop\logo\capgemini_logo\logo_1.jpg | Koala pic | Koala |

Where
files: local files
description and alt text: the fields to be filled in once upload is finished. If more fields are there, can be included here one after another.
"project image" : image uploader on Create Project page.
Now it is written for "Create Project" and "Create Case Study" multiple up-loaders
The switch can be modified to consider for other pages if any.

Attached the patch here.

eliza411’s picture

Assigned: Unassigned » halstead
Status: Needs review » Needs work

We dug through documentation and found that you can set the file path as a parameter, but it must be a full path.

This needs some adjustment to use new steps:

You can now say:
When I fill in "Field" with random text which lets us run the test repeated

Given /^I updload the following "([^"]*)" <files>
needs some work. The spelling (upload) needs correction, but halstead has some suggestions, too, which have not yet been written.

Finally,
I am logged in as a is now I am logged in as and may need adjustment accordingly.

pradeeprkara’s picture

Status: Needs work » Needs review
StatusFileSize
new9.2 KB

Modified with random string step, As some of the fields need some data in a specific pattern(eg: url), its done for project Title only, This will enable us to run the test repeated.

Updated I am logged in step

Modified iUploadTheFollowingFiles() step definition by reading the files_path from .yml file(as mink-extension files_path didn't work as expected)

Attached the patch here.

pradeeprkara’s picture

Removed the duplicate methods and updated Given that I am on the home page step.

halstead’s picture

Assigned: halstead » Unassigned
Status: Needs review » Needs work

Just a few suggestions. Also these functions could probably be made cleaner using http://docs.behat.org/guides/2.definitions.html#step-execution-chaining.

+++ b/features/bootstrap/FeatureContext.php
@@ -98,6 +101,9 @@ class FeatureContext extends MinkContext {
+    if (isset($parameters['files_path'])) {
+      $this->file_path = $parameters['files_path'];
+    }

Throw an exception here if the files_path isn't set explaining how to correct the error.

+++ b/features/bootstrap/FeatureContext.php
@@ -1643,4 +1649,146 @@ class FeatureContext extends MinkContext {
+        $filefield_id 	= 'edit-field-project-images-{index}-upload';
+        // upload button id
+        $uploadbutton_id 	= 'edit-field-project-images-{index}-filefield-upload';
+        // upload response id
+        $responsebox_id	= 'edit-field-project-images-{index}-data-description';
+        // upload set wrapper
+        $wrapperbox_id 	= 'edit-field-project-images-{index}-ahah-wrapper';
+        // parameters to be filled in after upload finishes
+        $arr_postupload_params = array(
+          // in description
+          'description' => 'edit-field-project-images-{index}-data-description',
+          // al tag
+          'alt text' => 'edit-field-project-images-{index}-data-alt',
+        );
+        break;
+      // for Create Case Study image upload
+      case 'case study image':
+        $addmore_id = 'edit-field-images-field-images-add-more';
+        // upload field id
+        $filefield_id 	= 'edit-field-images-{index}-upload';
+        // upload button id
+        $uploadbutton_id 	= 'edit-field-images-{index}-filefield-upload';
+        // upload response id
+        $responsebox_id	= 'edit-field-images-{index}-data-description';
+        // upload set wrapper
+        $wrapperbox_id 	= 'edit-field-images-{index}-ahah-wrapper';

Tab characters should be removed.

+++ b/features/bootstrap/FeatureContext.php
@@ -1643,4 +1649,146 @@ class FeatureContext extends MinkContext {
+  public function iFillInProjectDescriptionWith($description)
+  {
+    $this->getSession()->getPage()->findById('edit-body')->setValue($description);
+  }

Does this need a custom function? Can it be filled out using the predefined mink statements?

pradeeprkara’s picture

Status: Needs work » Needs review
StatusFileSize
new8.81 KB

Just a few suggestions. Also these functions could probably be made cleaner using

Probably this will be useful when we reuse the same definition for some other page, this is what halstead means by that I think. I have moved the upload functionality to a private function now.

Inside the file upload function, it is already written to throw exception in that case, modified it throw exception if the file doesn't exist.

Modified the Description: field to have random texts.

Also after the db refresh, file upload at git6site has stopped working and 2 files are missed.
Reported it here: #1722182: Some test files missing from files/ directory, #1722170: File upload fails at http://git6site.devdrupal.org and once they are fixed, this can be reviewed.

Attached the patch here.

pradeeprkara’s picture

Corrected the tab issue in the first line of uploadMultipleFiles()

eliza411’s picture

Status: Needs review » Needs work

This is regarding the feature file only, just a few changes. The structure seems basically solid but the labeling of the steps is not quite accurate.

+++ b/features/project/create_project.feature
@@ -0,0 +1,38 @@
+    Then I follow "Your Dashboard"
...
+    Then I should see the heading "Create Project"

This should read When I follow ...

+++ b/features/project/create_project.feature
@@ -0,0 +1,38 @@
+    Then I follow "Your Dashboard"
...
+    Then I follow "Project resources"

Again, this should be part of the When steps, and so should say And I follow.

+++ b/features/project/create_project.feature
@@ -0,0 +1,38 @@
+    Then I should see the heading "Create Project"

This should be deleted unless there's a critical reason for its presence here, such as if the next step can be accomplished even on a resulting page that doesn't have the Create project heading.

Each feature file really should have just one Given, one When, and one Then section.

+++ b/features/project/create_project.feature
@@ -0,0 +1,38 @@
+    And I check the project is created

This is the first "Then" step. As a then step, it might read more naturally as Then the project should be created.

pradeeprkara’s picture

Issue tags: +sprint 4

tagging for sprint 4

pradeeprkara’s picture

Status: Needs work » Needs review
StatusFileSize
new8.68 KB

Corrected as per the comments.

Created a a new patch. Tested in local

Please make sure you have configured files_path in .yml file and files exist in files directory with proper names.

eliza411’s picture

Status: Needs review » Needs work

This looks good and right, but can you tab out the tables (or convince me it's not worth it)? It helps a lot with future readability.

pradeeprkara’s picture

Assigned: Unassigned » pradeeprkara
Status: Needs work » Needs review
Issue tags: +sprint 5

As there are multiple columns, tabbing out the tables will definitely make it more readable.

Changed as below. Once confirmed, will roll out a patch.

Commit link: http://drupalcode.org/project/doobie.git/commit/3be16ef

eliza411’s picture

Status: Needs review » Needs work

Not sure how I missed the feature block the first time. We need some kind of actual business value for these:

Feature:
  In order to test the functionalities of Create Project
  As an Authenticated User
  I should be able to Create a Project

Should be more like:

Feature: Create a project
   In order to share my code with the community
   As a git vetted user
   I need to be able to create a project

I'll have a checklist ready for tomorrow, and we should be able to spot these all in one sitting.

eliza411’s picture

Git user can only create a sandbox. We should distinguish carefully which of these is intended in the feature and/or scenario descriptions.

pradeeprkara’s picture

Assigned: sdboyer » pradeeprkara

Incorporated the scenarios for #1706958: Create project form here.

As there are multiple scenarios now, any changes would be required for feature block?

Please review the commit at eb013ff

eliza411’s picture

Assigned: pradeeprkara » sdboyer
Status: Needs work » Needs review

I'd like some feedback from @sdboyer on this one. Normally a feature calls out a single system actor and all the scenarios revolve around that one user. There are definite exceptions to this, though, and checking a matrix of permissions for a feature seems like one of them.

In such a case, the feature file probably shouldn't be naming a particular Drupal role. I think a human role like as a contributor ... I suppose that's where you were headed with "authenticated user" although that implies *any* auth user, which isn't the case either.

http://drupalcode.org/project/doobie.git/blob/f362d2f:/features/project/...

Thoughts?

pradeeprkara’s picture

eliza411’s picture

Component: Feature/Scenarios » Step definitions

Updated the feature to match the scenarios: http://drupalcode.org/project/doobie.git/commit/15f9308

Ready for code review.

jhedstrom’s picture

Category: support » task
Status: Needs review » Needs work

I'm seeing failures on a few scenarios in create_project.feature. Code for the step definitions looks good (I pushed a few tweaks to standards, plus added an exception where a radio button was occasionally not being found to avoid a fatal error).

pradeeprkara’s picture

Status: Needs work » Needs review

if you don't set the files_path in .yml file you will get an error, Also if git6site is slow, it might not reach the create project node. Modified the step to directly load the page. This will be faster as well.

Also I have removed the FALSE from the statement to fetch radio element, which I think you have put for testing purpose.

Please see the updates here: 44ff5dd

pradeeprkara’s picture

Issue tags: +sprint 6

tagging

jhedstrom’s picture

Status: Needs review » Reviewed & tested by the community

Ok, I committed a bit of cleanup that removes the need to specify a file path in the yml directory. It also makes use of the constant DIRECTORY_SEPARATOR instead of having to check for the OS that is running.

jhedstrom’s picture

Status: Reviewed & tested by the community » Fixed

Merged to master.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

kssundar’s picture

Version: » 7.x-1.x-dev
Component: Step definitions » Feature/Scenarios
Assigned: sdboyer » kssundar
Status: Closed (fixed) » Patch (to be ported)
Issue tags: +sprint 18

Need 7.x update

kssundar’s picture

Modified step in 6.x to match existing definition. Committed 6.x here - http://drupalcode.org/project/doobie.git/commit/395f5be

But, still needs 7.x update

pradeeprkara’s picture

Status: Patch (to be ported) » Needs review

7.x version has a lot of changes as Create project form structure varies depending on the type.

Also merged some of the scenarios.

1st and last scenarios fail due to git7site issues.
Especially in the last scenario, there are a couple of label - field mapping issues for the below fields:

    And I fill in the following:
    | Screenshots    | screenshots...                       |
    | License        | license...                           |
    | Documentation  | docs here                            |
    | Demo           | http://mytestsite.com/demo           |
    | Changelog      | http://mytestsite.com/changelog.txt  |
    | Homepage       | http://mytestsite.com                |

7.x commit: http://drupalcode.org/project/doobie.git/commit/95d49ed

eliza411’s picture

Status: Needs review » Reviewed & tested by the community

This looks great, thank you!

eliza411’s picture

Status: Reviewed & tested by the community » Closed (fixed)