1
- import {
2
- click ,
3
- waitFor ,
4
- fillIn ,
5
- triggerEvent ,
6
- find ,
7
- } from ' @ember/test-helpers' ;
1
+ import { click , fillIn , triggerEvent , find } from ' @ember/test-helpers' ;
8
2
9
3
import { module , test , skip } from ' qunit' ;
10
4
@@ -532,11 +526,9 @@ module('Acceptance | Spec preview', function (hooks) {
532
526
submode: ' code' ,
533
527
codePath: ` ${testRealmURL }person.gts ` ,
534
528
});
535
- await waitFor (' [data-test-accordion-item="spec-preview"]' );
536
529
assert .dom (' [data-test-accordion-item="spec-preview"]' ).exists ();
537
530
assert .dom (' [data-test-has-spec]' ).containsText (' card' );
538
531
await click (' [data-test-accordion-item="spec-preview"] button' );
539
- await waitFor (' [data-test-spec-selector]' );
540
532
assert .dom (' [data-test-spec-selector]' ).exists ();
541
533
assert .dom (' [data-test-spec-selector-item-path]' ).hasText (' person-entry' );
542
534
await percySnapshot (assert );
@@ -547,23 +539,19 @@ module('Acceptance | Spec preview', function (hooks) {
547
539
assert .dom (' [data-test-module-href]' ).containsText (` ${testRealmURL }person ` );
548
540
assert .dom (' [data-test-exported-name]' ).containsText (' Person' );
549
541
assert .dom (' [data-test-exported-type]' ).containsText (' card' );
550
- await waitFor (' [data-test-view-spec-instance]' );
551
542
assert .dom (' [data-test-view-spec-instance]' ).exists ();
552
543
});
553
544
test (' view when there are multiple spec instances' , async function (assert ) {
554
545
await visitOperatorMode ({
555
546
submode: ' code' ,
556
547
codePath: ` ${testRealmURL }pet.gts ` ,
557
548
});
558
- await waitFor (' [data-test-accordion-item="spec-preview"]' );
559
549
assert .dom (' [data-test-accordion-item="spec-preview"]' ).exists ();
560
550
assert .dom (' [data-test-has-spec]' ).containsText (' 2 instances' );
561
551
await click (' [data-test-accordion-item="spec-preview"] button' );
562
- await waitFor (' [data-test-spec-selector]' );
563
552
assert .dom (' [data-test-spec-selector]' ).exists ();
564
553
assert .dom (' [data-test-caret-down]' ).exists ();
565
554
assert .dom (' [data-test-spec-selector-item-path]' ).hasText (' pet-entry-2' );
566
- await waitFor (' [data-test-view-spec-instance]' );
567
555
assert .dom (' [data-test-view-spec-instance]' ).exists ();
568
556
});
569
557
test (' view when there are no spec instances' , async function (assert ) {
@@ -583,7 +571,6 @@ module('Acceptance | Spec preview', function (hooks) {
583
571
submode: ' code' ,
584
572
codePath: ` ${testRealm2URL }new-skill.gts ` ,
585
573
});
586
- await waitFor (' [data-test-accordion-item="spec-preview"]' );
587
574
await click (' [data-test-accordion-item="spec-preview"] button' );
588
575
assert .dom (' [data-test-accordion-item="spec-preview"]' ).exists ();
589
576
assert .dom (' [data-test-create-spec-button]' ).doesNotExist ();
@@ -597,7 +584,6 @@ module('Acceptance | Spec preview', function (hooks) {
597
584
submode: ' code' ,
598
585
codePath: ` ${testRealm2URL }person.gts ` ,
599
586
});
600
- await waitFor (' [data-test-accordion-item="spec-preview"]' );
601
587
await click (' [data-test-accordion-item="spec-preview"] button' );
602
588
assert .dom (' [data-test-accordion-item="spec-preview"]' ).exists ();
603
589
assert .dom (' [data-test-create-spec-button]' ).doesNotExist ();
@@ -686,7 +672,6 @@ module('Acceptance | Spec preview', function (hooks) {
686
672
submode: ' code' ,
687
673
codePath: ` ${testRealmURL }employee.gts ` ,
688
674
});
689
- await waitFor (' [data-test-accordion-item="spec-preview"]' );
690
675
assert .dom (' [data-test-accordion-item="spec-preview"]' ).exists ();
691
676
await click (' [data-test-accordion-item="spec-preview"] button' );
692
677
assert .dom (' [data-test-title] [data-test-boxel-input]' ).hasValue (' ' );
@@ -699,7 +684,6 @@ module('Acceptance | Spec preview', function (hooks) {
699
684
submode: ' code' ,
700
685
codePath: ` ${testRealmURL }person.gts ` ,
701
686
});
702
- await waitFor (' [data-test-accordion-item="spec-preview"]' );
703
687
await click (' [data-test-accordion-item="spec-preview"] button' );
704
688
let readMeInput = ' This is a spec for a person' ;
705
689
this .onSave ((_ , json ) => {
@@ -723,17 +707,12 @@ module('Acceptance | Spec preview', function (hooks) {
723
707
submode: ' code' ,
724
708
codePath: ` ${testRealmURL }person.gts ` ,
725
709
});
726
-
727
- await waitFor (' [data-test-view-spec-instance]' );
710
+ await click (' [data-test-accordion-item="spec-preview"] button' );
728
711
assert .dom (' [data-test-view-spec-instance]' ).exists ();
729
712
await click (' [data-test-view-spec-instance]' );
730
-
731
- await waitFor (' [data-test-card-url-bar-input]' );
732
713
assert
733
714
.dom (' [data-test-card-url-bar-input]' )
734
715
.hasValue (` ${testRealmURL }person-entry.json ` );
735
-
736
- await waitFor (' [data-test-editor]' );
737
716
assert .dom (' [data-test-editor]' ).hasAnyText ();
738
717
assert .dom (' [data-test-editor]' ).containsText (' Person' );
739
718
assert .dom (' [data-test-editor]' ).containsText (' Spec' );
@@ -751,35 +730,28 @@ module('Acceptance | Spec preview', function (hooks) {
751
730
submode: ' code' ,
752
731
codePath: ` ${testRealmURL }pet.gts ` ,
753
732
});
754
- await waitFor (' [data-test-accordion-item="spec-preview"]' );
755
733
assert .dom (' [data-test-accordion-item="spec-preview"]' ).exists ();
756
- await click (' [data-test-accordion-item="spec-preview"] button' );
757
-
758
- await waitFor (' [data-test-spec-selector]' );
759
- assert .dom (' [data-test-spec-selector]' ).exists ();
760
734
735
+ await click (' [data-test-accordion-item="spec-preview"] button' );
761
736
await click (' [data-test-spec-selector] > div' );
762
-
763
737
assert
764
738
.dom (' [data-option-index="0"] [data-test-spec-selector-item-path]' )
765
739
.hasText (' pet-entry-2' );
766
- await click (' [data-option-index="0"]' );
767
740
741
+ await click (' [data-option-index="0"]' );
768
742
assert .dom (` [data-test-links-to-many="linkedExamples"] ` ).exists ();
769
743
assert .dom (` [data-test-card="${testRealmURL }Pet/mango"] ` ).exists ();
770
744
771
745
await triggerEvent (
772
746
` [data-test-card="${testRealmURL }Pet/mango"] ` ,
773
747
' mouseenter' ,
774
748
);
775
-
776
749
assert .dom (' [data-test-card-overlay]' ).exists ();
777
750
778
751
await triggerEvent (
779
752
` [data-test-card="${testRealmURL }Pet/mango"] ` ,
780
753
' mouseleave' ,
781
754
);
782
-
783
755
assert .dom (' [data-test-card-overlay]' ).doesNotExist ();
784
756
});
785
757
@@ -788,13 +760,11 @@ module('Acceptance | Spec preview', function (hooks) {
788
760
submode: ' code' ,
789
761
codePath: ` ${testRealmURL }polymorphic-field.gts ` ,
790
762
});
791
- await waitFor (' [data-test-accordion-item="spec-preview"]' );
792
763
const elementName = ' SubTestField' ;
793
764
await click (` [data-test-boxel-selector-item-text="${elementName }"] ` );
794
765
assert .dom (' [data-test-accordion-item="spec-preview"]' ).exists ();
795
766
assert .dom (' [data-test-has-spec]' ).containsText (' field' );
796
767
await click (' [data-test-accordion-item="spec-preview"] button' );
797
- await waitFor (' [data-test-spec-selector]' );
798
768
assert .dom (' [data-test-spec-selector]' ).exists ();
799
769
assert
800
770
.dom (' [data-test-module-href]' )
@@ -838,13 +808,8 @@ module('Acceptance | Spec preview', function (hooks) {
838
808
submode: ' code' ,
839
809
codePath: ` ${testRealmURL }pet.gts ` ,
840
810
});
841
-
842
- // Open the spec preview panel
843
- await waitFor (' [data-test-accordion-item="spec-preview"]' );
844
811
await click (' [data-test-accordion-item="spec-preview"] button' );
845
-
846
812
// Select the pet-entry-2 spec which has linked examples
847
- await waitFor (' [data-test-spec-selector]' );
848
813
await click (' [data-test-spec-selector] > div' );
849
814
assert
850
815
.dom (' [data-option-index="0"] [data-test-spec-selector-item-path]' )
@@ -853,12 +818,10 @@ module('Acceptance | Spec preview', function (hooks) {
853
818
854
819
// Wait for linked examples to appear
855
820
const petId = ` ${testRealmURL }Pet/mango ` ;
856
- await waitFor (` [data-test-links-to-many="linkedExamples"] ` );
857
821
assert .dom (` [data-test-card="${petId }"] ` ).exists ();
858
822
859
823
// Click on the first linked example
860
824
await triggerEvent (` [data-test-card="${petId }"] ` , ' mouseenter' );
861
- await waitFor (' [data-test-card-overlay]' );
862
825
await click (` [data-test-card="${petId }"] ` );
863
826
864
827
// Verify the card was persisted in playground selections
@@ -873,7 +836,6 @@ module('Acceptance | Spec preview', function (hooks) {
873
836
);
874
837
875
838
// Verify the playground panel shows the selected card
876
- await waitFor (' [data-test-selected-item]' );
877
839
assert .dom (' [data-test-selected-item]' ).hasText (' Mango' );
878
840
assertCardExists (
879
841
assert ,
@@ -884,31 +846,22 @@ module('Acceptance | Spec preview', function (hooks) {
884
846
});
885
847
886
848
test (' updatePlaygroundSelections adds card to recent files storage when clicking an example card' , async function (assert ) {
849
+ const petId = ` ${testRealmURL }Pet/mango ` ;
887
850
await visitOperatorMode ({
888
851
submode: ' code' ,
889
852
codePath: ` ${testRealmURL }pet.gts ` ,
890
853
});
891
-
892
- // Open the spec preview panel
893
- await waitFor (' [data-test-accordion-item="spec-preview"]' );
894
854
await click (' [data-test-accordion-item="spec-preview"] button' );
895
-
896
855
// Select the pet-entry-2 spec which has linked examples
897
- await waitFor (' [data-test-spec-selector]' );
898
856
await click (' [data-test-spec-selector] > div' );
899
857
assert
900
858
.dom (' [data-option-index="0"] [data-test-spec-selector-item-path]' )
901
859
.hasText (' pet-entry-2' );
902
- await click (' [data-option-index="0"]' );
903
860
904
- // Wait for linked examples to appear
905
- const petId = ` ${testRealmURL }Pet/mango ` ;
906
- await waitFor (` [data-test-links-to-many="linkedExamples"] ` );
861
+ await click (' [data-option-index="0"]' );
907
862
assert .dom (` [data-test-card="${petId }"] ` ).exists ();
908
-
909
863
// Click on the first linked example
910
864
await triggerEvent (` [data-test-card="${petId }"] ` , ' mouseenter' );
911
- await waitFor (' [data-test-card-overlay]' );
912
865
await click (` [data-test-card="${petId }"] ` );
913
866
914
867
// Verify the card was added to recent files
@@ -927,35 +880,24 @@ module('Acceptance | Spec preview', function (hooks) {
927
880
});
928
881
929
882
test (' updatePlaygroundSelections preserves existing format when selecting different examples card' , async function (assert ) {
883
+ const firstPetId = ` ${testRealmURL }Pet/mango ` ;
884
+ const secondPetId = ` ${testRealmURL }Pet/pudding ` ;
930
885
await visitOperatorMode ({
931
886
submode: ' code' ,
932
887
codePath: ` ${testRealmURL }pet.gts ` ,
933
888
});
934
-
935
- // Open the spec preview panel
936
- await waitFor (' [data-test-accordion-item="spec-preview"]' );
937
889
await click (' [data-test-accordion-item="spec-preview"] button' );
938
-
939
- // Select the pet-entry-2 spec which has linked examples
940
- await waitFor (' [data-test-spec-selector]' );
941
890
await click (' [data-test-spec-selector] > div' );
942
891
assert
943
892
.dom (' [data-option-index="0"] [data-test-spec-selector-item-path]' )
944
893
.hasText (' pet-entry-2' );
945
894
await click (' [data-option-index="0"]' );
946
-
947
- // Wait for linked examples to appear
948
- const firstPetId = ` ${testRealmURL }Pet/mango ` ;
949
- const secondPetId = ` ${testRealmURL }Pet/pudding ` ;
950
- await waitFor (` [data-test-links-to-many="linkedExamples"] ` );
951
895
assert .dom (` [data-test-card="${firstPetId }"] ` ).exists ();
952
896
assert .dom (` [data-test-card="${secondPetId }"] ` ).exists ();
953
897
954
898
// Click on the first linked example
955
899
await triggerEvent (` [data-test-card="${firstPetId }"] ` , ' mouseenter' );
956
- await waitFor (' [data-test-card-overlay]' );
957
900
await click (` [data-test-card="${firstPetId }"] ` );
958
-
959
901
assertCardExists (
960
902
assert ,
961
903
firstPetId ,
@@ -985,7 +927,6 @@ module('Acceptance | Spec preview', function (hooks) {
985
927
// Go back to spec preview and click the second card
986
928
await click (' [data-test-accordion-item="spec-preview"] button' );
987
929
await triggerEvent (` [data-test-card="${secondPetId }"] ` , ' mouseenter' );
988
- await waitFor (' [data-test-card-overlay]' );
989
930
await click (` [data-test-card="${secondPetId }"] ` );
990
931
991
932
// Verify the format was preserved when selecting the second card
@@ -999,7 +940,6 @@ module('Acceptance | Spec preview', function (hooks) {
999
940
);
1000
941
1001
942
// Verify the second card is shown in embedded format
1002
- await waitFor (' [data-test-selected-item]' );
1003
943
assert .dom (' [data-test-selected-item]' ).hasText (' Pudding' );
1004
944
assertCardExists (
1005
945
assert ,
@@ -1014,7 +954,6 @@ module('Acceptance | Spec preview', function (hooks) {
1014
954
submode: ' code' ,
1015
955
codePath: ` ${testRealmURL }pet.gts ` ,
1016
956
});
1017
- await waitFor (' [data-test-accordion-item="spec-preview"]' );
1018
957
await click (' [data-test-accordion-item="spec-preview"] button' );
1019
958
assert .dom (' [data-test-title] [data-test-boxel-input]' ).hasValue (' Pet2' );
1020
959
assert .dom (' [data-test-number-of-instance]' ).hasText (' 2 instances' );
0 commit comments