Code Monkey home page Code Monkey logo

cypress-3rd-party-script-example's Introduction

cypress-3rd-party-script-example deploy cypress-3rd-party-script-example

Example waiting for 3rd party JavaScript library to load before testing the page

The page from public is deployed to https://glebbahmutov.com/cypress-3rd-party-script-example/ and has a Tidio chat widget

Chat widget test

Specs

  • slow-down.js uses cy.intercept to slow down 3rd party JavaScript resource. It waits for the intercept to happen, hoping that 3rd party chat widget is ready after that.
  • wait-for-chat-object.js waits for the window.tidioChatApi property to exist before proceeding. The property is added by the chat code, thus we know it is ready.
  • invoke-open.js shows how the test code can call directly the chat object methods, even if the object was created by the application.
  • spy-on-open.js spies on the application calling tidioChatApi.open() to confirm it was called once without any arguments.
  • events.js subscribes to the chat widget events and confirms the widget delivers the "ready" event.

Blog posts

Videos

Small print

Author: Gleb Bahmutov <[email protected]> © 2021

License: MIT - do anything with the code, but don't blame me if it does not work.

cypress-3rd-party-script-example's People

Contributors

bahmutov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.