@@ -10,7 +10,6 @@ import * as Selectors from '../helpers/selectors';
1010import { createNumbersCollection } from '../helpers/insert-data' ;
1111
1212const NO_PREVIEW_DOCUMENTS = 'No Preview Documents' ;
13- const LOAD_SAMPLE_DOCUMENT = 'Load document' ;
1413const PASSING_VALIDATOR = '{ $jsonSchema: {} }' ;
1514const FAILING_VALIDATOR =
1615 '{ $jsonSchema: { bsonType: "object", required: [ "phone" ] } }' ;
@@ -54,9 +53,11 @@ describe('Collection validation tab', function () {
5453 }
5554
5655 context ( 'when the schema validation is set or modified' , function ( ) {
57- it ( 'provides users with a button to load sample documents' , async function ( ) {
56+ it ( 'provides users with a single button to load sample documents' , async function ( ) {
5857 await addValidation ( PASSING_VALIDATOR ) ;
5958
59+ await browser . clickVisible ( Selectors . ValidationLoadSampleDocumentsBtn ) ;
60+
6061 await browser . waitUntil ( async ( ) => {
6162 const matchTextElement = browser . $ (
6263 Selectors . ValidationMatchingDocumentsPreview
@@ -67,18 +68,15 @@ describe('Collection validation tab', function () {
6768 ) ;
6869 const notMatchingText = await notMatchingTextElement . getText ( ) ;
6970 return (
70- matchText === LOAD_SAMPLE_DOCUMENT &&
71- notMatchingText === LOAD_SAMPLE_DOCUMENT
71+ matchText . includes ( 'ObjectId(' ) &&
72+ notMatchingText === NO_PREVIEW_DOCUMENTS
7273 ) ;
7374 } ) ;
7475 } ) ;
7576
7677 it ( 'supports rules in JSON schema' , async function ( ) {
7778 await addValidation ( FAILING_VALIDATOR ) ;
78- await browser . clickVisible ( Selectors . ValidationLoadMatchingDocumentsBtn ) ;
79- await browser . clickVisible (
80- Selectors . ValidationLoadNotMatchingDocumentsBtn
81- ) ;
79+ await browser . clickVisible ( Selectors . ValidationLoadSampleDocumentsBtn ) ;
8280
8381 // nothing passed, everything failed
8482 await browser . waitUntil ( async ( ) => {
@@ -100,10 +98,7 @@ describe('Collection validation tab', function () {
10098
10199 // the automatic indentation and brackets makes multi-line values very fiddly here
102100 await browser . setValidation ( PASSING_VALIDATOR ) ;
103- await browser . clickVisible ( Selectors . ValidationLoadMatchingDocumentsBtn ) ;
104- await browser . clickVisible (
105- Selectors . ValidationLoadNotMatchingDocumentsBtn
106- ) ;
101+ await browser . clickVisible ( Selectors . ValidationLoadSampleDocumentsBtn ) ;
107102
108103 // nothing failed, everything passed
109104 await browser . waitUntil ( async ( ) => {
0 commit comments