Skip to content

Commit 4ededb6

Browse files
asashourlukeis
authored andcommitted
Add test annotation @NotYetImplemented
This feature is meant to be used with test classes with @RunWith(SeleniumTestRunner.class) It makes the runner executes the test method, and if the method fails (as expected) then the build will be green, and if the method succeeds, then the build is red complaining "Test is marked as @NotYetImplemented but already works". This feature ensures that anything marked with @NotYetImplemented is still not implemented, and it is helpful to make the test suite annotations correct. This commit applies it to tests in TypingTest running with HtmlUnit (which were previously @ignore), but it can be applied to other classes or drivers. Signed-off-by: Luke Inman-Semerau <[email protected]>
1 parent f544b5b commit 4ededb6

File tree

4 files changed

+169
-26
lines changed

4 files changed

+169
-26
lines changed

Diff for: java/client/test/org/openqa/selenium/TypingTest.java

+43-22
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,13 @@
4646
import org.openqa.selenium.testing.Ignore;
4747
import org.openqa.selenium.testing.JUnit4TestBase;
4848
import org.openqa.selenium.testing.JavascriptEnabled;
49+
import org.openqa.selenium.testing.NotYetImplemented;
4950
import org.openqa.selenium.testing.drivers.Browser;
5051

5152
public class TypingTest extends JUnit4TestBase {
5253

5354
@JavascriptEnabled
54-
@Ignore({MARIONETTE})
55+
@Ignore(MARIONETTE)
5556
@Test
5657
public void testShouldFireKeyPressEvents() {
5758
driver.get(pages.javascriptPage);
@@ -162,7 +163,8 @@ public void testArrowKeysShouldNotBePrintable() {
162163
assertThat(keyReporter.getAttribute("value"), is(""));
163164
}
164165

165-
@Ignore(value = {HTMLUNIT, MARIONETTE})
166+
@Ignore(MARIONETTE)
167+
@NotYetImplemented(HTMLUNIT)
166168
@Test
167169
public void testShouldBeAbleToUseArrowKeys() {
168170
driver.get(pages.javascriptPage);
@@ -275,7 +277,8 @@ private static void checkRecordedKeySequence(WebElement element, int expectedKey
275277
}
276278

277279
@JavascriptEnabled
278-
@Ignore(value = {HTMLUNIT, IE, PHANTOMJS, MARIONETTE})
280+
@Ignore(value = {IE, PHANTOMJS, MARIONETTE})
281+
@NotYetImplemented(HTMLUNIT)
279282
@Test
280283
public void testShouldReportKeyCodeOfArrowKeys() {
281284
assumeFalse(Browser.detect() == Browser.opera &&
@@ -303,8 +306,9 @@ public void testShouldReportKeyCodeOfArrowKeys() {
303306
}
304307

305308
@JavascriptEnabled
306-
@Ignore(value = {HTMLUNIT, MARIONETTE},
309+
@Ignore(value = MARIONETTE,
307310
reason = "untested user agents")
311+
@NotYetImplemented(HTMLUNIT)
308312
@Test
309313
public void testShouldReportKeyCodeOfArrowKeysUpDownEvents() {
310314
assumeFalse(Browser.detect() == Browser.opera &&
@@ -350,7 +354,8 @@ public void testNumericNonShiftKeys() {
350354
}
351355

352356
@JavascriptEnabled
353-
@Ignore(value = {HTMLUNIT, MARIONETTE}, reason = "untested user agent")
357+
@Ignore(value = MARIONETTE, reason = "untested user agent")
358+
@NotYetImplemented(HTMLUNIT)
354359
@Test
355360
public void testNumericShiftKeys() {
356361
driver.get(pages.javascriptPage);
@@ -380,7 +385,8 @@ public void testLowerCaseAlphaKeys() {
380385
}
381386

382387
@JavascriptEnabled
383-
@Ignore(value = {HTMLUNIT, MARIONETTE}, reason = "untested user agents")
388+
@Ignore(value = MARIONETTE, reason = "untested user agents")
389+
@NotYetImplemented(HTMLUNIT)
384390
@Test
385391
public void testUppercaseAlphaKeys() {
386392
driver.get(pages.javascriptPage);
@@ -396,7 +402,8 @@ public void testUppercaseAlphaKeys() {
396402
}
397403

398404
@JavascriptEnabled
399-
@Ignore(value = {HTMLUNIT, MARIONETTE}, reason = "untested user agents")
405+
@Ignore(value = MARIONETTE, reason = "untested user agents")
406+
@NotYetImplemented(HTMLUNIT)
400407
@Test
401408
public void testAllPrintableKeys() {
402409
driver.get(pages.javascriptPage);
@@ -413,7 +420,8 @@ public void testAllPrintableKeys() {
413420
assertThat(result.getText().trim(), containsString(" up: 16"));
414421
}
415422

416-
@Ignore(value = {HTMLUNIT, MARIONETTE}, reason = "untested user agents")
423+
@Ignore(value = MARIONETTE, reason = "untested user agents")
424+
@NotYetImplemented(HTMLUNIT)
417425
@Test
418426
public void testArrowKeysAndPageUpAndDown() {
419427
driver.get(pages.javascriptPage);
@@ -426,7 +434,8 @@ public void testArrowKeysAndPageUpAndDown() {
426434
}
427435

428436
@JavascriptEnabled
429-
@Ignore(value = {HTMLUNIT, MARIONETTE}, reason = "untested user agents")
437+
@Ignore(value = MARIONETTE, reason = "untested user agents")
438+
@NotYetImplemented(HTMLUNIT)
430439
@Test
431440
public void testHomeAndEndAndPageUpAndPageDownKeys() {
432441
assumeFalse("FIXME: macs don't have HOME keys, would PGUP work?",
@@ -443,7 +452,8 @@ public void testHomeAndEndAndPageUpAndPageDownKeys() {
443452
}
444453

445454
@JavascriptEnabled
446-
@Ignore(value = {HTMLUNIT, MARIONETTE}, reason = "untested user agents")
455+
@Ignore(value = MARIONETTE, reason = "untested user agents")
456+
@NotYetImplemented(HTMLUNIT)
447457
@Test
448458
public void testDeleteAndBackspaceKeys() {
449459
driver.get(pages.javascriptPage);
@@ -461,7 +471,8 @@ public void testDeleteAndBackspaceKeys() {
461471
}
462472

463473
@JavascriptEnabled
464-
@Ignore(value = {HTMLUNIT, MARIONETTE}, reason = "untested user agents")
474+
@Ignore(value = MARIONETTE, reason = "untested user agents")
475+
@NotYetImplemented(HTMLUNIT)
465476
@Test
466477
public void testSpecialSpaceKeys() {
467478
driver.get(pages.javascriptPage);
@@ -473,8 +484,9 @@ public void testSpecialSpaceKeys() {
473484
}
474485

475486
@JavascriptEnabled
476-
@Ignore(value = {HTMLUNIT, MARIONETTE},
487+
@Ignore(value = MARIONETTE,
477488
reason = "untested user agents")
489+
@NotYetImplemented(HTMLUNIT)
478490
@Test
479491
public void testNumberpadKeys() {
480492
driver.get(pages.javascriptPage);
@@ -503,9 +515,10 @@ public void testFunctionKeys() {
503515
}
504516

505517
@JavascriptEnabled
506-
@Ignore(value = {HTMLUNIT, SAFARI, MARIONETTE},
518+
@Ignore(value = {SAFARI, MARIONETTE},
507519
reason = "untested user agents; Safari: issue 4221",
508520
issues = {4221})
521+
@NotYetImplemented(HTMLUNIT)
509522
@Test
510523
public void testShiftSelectionDeletes() {
511524
driver.get(pages.javascriptPage);
@@ -521,7 +534,8 @@ public void testShiftSelectionDeletes() {
521534
}
522535

523536
@JavascriptEnabled
524-
@Ignore(value = {HTMLUNIT, MARIONETTE}, reason = "untested user agents")
537+
@Ignore(value = MARIONETTE, reason = "untested user agents")
538+
@NotYetImplemented(HTMLUNIT)
525539
@Test
526540
public void testChordControlHomeShiftEndDelete() {
527541
assumeFalse("FIXME: macs don't have HOME keys, would PGUP work?",
@@ -543,7 +557,8 @@ public void testChordControlHomeShiftEndDelete() {
543557
}
544558

545559
@JavascriptEnabled
546-
@Ignore(value = {HTMLUNIT, MARIONETTE}, reason = "untested user agents")
560+
@Ignore(value = MARIONETTE, reason = "untested user agents")
561+
@NotYetImplemented(HTMLUNIT)
547562
@Test
548563
public void testChordReveseShiftHomeSelectionDeletes() {
549564
assumeFalse("FIXME: macs don't have HOME keys, would PGUP work?",
@@ -576,7 +591,8 @@ public void testChordReveseShiftHomeSelectionDeletes() {
576591
// and linux, but not on the MAC.
577592

578593
@JavascriptEnabled
579-
@Ignore(value = {HTMLUNIT, MARIONETTE}, reason = "untested user agents")
594+
@Ignore(value = MARIONETTE, reason = "untested user agents")
595+
@NotYetImplemented(HTMLUNIT)
580596
@Test
581597
public void testChordControlCutAndPaste() {
582598
assumeFalse("FIXME: macs don't have HOME keys, would PGUP work?",
@@ -651,8 +667,9 @@ public void testShouldNotTypeIntoElementsThatPreventKeyDownEvents() {
651667
}
652668

653669
@JavascriptEnabled
654-
@Ignore(value = {PHANTOMJS, HTMLUNIT},
670+
@Ignore(value = PHANTOMJS,
655671
reason = "HtmlUnit: failure, others: not tested")
672+
@NotYetImplemented(HTMLUNIT)
656673
@Test
657674
public void testGenerateKeyPressEventEvenWhenElementPreventsDefault() {
658675
assumeFalse(isFirefox(driver) && getFirefoxVersion(driver) < 25);
@@ -691,7 +708,8 @@ public void testTypingIntoAnIFrameWithContentEditableOrDesignModeSet() {
691708
}
692709

693710
@JavascriptEnabled
694-
@Ignore(value = {HTMLUNIT, MARIONETTE}, issues = {6711})
711+
@Ignore(value = MARIONETTE, issues = {6711})
712+
@NotYetImplemented(HTMLUNIT)
695713
@NoDriverAfterTest // So that next test never starts with "inside a frame" base state.
696714
@Test
697715
public void testNonPrintableCharactersShouldWorkWithContentEditableOrDesignModeSet() {
@@ -719,18 +737,19 @@ public void testShouldBeAbleToTypeOnAnEmailInputField() {
719737
assertThat(email.getAttribute("value"), equalTo("foobar"));
720738
}
721739

722-
@Ignore(HTMLUNIT)
723740
@Test
741+
@NotYetImplemented(HTMLUNIT)
724742
public void testShouldBeAbleToTypeOnANumberInputField() {
725743
driver.get(pages.formPage);
726744
WebElement email = driver.findElement(By.id("age"));
727745
email.sendKeys("33");
728746
assertThat(email.getAttribute("value"), equalTo("33"));
729747
}
730748

731-
@Ignore(value = {HTMLUNIT, SAFARI, MARIONETTE}, reason = "Untested browsers;" +
749+
@Ignore(value = {SAFARI, MARIONETTE}, reason = "Untested browsers;" +
732750
" Safari: cannot type on contentEditable with synthetic events",
733751
issues = {3127})
752+
@NotYetImplemented(HTMLUNIT)
734753
@Test
735754
public void testShouldBeAbleToTypeIntoEmptyContentEditableElement() {
736755
driver.get(pages.readOnlyPage);
@@ -754,10 +773,11 @@ public void testShouldBeAbleToTypeIntoContentEditableElementWithExistingValue()
754773
assertThat(editable.getText(), equalTo(initialText + ", edited"));
755774
}
756775

757-
@Ignore(value = {HTMLUNIT, IE, SAFARI, MARIONETTE},
776+
@Ignore(value = {IE, SAFARI, MARIONETTE},
758777
reason = "Untested browsers;" +
759778
" Safari: cannot type on contentEditable with synthetic events",
760779
issues = {3127})
780+
@NotYetImplemented(HTMLUNIT)
761781
@NoDriverAfterTest // So that next test never starts with "inside a frame" base state.
762782
@Test
763783
public void testShouldBeAbleToTypeIntoTinyMCE() {
@@ -773,7 +793,8 @@ public void testShouldBeAbleToTypeIntoTinyMCE() {
773793
}
774794

775795
@JavascriptEnabled
776-
@Ignore(value = {HTMLUNIT, SAFARI}, reason = "Untested")
796+
@Ignore(value = SAFARI, reason = "Untested")
797+
@NotYetImplemented(HTMLUNIT)
777798
@Test
778799
public void canSafelyTypeOnElementThatIsRemovedFromTheDomOnKeyPress() {
779800
driver.get(appServer.whereIs("key_tests/remove_on_keypress.html"));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Licensed to the Software Freedom Conservancy (SFC) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The SFC licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
package org.openqa.selenium.testing;
19+
20+
import java.lang.annotation.ElementType;
21+
import java.lang.annotation.Retention;
22+
import java.lang.annotation.RetentionPolicy;
23+
import java.lang.annotation.Target;
24+
25+
import org.openqa.selenium.testing.Ignore.Driver;
26+
27+
@Retention(RetentionPolicy.RUNTIME)
28+
@Target(ElementType.METHOD)
29+
public @interface NotYetImplemented {
30+
31+
Driver[] value() default {Driver.ALL};
32+
33+
String reason() default ("Not implemented in driver yet");
34+
35+
int[] issues() default {};
36+
37+
}

0 commit comments

Comments
 (0)