Closed (fixed)
Project:
Paragraphs
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
23 Feb 2017 at 13:21 UTC
Updated:
18 Jul 2017 at 14:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
drobnjak commentedWill work on this.
Comment #3
drobnjak commentedDuplicated code from test bases moved to the trait. This leads to Experimental test base being obsolete, and completely removed.
Now the tests from Experimental widget are extending
ParagraphsTestBase. Trait is being used only in tests where needed.Comment #5
drobnjak commentedI made mistake with
'entity_reference_paragraphs'and'paragraphs'and assigned them to wrong widgets.Comment #7
drobnjak commentedAll previous changes are dropped. After discussion with @Berdir we agreed that it is better to keep
ExperimentalTestBasewithout changes, and keep the logic separated for two widgets. Here, we create the Trait for all future JS tests to be used.Comment #8
drobnjak commentedAdding parameters to make difference between widgets.
Comment #9
toncic commentedThis looks fine for me. We have some basic function that we can continue to work on other issue which are waiting this to be committed.
Comment #10
primsi commentedNice!
Maybe $widget_type is more appropriate here.
Also IMHO we should explicitly state which two options are available. Ie: "Options are: ..."
Comment #11
drobnjak commentedAddressing comment #10.
Comment #12
primsi commentedAny more feedback here?
Comment #13
toncic commentedI am not pretty sure that name is ok for the trait. I think that should have something which will associate that is trait for JS testing.
Comment #14
drobnjak commentedI disagree with the comment #13. This trait can be later used for all of the tests, not only JS. We can just call the namespace and use it in both Experimental and Classic tests.
Comment #15
toncic commentedThe general idea was to do not mix the experimental and classic widget, we are creating this trait only for JS tests.
Comment #16
miro_dietikerHere's why the two worlds should not be mixed:
Say the new widget changes functionality, people start to mangle / alter the test trait. Then they will update the classic trait calls to make the classic still work. This risks that they update it just to make the tests pass - while possibly not understanding what was (and still is) broken.
So every change on the new widget should not interfere with the old widget. This can only be reached by separating traits and bases.
Review complexity and cost of all issues significantly rise and speed is reduced otherwise.
Comment #17
miro_dietikerBut in general, a common trait makes sense, as long as those methods are NOT using the widget UI - instead just use the entity API to create resources. :-)
Comment #18
primsi commentedMy proposal is then to have that in
tests/srcand rename it to something that carries the information that we just want to have entity api paragraphs creation stuff in there. Perhaps TestParagraphGeneratiopnTrait? If we find in the future that we could have other general trait stuff, we could have more traits if those are unrelated. Thoughts?Comment #19
ginovski commentedAdded check for creating the field storage.
Comment #20
primsi commentedIf we take the approach from #17, do we want to update existing tests where relevant (even though we stated differently in #7)?
Comment #21
miro_dietikerWhat we want to keep separate are widget interaction methods and test helpers. A common trait for those are the wrong direction.
Helpers to create entities through entity api (zero UI interaction) are a healthy trait to share and apply to both widgets.
Comment #22
primsi commentedThen I think moving this back to Needs work is fine
Comment #23
miro_dietikerAgree. I see the trait here, but it's not used.
For sure, introducing this Trait only makes sense if we use it and through that, the patch will proof that the test code is getting more beautiful - for instance through less repetition.
Comment #24
ginovski commentedReplaced the test bases methods with the trait and adjusted tests accordingly.
Comment #26
miro_dietikerIMHO we should default $widget_type to 'paragraphs' here and not change those calls above.
Also default the $paragraphs_field_name to something and unify it / skip it wherever possible to field_paragraphs. Currently we also have at least paragraphs and paragraphs_field.
Committing for the current improvements, back to work for the proposed transformation.
Chances are that we broke tests of Paragraphs Collection or other project tests building on top of our traits?
Comment #27
ginovski commentedAdded defaults params and modified some function calls that didn't need a lot of changes.
Comment #28
ginovski commentedRe-uploading with some minor changes
Comment #29
ginovski commentedRetry for applying patch
Comment #30
miro_dietikerWhy do we need to have here an own field and can't use the default field? (lots of similar locations)
Comment #31
miro_dietikerAgree, this leads to lots of renames. We can commit some intermediate update without #30 rename.
I tried to apply the patch locally, but i have many errors from the test run. Need to investigate what the problem is here.
Comment #32
ginovski commentedFixed the error in ParagraphsExperimentalAddModesTest, now locally web tests are passing
Comment #33
ginovski commentedNeeds refactoring after the container summary was committed.
Comment #34
ginovski commentedRemoved unneeded function in summary test.
Comment #35
primsi commentedIf we are adding the defaults, we should change the docblock too.
Comment #36
ginovski commentedAdded default in the function docs.
Comment #37
mbovan commentedTriggered 8.3.x tests too. Looks good to me.
Comment #38
ginovski commentedOptional in the function docs
Comment #40
primsi commentedCommitted, thanks.