-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the test for checking inactive workspace #9171
Merged
Merged
Changes from 4 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c86d215
Add the test for checking activity workspaces
34af700
add new test to testsuite
8c370b2
fix typo, incapsulate math operations into method
1151b61
Fix license, rename the field for better readability
8de4d3b
change of method name for more readability
84203a0
apply camel case format
41a6abf
Merge branch 'master' into CHE-9166
cb76b02
Merge branch 'master' into CHE-9166
de0d4ca
Merge branch 'CHE-9166' of github.com:eclipse/che into CHE-9166
96321e0
Merge branch 'master' into CHE-9166
d12fddc
change method for correct getting the auth. token
1123b5c
remove unused method
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
...-test/src/test/java/org/eclipse/che/selenium/workspaces/CheckStoppingWsByTimeoutTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright (c) 2012-2018 Red Hat, Inc. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
package org.eclipse.che.selenium.workspaces; | ||
|
||
import static java.util.concurrent.TimeUnit.MILLISECONDS; | ||
import static org.eclipse.che.api.core.model.workspace.WorkspaceStatus.*; | ||
import static org.eclipse.che.selenium.core.utils.WaitUtils.sleepQuietly; | ||
import static org.testng.AssertJUnit.assertEquals; | ||
|
||
import com.google.inject.Inject; | ||
import javax.inject.Named; | ||
import org.eclipse.che.api.core.model.workspace.Workspace; | ||
import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient; | ||
import org.eclipse.che.selenium.core.user.TestUser; | ||
import org.eclipse.che.selenium.core.workspace.TestWorkspace; | ||
import org.eclipse.che.selenium.pageobject.Ide; | ||
import org.eclipse.che.selenium.pageobject.ProjectExplorer; | ||
import org.eclipse.che.selenium.pageobject.ToastLoader; | ||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.Test; | ||
|
||
public class CheckStoppingWsByTimeoutTest { | ||
|
||
private static int TOASTLOADER_WIDGET_LATENCY_TIMEOUT_IN_MILLISEC = 20000; | ||
@Inject private Ide ide; | ||
@Inject private ProjectExplorer projectExplorer; | ||
@Inject private ToastLoader toastLoader; | ||
@Inject private TestWorkspaceServiceClient workspaceServiceClient; | ||
@Inject private TestWorkspace testWorkspace; | ||
@Inject private TestUser testUser; | ||
|
||
@Inject | ||
@Named("che.workspace_agent_dev_inactive_stop_timeout_ms") | ||
private int cheWorkspaceAgentDevInactiveStopTimeoutMilliseconds; | ||
|
||
@Inject | ||
@Named("che.workspace.activity_check_scheduler_period_s") | ||
private int cheWorkspaceActivityCheckSchedulerPeriodInSeconds; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Request" |
||
@BeforeClass | ||
public void setUp() throws Exception { | ||
ide.open(testWorkspace); | ||
projectExplorer.waitProjectExplorer(); | ||
// We should invoke delay without any action for triggering workspace activity checker | ||
sleepQuietly(getCommonTimeout(), MILLISECONDS); | ||
} | ||
|
||
@Test | ||
public void checkStoppingByApi() throws Exception { | ||
Workspace workspace = | ||
workspaceServiceClient.getByName( | ||
testWorkspace.getName(), testUser.getName(), testUser.getAuthToken()); | ||
assertEquals(workspace.getStatus(), STOPPED); | ||
} | ||
|
||
@Test | ||
public void checkLoadToasterAfterStopping() { | ||
toastLoader.waitStartButtonInToastLoader(); | ||
} | ||
|
||
private int getCommonTimeout() { | ||
return cheWorkspaceAgentDevInactiveStopTimeoutMilliseconds | ||
+ TOASTLOADER_WIDGET_LATENCY_TIMEOUT_IN_MILLISEC | ||
+ cheWorkspaceActivityCheckSchedulerPeriodInSeconds * 1000; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's better to point millisecond unit of time measurement in the method name: |
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it exactly what you want to add? Maybe "org.testng.Assert"?