From f97e41617c825494efec2b7e14ae3de4e0c7d3b2 Mon Sep 17 00:00:00 2001
From: Yuriy Maksymets <iurii.maksymets@gmail.com>
Date: Fri, 11 Oct 2019 13:21:47 +0100
Subject: [PATCH] Testing id appearance

---
 peer.test.js              | 11 +++++++++++
 serverIntegration.test.js | 10 ++++++----
 serverTest.js             | 18 ++++++++++++++----
 3 files changed, 31 insertions(+), 8 deletions(-)
 create mode 100644 peer.test.js

diff --git a/peer.test.js b/peer.test.js
new file mode 100644
index 0000000..422bcf8
--- /dev/null
+++ b/peer.test.js
@@ -0,0 +1,11 @@
+import { Selector } from "testcafe"
+
+fixture`Peer 2`.page`localhost:12345`
+
+const selectorOptions = { timeout: 100 }
+
+test("Connection id appears", async (t) => {
+  const articleHeader = Selector("#user-id").with(selectorOptions)
+  let inputValue = await articleHeader.value
+  await t.expect(inputValue.length).gt(0)
+})
diff --git a/serverIntegration.test.js b/serverIntegration.test.js
index a823577..d24add1 100644
--- a/serverIntegration.test.js
+++ b/serverIntegration.test.js
@@ -1,7 +1,9 @@
-// import { Selector } from "testcafe"
+import { Selector } from "testcafe"
 
-fixture`Getting Started`.page`http://devexpress.github.io/testcafe/example`
+fixture`Peer 1`.page`localhost:12345`
 
-test("My first test", async (t) => {
-  await t.typeText("#developer-name", "John Smith").click("#submit-button")
+test("Connection id appears", async (t) => {
+  const articleHeader = Selector("#user-id").with({ timeout: 100 })
+  let inputValue = await articleHeader.value
+  await t.expect(inputValue.length).gt(0)
 })
diff --git a/serverTest.js b/serverTest.js
index 92a2ebf..250794f 100644
--- a/serverTest.js
+++ b/serverTest.js
@@ -1,10 +1,11 @@
 const createTestCafe = require("testcafe")
 let runner = null
+let runner2 = null
 
 createTestCafe("localhost", 1337, 1338)
   .then((testcafe) => {
     runner = testcafe.createRunner()
-
+    runner2 = testcafe.createRunner()
     return testcafe.createBrowserConnection()
   })
   .then((remoteConnection) => {
@@ -14,11 +15,20 @@ createTestCafe("localhost", 1337, 1338)
       .reporter("json")
       .run()
       .then((failedCount) => {
-        console.log("failed count " + failedCount)
-        /* ... */
+        console.log("failed count 1: " + failedCount)
+        // runner2
+        //   .src("peer.test.js")
+        //   .browsers(["chrome"])
+        //   .reporter("json")
+        //   .run()
+        //   .then((failedCount) => {
+        //     console.log("failed count 2: " + failedCount)
+        //   })
+        //   .catch((error) => {
+        //     console.log("error" + error)
+        //   })
       })
       .catch((error) => {
         console.log("error" + error)
-        /* ... */
       })
   })
-- 
GitLab