Skip to content

Commit 1e63dfe

Browse files
committed
remove unnecessary waitFors in spec tests
1 parent 1381e2c commit 1e63dfe

File tree

1 file changed

+8
-69
lines changed

1 file changed

+8
-69
lines changed

packages/host/tests/acceptance/code-submode/spec-test.gts

+8-69
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
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';
82

93
import { module, test, skip } from 'qunit';
104

@@ -532,11 +526,9 @@ module('Acceptance | Spec preview', function (hooks) {
532526
submode: 'code',
533527
codePath: `${testRealmURL}person.gts`,
534528
});
535-
await waitFor('[data-test-accordion-item="spec-preview"]');
536529
assert.dom('[data-test-accordion-item="spec-preview"]').exists();
537530
assert.dom('[data-test-has-spec]').containsText('card');
538531
await click('[data-test-accordion-item="spec-preview"] button');
539-
await waitFor('[data-test-spec-selector]');
540532
assert.dom('[data-test-spec-selector]').exists();
541533
assert.dom('[data-test-spec-selector-item-path]').hasText('person-entry');
542534
await percySnapshot(assert);
@@ -547,23 +539,19 @@ module('Acceptance | Spec preview', function (hooks) {
547539
assert.dom('[data-test-module-href]').containsText(`${testRealmURL}person`);
548540
assert.dom('[data-test-exported-name]').containsText('Person');
549541
assert.dom('[data-test-exported-type]').containsText('card');
550-
await waitFor('[data-test-view-spec-instance]');
551542
assert.dom('[data-test-view-spec-instance]').exists();
552543
});
553544
test('view when there are multiple spec instances', async function (assert) {
554545
await visitOperatorMode({
555546
submode: 'code',
556547
codePath: `${testRealmURL}pet.gts`,
557548
});
558-
await waitFor('[data-test-accordion-item="spec-preview"]');
559549
assert.dom('[data-test-accordion-item="spec-preview"]').exists();
560550
assert.dom('[data-test-has-spec]').containsText('2 instances');
561551
await click('[data-test-accordion-item="spec-preview"] button');
562-
await waitFor('[data-test-spec-selector]');
563552
assert.dom('[data-test-spec-selector]').exists();
564553
assert.dom('[data-test-caret-down]').exists();
565554
assert.dom('[data-test-spec-selector-item-path]').hasText('pet-entry-2');
566-
await waitFor('[data-test-view-spec-instance]');
567555
assert.dom('[data-test-view-spec-instance]').exists();
568556
});
569557
test('view when there are no spec instances', async function (assert) {
@@ -583,7 +571,6 @@ module('Acceptance | Spec preview', function (hooks) {
583571
submode: 'code',
584572
codePath: `${testRealm2URL}new-skill.gts`,
585573
});
586-
await waitFor('[data-test-accordion-item="spec-preview"]');
587574
await click('[data-test-accordion-item="spec-preview"] button');
588575
assert.dom('[data-test-accordion-item="spec-preview"]').exists();
589576
assert.dom('[data-test-create-spec-button]').doesNotExist();
@@ -597,7 +584,6 @@ module('Acceptance | Spec preview', function (hooks) {
597584
submode: 'code',
598585
codePath: `${testRealm2URL}person.gts`,
599586
});
600-
await waitFor('[data-test-accordion-item="spec-preview"]');
601587
await click('[data-test-accordion-item="spec-preview"] button');
602588
assert.dom('[data-test-accordion-item="spec-preview"]').exists();
603589
assert.dom('[data-test-create-spec-button]').doesNotExist();
@@ -686,7 +672,6 @@ module('Acceptance | Spec preview', function (hooks) {
686672
submode: 'code',
687673
codePath: `${testRealmURL}employee.gts`,
688674
});
689-
await waitFor('[data-test-accordion-item="spec-preview"]');
690675
assert.dom('[data-test-accordion-item="spec-preview"]').exists();
691676
await click('[data-test-accordion-item="spec-preview"] button');
692677
assert.dom('[data-test-title] [data-test-boxel-input]').hasValue('');
@@ -699,7 +684,6 @@ module('Acceptance | Spec preview', function (hooks) {
699684
submode: 'code',
700685
codePath: `${testRealmURL}person.gts`,
701686
});
702-
await waitFor('[data-test-accordion-item="spec-preview"]');
703687
await click('[data-test-accordion-item="spec-preview"] button');
704688
let readMeInput = 'This is a spec for a person';
705689
this.onSave((_, json) => {
@@ -723,17 +707,12 @@ module('Acceptance | Spec preview', function (hooks) {
723707
submode: 'code',
724708
codePath: `${testRealmURL}person.gts`,
725709
});
726-
727-
await waitFor('[data-test-view-spec-instance]');
710+
await click('[data-test-accordion-item="spec-preview"] button');
728711
assert.dom('[data-test-view-spec-instance]').exists();
729712
await click('[data-test-view-spec-instance]');
730-
731-
await waitFor('[data-test-card-url-bar-input]');
732713
assert
733714
.dom('[data-test-card-url-bar-input]')
734715
.hasValue(`${testRealmURL}person-entry.json`);
735-
736-
await waitFor('[data-test-editor]');
737716
assert.dom('[data-test-editor]').hasAnyText();
738717
assert.dom('[data-test-editor]').containsText('Person');
739718
assert.dom('[data-test-editor]').containsText('Spec');
@@ -751,35 +730,28 @@ module('Acceptance | Spec preview', function (hooks) {
751730
submode: 'code',
752731
codePath: `${testRealmURL}pet.gts`,
753732
});
754-
await waitFor('[data-test-accordion-item="spec-preview"]');
755733
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();
760734

735+
await click('[data-test-accordion-item="spec-preview"] button');
761736
await click('[data-test-spec-selector] > div');
762-
763737
assert
764738
.dom('[data-option-index="0"] [data-test-spec-selector-item-path]')
765739
.hasText('pet-entry-2');
766-
await click('[data-option-index="0"]');
767740

741+
await click('[data-option-index="0"]');
768742
assert.dom(`[data-test-links-to-many="linkedExamples"]`).exists();
769743
assert.dom(`[data-test-card="${testRealmURL}Pet/mango"]`).exists();
770744

771745
await triggerEvent(
772746
`[data-test-card="${testRealmURL}Pet/mango"]`,
773747
'mouseenter',
774748
);
775-
776749
assert.dom('[data-test-card-overlay]').exists();
777750

778751
await triggerEvent(
779752
`[data-test-card="${testRealmURL}Pet/mango"]`,
780753
'mouseleave',
781754
);
782-
783755
assert.dom('[data-test-card-overlay]').doesNotExist();
784756
});
785757

@@ -788,13 +760,11 @@ module('Acceptance | Spec preview', function (hooks) {
788760
submode: 'code',
789761
codePath: `${testRealmURL}polymorphic-field.gts`,
790762
});
791-
await waitFor('[data-test-accordion-item="spec-preview"]');
792763
const elementName = 'SubTestField';
793764
await click(`[data-test-boxel-selector-item-text="${elementName}"]`);
794765
assert.dom('[data-test-accordion-item="spec-preview"]').exists();
795766
assert.dom('[data-test-has-spec]').containsText('field');
796767
await click('[data-test-accordion-item="spec-preview"] button');
797-
await waitFor('[data-test-spec-selector]');
798768
assert.dom('[data-test-spec-selector]').exists();
799769
assert
800770
.dom('[data-test-module-href]')
@@ -838,13 +808,8 @@ module('Acceptance | Spec preview', function (hooks) {
838808
submode: 'code',
839809
codePath: `${testRealmURL}pet.gts`,
840810
});
841-
842-
// Open the spec preview panel
843-
await waitFor('[data-test-accordion-item="spec-preview"]');
844811
await click('[data-test-accordion-item="spec-preview"] button');
845-
846812
// Select the pet-entry-2 spec which has linked examples
847-
await waitFor('[data-test-spec-selector]');
848813
await click('[data-test-spec-selector] > div');
849814
assert
850815
.dom('[data-option-index="0"] [data-test-spec-selector-item-path]')
@@ -853,12 +818,10 @@ module('Acceptance | Spec preview', function (hooks) {
853818

854819
// Wait for linked examples to appear
855820
const petId = `${testRealmURL}Pet/mango`;
856-
await waitFor(`[data-test-links-to-many="linkedExamples"]`);
857821
assert.dom(`[data-test-card="${petId}"]`).exists();
858822

859823
// Click on the first linked example
860824
await triggerEvent(`[data-test-card="${petId}"]`, 'mouseenter');
861-
await waitFor('[data-test-card-overlay]');
862825
await click(`[data-test-card="${petId}"]`);
863826

864827
// Verify the card was persisted in playground selections
@@ -873,7 +836,6 @@ module('Acceptance | Spec preview', function (hooks) {
873836
);
874837

875838
// Verify the playground panel shows the selected card
876-
await waitFor('[data-test-selected-item]');
877839
assert.dom('[data-test-selected-item]').hasText('Mango');
878840
assertCardExists(
879841
assert,
@@ -884,31 +846,22 @@ module('Acceptance | Spec preview', function (hooks) {
884846
});
885847

886848
test('updatePlaygroundSelections adds card to recent files storage when clicking an example card', async function (assert) {
849+
const petId = `${testRealmURL}Pet/mango`;
887850
await visitOperatorMode({
888851
submode: 'code',
889852
codePath: `${testRealmURL}pet.gts`,
890853
});
891-
892-
// Open the spec preview panel
893-
await waitFor('[data-test-accordion-item="spec-preview"]');
894854
await click('[data-test-accordion-item="spec-preview"] button');
895-
896855
// Select the pet-entry-2 spec which has linked examples
897-
await waitFor('[data-test-spec-selector]');
898856
await click('[data-test-spec-selector] > div');
899857
assert
900858
.dom('[data-option-index="0"] [data-test-spec-selector-item-path]')
901859
.hasText('pet-entry-2');
902-
await click('[data-option-index="0"]');
903860

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"]');
907862
assert.dom(`[data-test-card="${petId}"]`).exists();
908-
909863
// Click on the first linked example
910864
await triggerEvent(`[data-test-card="${petId}"]`, 'mouseenter');
911-
await waitFor('[data-test-card-overlay]');
912865
await click(`[data-test-card="${petId}"]`);
913866

914867
// Verify the card was added to recent files
@@ -927,35 +880,24 @@ module('Acceptance | Spec preview', function (hooks) {
927880
});
928881

929882
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`;
930885
await visitOperatorMode({
931886
submode: 'code',
932887
codePath: `${testRealmURL}pet.gts`,
933888
});
934-
935-
// Open the spec preview panel
936-
await waitFor('[data-test-accordion-item="spec-preview"]');
937889
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]');
941890
await click('[data-test-spec-selector] > div');
942891
assert
943892
.dom('[data-option-index="0"] [data-test-spec-selector-item-path]')
944893
.hasText('pet-entry-2');
945894
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"]`);
951895
assert.dom(`[data-test-card="${firstPetId}"]`).exists();
952896
assert.dom(`[data-test-card="${secondPetId}"]`).exists();
953897

954898
// Click on the first linked example
955899
await triggerEvent(`[data-test-card="${firstPetId}"]`, 'mouseenter');
956-
await waitFor('[data-test-card-overlay]');
957900
await click(`[data-test-card="${firstPetId}"]`);
958-
959901
assertCardExists(
960902
assert,
961903
firstPetId,
@@ -985,7 +927,6 @@ module('Acceptance | Spec preview', function (hooks) {
985927
// Go back to spec preview and click the second card
986928
await click('[data-test-accordion-item="spec-preview"] button');
987929
await triggerEvent(`[data-test-card="${secondPetId}"]`, 'mouseenter');
988-
await waitFor('[data-test-card-overlay]');
989930
await click(`[data-test-card="${secondPetId}"]`);
990931

991932
// Verify the format was preserved when selecting the second card
@@ -999,7 +940,6 @@ module('Acceptance | Spec preview', function (hooks) {
999940
);
1000941

1001942
// Verify the second card is shown in embedded format
1002-
await waitFor('[data-test-selected-item]');
1003943
assert.dom('[data-test-selected-item]').hasText('Pudding');
1004944
assertCardExists(
1005945
assert,
@@ -1014,7 +954,6 @@ module('Acceptance | Spec preview', function (hooks) {
1014954
submode: 'code',
1015955
codePath: `${testRealmURL}pet.gts`,
1016956
});
1017-
await waitFor('[data-test-accordion-item="spec-preview"]');
1018957
await click('[data-test-accordion-item="spec-preview"] button');
1019958
assert.dom('[data-test-title] [data-test-boxel-input]').hasValue('Pet2');
1020959
assert.dom('[data-test-number-of-instance]').hasText('2 instances');

0 commit comments

Comments
 (0)