Closed (fixed)
Project:
Drupal.org BDD
Version:
7.x-1.x-dev
Component:
Feature/Scenarios
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
27 Jul 2012 at 12:03 UTC
Updated:
18 Jul 2013 at 16:49 UTC
Jump to comment: Most recent file
Comments
Comment #1
pradeeprkara commentedAs 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.
Comment #2
eliza411 commentedWe 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 textwhich lets us run the test repeatedGiven /^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 ais nowI am logged in asand may need adjustment accordingly.Comment #3
pradeeprkara commentedModified 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.
Comment #5
pradeeprkara commentedRemoved the duplicate methods and updated Given that I am on the home page step.
Comment #6
halstead commentedJust a few suggestions. Also these functions could probably be made cleaner using http://docs.behat.org/guides/2.definitions.html#step-execution-chaining.
Throw an exception here if the files_path isn't set explaining how to correct the error.
Tab characters should be removed.
Does this need a custom function? Can it be filled out using the predefined mink statements?
Comment #7
pradeeprkara commentedProbably 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.
Comment #8
pradeeprkara commentedCorrected the tab issue in the first line of uploadMultipleFiles()
Comment #9
eliza411 commentedThis 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.
This should read When I follow ...
Again, this should be part of the When steps, and so should say And I follow.
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.
This is the first "Then" step. As a then step, it might read more naturally as Then the project should be created.
Comment #10
pradeeprkara commentedtagging for sprint 4
Comment #11
pradeeprkara commentedCorrected 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.
Comment #12
eliza411 commentedThis 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.
Comment #13
pradeeprkara commentedAs 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
Comment #14
eliza411 commentedNot sure how I missed the feature block the first time. We need some kind of actual business value for these:
Should be more like:
I'll have a checklist ready for tomorrow, and we should be able to spot these all in one sitting.
Comment #15
eliza411 commentedGit user can only create a sandbox. We should distinguish carefully which of these is intended in the feature and/or scenario descriptions.
Comment #16
pradeeprkara commentedIncorporated 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
Comment #17
eliza411 commentedI'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?
Comment #18
pradeeprkara commentedPls take the latest feature commit:
http://drupalcode.org/project/doobie.git/blob/eb013ff:/features/project/create_project.feature
Comment #19
eliza411 commentedUpdated the feature to match the scenarios: http://drupalcode.org/project/doobie.git/commit/15f9308
Ready for code review.
Comment #20
jhedstromI'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).Comment #21
pradeeprkara commentedif 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
Comment #22
pradeeprkara commentedtagging
Comment #23
jhedstromOk, 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_SEPARATORinstead of having to check for the OS that is running.Comment #24
jhedstromMerged to master.
Comment #26
kssundar commentedNeed 7.x update
Comment #27
kssundar commentedModified 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
Comment #28
pradeeprkara commented7.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:
7.x commit: http://drupalcode.org/project/doobie.git/commit/95d49ed
Comment #29
eliza411 commentedThis looks great, thank you!
Comment #30
eliza411 commented