Creating selenium framework tests (abstraction for rh-che)#10191
Conversation
|
Can one of the admins verify this patch? |
1 similar comment
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
8d7e5c1 to
ab33b6e
Compare
ab33b6e to
9c8de39
Compare
|
ci-build |
|
Build # 4561 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/4561/ to view the results. |
|
|
||
| bind(AbstractTestWorkspaceServiceClient.class).to(CheTestWorkspaceServiceClient.class); | ||
| // | ||
| // bind(TestWorkspaceServiceClientFactory.class).to(CheTestWorkspaceServiceClientFactory.class); |
There was a problem hiding this comment.
This comment looks redundant here.
| import org.eclipse.che.selenium.core.client.TestMachineServiceClient; | ||
| import org.eclipse.che.selenium.core.client.TestOrganizationServiceClient; | ||
| import org.eclipse.che.selenium.core.client.TestOrganizationServiceClientFactory; | ||
| import org.eclipse.che.selenium.core.client.*; |
There was a problem hiding this comment.
it's better to define dependencies explicitly
| import org.eclipse.che.selenium.core.user.TestUser; | ||
| import org.eclipse.che.selenium.core.user.TestUserFactory; | ||
| import org.eclipse.che.selenium.core.user.TestUserImpl; | ||
| import org.eclipse.che.selenium.core.user.*; |
There was a problem hiding this comment.
it's better to define dependencies explicitly
| import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; | ||
| import org.eclipse.che.selenium.pageobject.ProjectExplorer; | ||
| import org.eclipse.che.selenium.pageobject.ToastLoader; | ||
| import org.eclipse.che.selenium.pageobject.*; |
There was a problem hiding this comment.
it's better to define dependencies explicitly
| import static org.eclipse.che.selenium.pageobject.dashboard.NewWorkspace.Stack.BLANK; | ||
| import static org.eclipse.che.selenium.pageobject.dashboard.NewWorkspace.Stack.DOT_NET; | ||
| import static org.eclipse.che.selenium.pageobject.dashboard.NewWorkspace.Stack.JAVA; | ||
| import static org.eclipse.che.selenium.pageobject.dashboard.NewWorkspace.Stack.*; |
There was a problem hiding this comment.
it's better to define dependencies explicitly
There was a problem hiding this comment.
You shouldn't use static imports. instead referencing the values like Stack.JAVA.
There are of course some exceptions too, though.
| import org.eclipse.che.selenium.pageobject.dashboard.DocumentationPage; | ||
| import org.eclipse.che.selenium.pageobject.dashboard.NewWorkspace; | ||
| import org.eclipse.che.selenium.pageobject.dashboard.ProjectOptions; | ||
| import org.eclipse.che.selenium.pageobject.dashboard.*; |
There was a problem hiding this comment.
it's better to define dependencies explicitly
| import static org.openqa.selenium.Keys.ARROW_DOWN; | ||
| import static org.openqa.selenium.Keys.ARROW_UP; | ||
| import static org.openqa.selenium.Keys.ESCAPE; | ||
| import static org.openqa.selenium.Keys.*; |
There was a problem hiding this comment.
it's better to define dependencies explicitly
| import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; | ||
| import org.eclipse.che.selenium.pageobject.ProjectExplorer; | ||
| import org.eclipse.che.selenium.pageobject.ToastLoader; | ||
| import org.eclipse.che.selenium.pageobject.*; |
There was a problem hiding this comment.
it's better to define dependencies explicitly
| import com.google.inject.assistedinject.Assisted; | ||
| import org.eclipse.che.selenium.core.user.TestUser; | ||
|
|
||
| public interface CheTestWorkspaceServiceClientFactory extends TestWorkspaceServiceClientFactory { |
There was a problem hiding this comment.
It ought to be TestWorkspaceServiceClientFactory which produces TestWorkspaceServiceClient instance.
There was a problem hiding this comment.
I see but how should we then differentiate to include RhCheTestWorkspaceServiceClient or CheTestWorkspaceServiceClient ?
There was a problem hiding this comment.
Guice will substitute proper concrete class automatically depending on what is bound in the module class to the TestWorkspaceServiceClient class.
There was a problem hiding this comment.
So, we doesn't need this class CheTestWorkspaceServiceClientFactory if we have already had TestWorkspaceServiceClientFactory.
There was a problem hiding this comment.
@ScrewTSW: I reviewed the code again and realized that there is lack of interface class TestWorkspaceClientService similar to TestUserServiceClient. In that case class hierarchy will looks like the follow:
TestWorkspaceClientService -> AbstractTestWorkspaceClientService -> CheTestWorkspaceClientService.
In that case:
- we doesn't need to change a lot of files replacing
TestWorkspaceClientServiceonAbstractTestWorkspaceClientService; - we shouldn't use
CheTestWorkspaceServiceClientin the test classes explicitly so as we are binding it in the module class; - we should bind interface
TestWorkspaceServiceClientto concrete classCheTestWorkspaceServiceClientinCheSeleniumSuiteModule.
d485018 to
00976a3
Compare
|
Hello @dmytro-ndp @Katka92. |
| // check that name field saves it state after choosing another stack | ||
| newWorkspace.waitPageLoad(); | ||
| newWorkspace.waitStackSelected(BLANK); | ||
| newWorkspace.waitStackSelected(Stack.BLANK); |
There was a problem hiding this comment.
Please, restore static imports in this class.
There was a problem hiding this comment.
is there some specific reason the static imports are used? using static imports should be avoided.
There was a problem hiding this comment.
Why it should be avoided? In this case it makes the code clearer because Stack. prefix doesn't add significant info to the code.
How about restoring initial content of file?
There was a problem hiding this comment.
https://carlosbecker.com/posts/avoid-static-imports/
Here's a nice article explaining the issues that may arise, when developers that have never seen the code try to contribute.
Still it's just my opinion. I can restore the class.
There was a problem hiding this comment.
I agree that static imports can arise the problems, and they are actually not recommended to use in production. But here we have tests, and also there are situations when static imports make code much more readable, for example, in lambdas.
Anyway, these changes don't block merging into master, IMHO.
| @@ -37,25 +33,25 @@ | |||
| * @author Anatolii Bazko | |||
| */ | |||
| @Singleton | |||
There was a problem hiding this comment.
You shouldn't apply @Singleton annotation to abstract types. It doesn't make sense.
Use it in the extending class CheTestWorkspaceProvider so that it will work.
| import com.google.inject.assistedinject.Assisted; | ||
| import org.eclipse.che.selenium.core.user.TestUser; | ||
|
|
||
| public interface CheTestWorkspaceServiceClientFactory extends TestWorkspaceServiceClientFactory { |
There was a problem hiding this comment.
So, we doesn't need this class CheTestWorkspaceServiceClientFactory if we have already had TestWorkspaceServiceClientFactory.
| @Named("workspace.default_memory_gb") int defaultMemoryGb, | ||
| DefaultTestUser defaultUser, | ||
| WorkspaceDtoDeserializer workspaceDtoDeserializer, | ||
| CheTestWorkspaceServiceClient testWorkspaceServiceClient, |
There was a problem hiding this comment.
We can declare TestWorkspaceServiceClient and TestWorkspaceServiceClientFactory here in constructor.
|
|
||
| install(new FactoryModuleBuilder().build(TestUserHttpJsonRequestFactoryCreator.class)); | ||
| install(new FactoryModuleBuilder().build(TestWorkspaceServiceClientFactory.class)); | ||
| install(new FactoryModuleBuilder().build(CheTestWorkspaceServiceClientFactory.class)); |
There was a problem hiding this comment.
We shouldn't use CheTestWorkspaceServiceClientFactory here.
There was a problem hiding this comment.
Could you please shortly elaborate why? Where should we then specify to use CheTestWorkspaceServiceClientFactory?
There was a problem hiding this comment.
Because TestWorkspaceServiceClientFactory should work perfectly well with CheWorkspaceServiceClient itself.
|
Please restore |
8ba2ed8 to
eac13d5
Compare
Signed-off-by: Tibor Dancs <tdancs@redhat.com> Modified TestWorkspaceProvider -> Abstraction, so that rh-che can override needed methods. Modified TestWorkspaceServiceClient for rh-che tests extension Abstracted TestWorkspaceServiceClient for RhChe implementation Fixed inject issues Signed-off-by: Tibor Dancs <tdancs@redhat.com> Modified required abstractions, using interfaces instead of implementations of the interface (e.g. DefaultTestUser) Modified TestWorkspaceProvider -> Abstraction, so that rh-che can override needed methods. Fixed inject issues Signed-off-by: Tibor Dancs <tdancs@redhat.com>
eac13d5 to
b1a72f9
Compare
|
@dmytro-ndp Becasue of the added interface, the Guice now panics, complaining that the factory needs a concrete class implementation for |
Signed-off-by: Dmytro Nochevnov <dnochevnov@codenvy.com>
|
@ScrewTSW: please, look at my fresh fixup - it provides implementation of |
|
ci-test |
| protected void configure() { | ||
| bind(TestAuthServiceClient.class).to(KeycloakTestAuthServiceClient.class); | ||
| bind(TestMachineServiceClient.class).to(CheTestMachineServiceClient.class); | ||
| bind(TestWorkspaceServiceClient.class).to(CheTestWorkspaceServiceClient.class); |
There was a problem hiding this comment.
We can omit binding TestWorkspaceServiceClient here so as we have already done it in CheSeleniumSuiteModule.java.
|
ci-test build report: |
|
ci-build |
|
ci-test-docker-single |
|
ci-test build report: |
…kTest Signed-off-by: Dmytro Nochevnov <dnochevnov@codenvy.com>
…e-upstream-selenium-tests-compatibility
|
Build # 4567 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/4567/ to view the results. |
…he#10191) * Prepairing upstream che for abstraction (rh-che tests) Signed-off-by: Tibor Dancs <tdancs@redhat.com> Modified TestWorkspaceProvider -> Abstraction, so that rh-che can override needed methods. Modified TestWorkspaceServiceClient for rh-che tests extension Abstracted TestWorkspaceServiceClient for RhChe implementation Fixed inject issues Signed-off-by: Tibor Dancs <tdancs@redhat.com> Modified required abstractions, using interfaces instead of implementations of the interface (e.g. DefaultTestUser) Modified TestWorkspaceProvider -> Abstraction, so that rh-che can override needed methods. Fixed inject issues Signed-off-by: Tibor Dancs <tdancs@redhat.com> * Fixing abstraction, added interface for TestWorkspaceServiceClient * Reverting test class imports to interfaces * Fix installing of TestWorkspaceServiceClientFactory Signed-off-by: Dmytro Nochevnov <dnochevnov@codenvy.com> * removed redundant bind * Get rid of grouping of static imports in CreateWorkspaceFromBlankStackTest Signed-off-by: Dmytro Nochevnov <dnochevnov@codenvy.com>
What does this PR do?
This PR modifies some required classes and generalizes them for use outside of eclipse/che repo.
rh-che related PR : redhat-developer/rh-che/pull/721
What issues does this PR fix or reference?
redhat-developer/che-functional-tests/issues/266