Docs: https://docs.cypress.io | Issues: https://github.com/cypress-io/cypress/issues
lmiller1990 on DesignSystemSetup
remove design system from CI (compare)
lmiller1990 on DesignSystemSetup
chore: release @cypress/react-v… fix: only log process.emitWarni… fix(component-testing): Correct… and 19 more (compare)
i am using cy.writefile for updating an existing json file in fixtures. But am unable to see any changes made to file. However, if i print the content of file after cy.write file, i see the updated content in console but the file doesn't get updated.. Below is my code snippet:
const path = require("path");
const dir = path.join(__dirname, "../../fixtures/");
const newFilePath = path.join(dir, "hello.json")
const dirpath = path.join(dir, afixture.name);
cy.readFile(dirpath).then((obj) => {
obj.password = 'MyNewPassword123'
cy.writeFile(dirpath, JSON.stringify(obj))
})
Fixture File Before running the script is :
{
"username": "testA1213",
"password": "Admin123$"
}
It remains same after running the file.
Console output however is showing the content of the file has changed:
Cypress detected a cross origin error happened on page load:
> Blocked a frame with origin "http://localhost:3000" from accessing a cross-origin frame.
Before the page load, you were bound to the origin policy:
> http://localhost:3000
@jabansal2 fixtures are loaded just once, so any modifications are NOT reflected. I opened an issue cypress-io/cypress-documentation#3814 to explain it slightly better
Thanks for reverting @bahmutov . Is there a way to accomplish in cypress, what i am intending to do. So basically i am using the username and password from fixtures to login to my application. My usecase is to change the password of the account i am accessing using credentials in this fixtures file and i am trying to update the password in the fixtures file as well. So can this not be accomplished in cypress as you are mentioning that fixtures only are loaded just once? Any more inputs will be appreciated. In additions thanks for creating an issue as mentioned :).
In implementing the Cypress GitHub Action, it throws the following error after installing Cypress, but before running any of the tests: ERR! Cannot read property 'length' of undefined
. Has anyone run into this issue before? I enabled the debugging logs to see if I could get any more information, but this is all it gives me around that error:
2021-04-08T20:22:55.906Z cypress:cli finished installation in /home/runner/.cache/Cypress/6.4.0
[20:22:55] Finishing Installation [completed]
25h
You can now open Cypress by running: node_modules/.bin/cypress open
https://on.cypress.io/installing-cypress
25hnpm ERR! Cannot read property 'length' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-04-08T20_22_56_966Z-debug.log
##[debug]The process '/usr/local/bin/npm' failed with exit code 1
##[debug]Error: The process '/usr/local/bin/npm' failed with exit code 1
##[debug] at ExecState._setResult (/home/runner/work/_actions/cypress-io/github-action/v2/dist/index.js:1066:25)
##[debug] at ExecState.CheckComplete (/home/runner/work/_actions/cypress-io/github-action/v2/dist/index.js:1049:18)
##[debug] at ChildProcess.<anonymous> (/home/runner/work/_actions/cypress-io/github-action/v2/dist/index.js:943:27)
##[debug] at ChildProcess.emit (events.js:210:5)
##[debug] at maybeClose (internal/child_process.js:1021:16)
##[debug] at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
Error: The process '/usr/local/bin/npm' failed with exit code 1
##[debug]Node Action run completed with exit code 1
##[debug]CI='1'
##[debug]CYPRESS_CACHE_FOLDER='/home/runner/.cache/Cypress'
##[debug]npm_config_cache='/home/runner/.npm'
##[debug]Finishing: Cypress run
For our action, we first get the deploy preview url from Netlify before moving onto the Cypress action. Here is the full GitHub action .yml
file:
name: Cypress tests
on: [push]
jobs:
cypress-tests:
runs-on: ubuntu-latest
steps:
- name: Wait for Netlify Deploy
uses: probablyup/wait-for-netlify-action@3.2.0
id: waitForDeployment
with:
site_id: ${{ secrets.NETLIFY_SITE_API_ID }}
env:
NETLIFY_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
- name: Checkout
uses: actions/checkout@v2
- name: Cypress run
uses: cypress-io/github-action@v2
env:
DEBUG: 'cypress:*'
with:
browser: chrome
headless: true
record: true
config: baseUrl=${{ steps.waitForDeployment.outputs.url }}
cy.find('img'). should('be.visible')
seems a bit hacky, and it wouldn't work for background images
process
object, since this is not Node
@arun86gupta this might help https://docs.cypress.io/guides/testing-strategies/google-authentication#Google-Developer-Console-Setup
@olore_twitter Thank you Brian.