jeudi 18 mars 2021

How to replace some values inside a specific tag in a index.html file using a cypress automation test

Currently I am working with a cypress test automation. I have an index.html file inside cypress/downloads/sample/index.html. The index.html file has below structure.

<html>
<head>
  <style type="text/css">
  </style>
</head>
<body>
  <script>
        const authConfig = {
            clientID: "abcd1234",
            signInRedirectURL: "https://localhost:8000",
            serverOrigin: "https://localhost:8000"
        };
    </script>
</body>
</html>

I want to replace the values for clientID, signInRedirectURL, and serverOrigin inside the script tag using a cypress automation test. Is it possible to read the index.html file and capture the script tag and replace only these 3 values without replacing the whole content of the index.html file using cypress automation? Appreciate your support on how to achieve this

Aucun commentaire:

Enregistrer un commentaire