Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 2dbb7e6b

Přidáno uživatelem Petr Urban před téměř 3 roky(ů)

#11 created UI test for testing elements on configuration page

Zobrazit rozdíly:

src/test/java/cz/zcu/fav/kiv/antipatterndetectionapp/uitests/UITestRunner.java
95 95

  
96 96
    }
97 97

  
98
    @Test
99
    void testConfigurationPage() {
100
        driver.get(url + "/configuration");
101

  
102
        List<WebElement> elements = driver.findElements(By.xpath("//a[@class='ap-configuration-header']"));
103
        // Check if there are 10 options to configure! CAN BE CHANGED IN THE TIME, SO
104
        // THIS PART OF THE CODE WILL NEED TO BE EXTENDED.
105
        Assertions.assertEquals(10, elements.size());
106

  
107

  
108
        //// PREPARE VARIABLES \\\\
109

  
110

  
111
        WebElement clickableHeader;
112
        WebElement numbuerValue;
113
        double parsedNumValue;
114
        WebElement stringValue;
115
        String substringValue;
116
        WebElement numberValue2;
117
        double parsedNumValue2;
118

  
119

  
120
        //// ------------------------- \\\\
121

  
122
        // BUSINESS AS USUAL --> Testing Default.json values!!!!
123
        driver.findElement(By.xpath("//a[@href='#BusinessAsUsual']")).click(); // click on the header so the section opens up.
124
        numbuerValue = driver.findElement(By.xpath("//input[@id='divisionOfIterationsWithRetrospective']"));
125
        stringValue = driver.findElement(By.xpath("//input[@id='searchSubstringsWithRetrospective']"));
126

  
127
        parsedNumValue = Double.parseDouble(numbuerValue.getAttribute("value"));
128
        substringValue = stringValue.getAttribute("value");
129

  
130
        Assertions.assertEquals(66.66, parsedNumValue);
131
        Assertions.assertEquals("%retr%||%revi%||%week%scrum%", substringValue);
132

  
133
        // BYSTANDER APATHY
134
        driver.findElement(By.xpath("//a[@href='#BystanderApathy']")).click(); // click on the header so the section opens up.
135
        numbuerValue = driver.findElement(By.xpath("//input[@id='maximumPercentageOfTasksWithoutTeamwork']"));
136
        stringValue = driver.findElement(By.xpath("//input[@id='searchSubstringsInvalidContributors']"));
137

  
138
        parsedNumValue = Double.parseDouble(numbuerValue.getAttribute("value"));
139
        substringValue = stringValue.getAttribute("value");
140

  
141
        Assertions.assertEquals(30, parsedNumValue);
142
        Assertions.assertEquals("%dependabot%", substringValue);
143

  
144
        // LONG OR NON EXISTENT FEEDBACK LOOPS
145
        driver.findElement(By.xpath("//a[@href='#LongOrNonExistentFeedbackLoops']")).click(); // click on the header so the section opens up.
146
        numbuerValue = driver.findElement(By.xpath("//input[@id='divisionOfIterationsWithFeedbackLoop']"));
147
        stringValue = driver.findElement(By.xpath("//input[@id='searchSubstringsWithFeedbackLoop']"));
148
        numberValue2 = driver.findElement(By.xpath("//input[@id='maxGapBetweenFeedbackLoopRate']"));
149

  
150
        parsedNumValue = Double.parseDouble(numbuerValue.getAttribute("value"));
151
        substringValue = stringValue.getAttribute("value");
152
        parsedNumValue2 = Double.parseDouble(numberValue2.getAttribute("value"));
153

  
154
        Assertions.assertEquals(50.00, parsedNumValue);
155
        Assertions.assertEquals("%schůz%zákazník%||%předvedení%zákazník%||%zákazn%demo%||%schůz%zadavat%||%inorm%schůz%||%zákazn%||%zadavatel%", substringValue);
156
        Assertions.assertEquals(2, parsedNumValue2);
157

  
158
        // NINETY NINETY RULE
159
        driver.findElement(By.xpath("//a[@href='#NinetyNinetyRule']")).click(); // click on the header so the section opens up.
160
        numbuerValue = driver.findElement(By.xpath("//input[@id='maxDivisionRange']"));
161
        numberValue2 = driver.findElement(By.xpath("//input[@id='maxBadDivisionLimit']"));
162

  
163
        parsedNumValue = Double.parseDouble(numbuerValue.getAttribute("value"));
164
        parsedNumValue2 = Double.parseDouble(numberValue2.getAttribute("value"));
165

  
166
        Assertions.assertEquals(1.25, parsedNumValue);
167
        Assertions.assertEquals(2, parsedNumValue2);
168

  
169

  
170
        // ROAD TO NOWHERE
171
        driver.findElement(By.xpath("//a[@href='#RoadToNowhere']")).click(); // click on the header so the section opens up.
172
        numbuerValue = driver.findElement(By.xpath("//input[@id='minNumberOfWikiPagesWithProjectPlan']"));
173
        numberValue2 = driver.findElement(By.xpath("//input[@id='minNumberOfActivitiesWithProjectPlan']"));
174
        stringValue = driver.findElement(By.xpath("//input[@id='searchSubstringsWithProjectPlan']"));
175

  
176
        parsedNumValue = Double.parseDouble(numbuerValue.getAttribute("value"));
177
        substringValue = stringValue.getAttribute("value");
178
        parsedNumValue2 = Double.parseDouble(numberValue2.getAttribute("value"));
179

  
180
        Assertions.assertEquals(1, parsedNumValue);
181
        Assertions.assertEquals(1, parsedNumValue2);
182
        Assertions.assertEquals("%plán projektu%||%project plan%||%plan project%||%projektový plán%", substringValue);
183

  
184
        // SPECIFY NOTHING
185
        driver.findElement(By.xpath("//a[@href='#SpecifyNothing']")).click(); // click on the header so the section opens up.
186
        numbuerValue = driver.findElement(By.xpath("//input[@id='minNumberOfWikiPagesWithSpecification']"));
187
        stringValue = driver.findElement(By.xpath("//input[@id='searchSubstringsWithProjectSpecification']"));
188
        numberValue2 = driver.findElement(By.xpath("//input[@id='minAvgLengthOfActivityDescription']"));
189
        WebElement numberValue3 = driver.findElement(By.xpath("//input[@id='minNumberOfActivitiesWithSpecification']"));
190

  
191
        parsedNumValue = Double.parseDouble(numbuerValue.getAttribute("value"));
192
        substringValue = stringValue.getAttribute("value");
193
        parsedNumValue2 = Double.parseDouble(numberValue2.getAttribute("value"));
194
        double parsedNumValue3 = Double.parseDouble(numberValue3.getAttribute("value"));
195

  
196
        Assertions.assertEquals(1, parsedNumValue);
197
        Assertions.assertEquals("%dsp%||%speciikace%||%speciication%||%vize%proj%||%vize%produ%", substringValue);
198
        Assertions.assertEquals(150, parsedNumValue2);
199
        Assertions.assertEquals(1, parsedNumValue3);
200

  
201
        // TOO LONG SPRINT
202
        driver.findElement(By.xpath("//a[@href='#TooLongSprint']")).click(); // click on the header so the section opens up.
203
        numbuerValue = driver.findElement(By.xpath("//input[@id='maxIterationLength']"));
204
        numberValue2 = driver.findElement(By.xpath("//input[@id='maxNumberOfTooLongIterations']"));
205

  
206
        parsedNumValue = Double.parseDouble(numbuerValue.getAttribute("value"));
207
        parsedNumValue2 = Double.parseDouble(numberValue2.getAttribute("value"));
208

  
209
        Assertions.assertEquals(21, parsedNumValue);
210
        Assertions.assertEquals(0, parsedNumValue2);
211

  
212
        // UKNOWN POSTER
213
        driver.findElement(By.xpath("//a[@href='#UnknownPoster']")).click(); // click on the header so the section opens up.
214
        stringValue = driver.findElement(By.xpath("//input[@id='searchSubstringsInvalidNames']"));
215
        substringValue = stringValue.getAttribute("value");
216
        Assertions.assertEquals("%unknown%||%anonym%", substringValue);
217

  
218
        // VARYING SPRINT LENGTH
219
        driver.findElement(By.xpath("//a[@href='#VaryingSprintLength']")).click(); // click on the header so the section opens up.
220
        numbuerValue = driver.findElement(By.xpath("//input[@id='maxDaysDifference']"));
221
        numberValue2 = driver.findElement(By.xpath("//input[@id='maxIterationChanged']"));
222

  
223
        parsedNumValue = Double.parseDouble(numbuerValue.getAttribute("value"));
224
        parsedNumValue2 = Double.parseDouble(numberValue2.getAttribute("value"));
225

  
226
        Assertions.assertEquals(7, parsedNumValue);
227
        Assertions.assertEquals(1, parsedNumValue2);
228

  
229
        // YET ANOTHER PROGRAMMER
230
        driver.findElement(By.xpath("//a[@href='#YetAnotherProgrammer']")).click(); // click on the header so the section opens up.
231
        numbuerValue = driver.findElement(By.xpath("//input[@id='numberOfFirstMonthsWithoutDetection']"));
232
        numberValue2 = driver.findElement(By.xpath("//input[@id='maxNumberOfNewContributors']"));
233

  
234
        parsedNumValue = Double.parseDouble(numbuerValue.getAttribute("value"));
235
        parsedNumValue2 = Double.parseDouble(numberValue2.getAttribute("value"));
236

  
237
        Assertions.assertEquals(2, parsedNumValue);
238
        Assertions.assertEquals(5, parsedNumValue2);
239
    }
98 240
}

Také k dispozici: Unified diff