Skip to content

Commit 821c9a0

Browse files
author
elchananarb
committed
Create ProjectSelectionTest.java
1 parent 72c6d5c commit 821c9a0

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
package checkmarx.ast.eclipse.plugin.tests.ui;
2+
3+
import static org.junit.Assert.assertTrue;
4+
import static org.junit.Assert.assertEquals;
5+
6+
import java.util.concurrent.TimeoutException;
7+
8+
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
9+
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
10+
import org.junit.Test;
11+
import org.junit.runner.RunWith;
12+
13+
import com.checkmarx.eclipse.utils.PluginConstants;
14+
import com.checkmarx.eclipse.views.ViewConstants;
15+
import checkmarx.ast.eclipse.plugin.tests.common.Environment;
16+
17+
@RunWith(SWTBotJunit4ClassRunner.class)
18+
public class ProjectSelectionTest extends BaseUITest {
19+
20+
private static final String TEST_PROJECT = "pedrompflopes/WebGoat";
21+
private static final String TEST_BRANCH = "develop";
22+
23+
@Test
24+
public void testProjectSelectionFlow() throws TimeoutException {
25+
try {
26+
setUpCheckmarxPlugin(true);
27+
preventWidgetWasNullInCIEnvironment();
28+
29+
System.out.println("\n=== Starting Project Selection Flow Test ===");
30+
31+
// Get combo boxes
32+
SWTBotCombo projectCombo = _bot.comboBox(0);
33+
SWTBotCombo branchCombo = _bot.comboBox(1);
34+
SWTBotCombo scanIdCombo = _bot.comboBox(2);
35+
36+
// Verify initial state - all empty
37+
assertTrue("Project combo should start empty",
38+
projectCombo.getText().isEmpty() ||
39+
projectCombo.getText().equals("Select a project"));
40+
41+
assertTrue("Branch combo should start empty",
42+
branchCombo.getText().isEmpty());
43+
44+
assertTrue("Scan ID combo should start empty",
45+
scanIdCombo.getText().isEmpty() ||
46+
scanIdCombo.getText().equals(PluginConstants.COMBOBOX_SCAND_ID_PLACEHOLDER));
47+
48+
// Select project
49+
projectCombo.setText(TEST_PROJECT);
50+
sleep(2000);
51+
52+
// Verify branch combo is enabled and select branch
53+
assertTrue("Branch combo should be enabled", branchCombo.isEnabled());
54+
branchCombo.setText(TEST_BRANCH);
55+
sleep(2000);
56+
57+
// Verify scan ID combo is enabled and select scan
58+
assertTrue("Scan ID combo should be enabled", scanIdCombo.isEnabled());
59+
scanIdCombo.setText(Environment.SCAN_ID); // CX_TEST_SCAN
60+
sleep(2000);
61+
62+
// Cleanup
63+
_bot.viewByTitle(ViewConstants.VIEW_CHECKMARX_AST_SCAN).close();
64+
65+
} catch (Exception e) {
66+
System.out.println("\n=== Test Failed ===");
67+
System.out.println("Exception: " + e.getMessage());
68+
e.printStackTrace();
69+
throw e;
70+
}
71+
}
72+
}

0 commit comments

Comments
 (0)