basic_test.js 668 B

1234567891011121314151617181920212223242526272829
  1. /// <reference path="./steps.d.ts" />
  2. const express = require("express");
  3. const port = Math.floor(Math.random() * (8000 - 2000 + 1)) + 2000;
  4. BeforeSuite((I) => {
  5. const app = express()
  6. app.use(express.static('public'))
  7. app.listen(port)
  8. });
  9. Feature('Connection');
  10. Scenario('Data Channel ping pong', async (I) => {
  11. I.amOnPage("http://localhost:" + port)
  12. I.wait(1)
  13. I.openNewTab();
  14. I.amOnPage("http://localhost:" + port)
  15. I.wait(1)
  16. const id2 = await I.grabTextFrom("#id")
  17. I.switchToPreviousTab(1)
  18. I.wait(1)
  19. I.executeScript(`connect("${id2}")`)
  20. I.wait(1)
  21. I.see("pong")
  22. });
  23. AfterSuite((I) => {
  24. process.exit(0)
  25. })