Running cypress on GitHub actions will run test twice - google-chrome

I am running a test using Cypress 9.5.7 and GitHub actions and every time I run an action GH will run the test twice one on Chrome and the other on Electron. Second test always fails on Electron. Electron browser seems to be a default browser for Cypress. The intersting thing is that when I run on Cypress Dashboard the test runs only once on Chrome. But twice on GitHub actions.
I talked to a few developers and we couldn't find a solution.
Anybody has ever expeerince this issue and how did you resolve it??
I tried just removing / bypass electron
return {
browsers: config.browsers.filter(
(b) => b.name === 'chrome'
),
}

Related

Vue3/Pinia: mutating state crashes Webkit only on Vite prod build

I have a pretty straight forward Vue3/Vite project. It works fine with npm run dev in FF and Chrome but the production build (npm run build) with default params crashes Chrome.
The offending part is a async get info action in my Pinia store which iterates over an array to fire XHR Requests and push the result into state variables:
async getInfo() { Promises.all(someArray.map(i=>axios.get(i)) .then(res=>res.forEach(i=>this._myStateVariable.push(i.data)))
As long as I simply console.log the results, everything is running fine but as soon as I put the result in my state, everything crashes but only on Chrome and Safari and only if I use the production build from vite.
I don't believe I've got an infinite loop here since it's working fine on FF
So the question is, how do I put the results of those requests into the Pinia store without crashing Chrome?
I also tried building an array first and shoving it into the state at once:
this._myStateVariable = someArrayFromXhrData;
this.$patch(_myStateVariable:someArrayFromXhrData);
I also tried switching the build target to es2015 but no luck.
Does anyone have an idea how to get to the root of this?
Solution Turns out I did have an infinite loop since on of my methods was mutating the state. After updating Vue to the latest version it was actually reported in the Chrome console. I still find it weird that it worked and wasn't reported in FF though but whatever ...

Dismiss leave page dialogs automatically using Chromedriver (Codeception)

I have written a series of acceptance tests that work when executed independently. I am using ChromeDriver to carry out this tests with Codeception.
However, when I run all the procedures from a test class I get a dialog about
This page is asking you to confirm that you want to leave - data you have entered may not be saved.
This is a browser modal alert, hence all the tests that follow fail as the browser cannot navigate away from this page.
Is there an way in Codeception or Chromedriver to accept the dialog with default keys so that other tests can be performed sequentially? Or to tell Codeception to force close the current window and try a new window?
Thanks!
I found similar question for different test framework: Prevent onbeforeunload dialog from interfering with tests
Proposed solution is to execute window.onbeforeunload = undefined; after each page load.
With Codeception you have to use executeJS method:
$I->amOnPage('/');
$I->executeJS('window.onbeforeunload = undefined;');
After playing with settings for a while, the only way to get passed is to set the restart property to true (false by default):
WebDriver:
url: 'http://localhost:8080/'
wait: 2
window_size: false # disabled in ChromeDriver
port: 9515
browser: chrome
restart: true
This will close the browser window and the dialog will not be displayed. A new browser will be opened for the next test.
This solution will make the acceptance run tests even slow, so I'm keen to see if anyone else has a better solution!
Worth noting that I tried playing with the unexpectedAlertBehaviour capability and no matter what value I have it, the alert would not be dismissed.
You could inject jQuery to delete the confirmation box, I believe. (Disclaimer: Not a website coder).
Edit: I don't think that's viable.
See Remove Alert box before it pops up

Electron Dialog closing refreshes my current page

I have an electron app.
It uses Bootstrap v4, Electron v2 amongst some other node modules.
I have a button which opens an electron dialog, the user selects a folder, and at this point, my application BrowserWindow appears to refresh.
I don't want this refresh to occur. I have created a test case which shows this behaviour. No doubt I have made a simple error, please can take a look at this repo to show the test case which reproduces my problem.
https://bitbucket.org/renegadeandy/electron-dialog-problem/src/master/
The problem was I am writing a log.txt file to the directory which is being watched by the electron-reload module.
When I write a new record to the log, the file changes, and causes my application to reload! Makes sense - but the combination of my logging & active reload isn't working nicely together.
I have solved it by simply removing electron-reload.

Ember JS Environment.js not updating in Chrome Extension after deployment

I have an Ember App.
I am not sure if it is related to ember-cli-chrome add-on. I don't think so.
I was successful in deploying the chrome extension on local machine. I could also see the popup loading etc.
I am printing my environment.js "config" just to see the values, and I notice that these values are not updated based on my code base. If I run the same code in normal browser instance, it works fine.
I also notice that these environment.js contents are quite old (I had deployed the extension few days back) and seems like these values are coming from there - somehow!!! I uninstalled chrome and installed it back - no luck.
What could be happening?
Thanks

Can't get Hello world example to work as a web-app

I am a total newbie to google-apps-script, but I can't believe the problem I'm having. I can't even get the Hello World! example to work as a web-app.
I have copied and pasted code from google's documentation website, and I still can't get it to work. (I tried more complicated stuff first, but then I started trying simpler and simpler code until I bottomed out with the below problem.)
When I publish the following code as a web-app:
function doGet() {
return ContentService.createTextOutput('Hello, world!');
}
Instead of seeing "Hello, world!" in the browser, I get the following error message:
The script completed but did not return anything.
I'm really at a loss here. I don't know how to try anything simpler, and again, the code snippet above was copied and pasted directly from the Content Service documentation page (https://developers.google.com/apps-script/reference/content/).
Any help with this problem is greatly appreciated.
Thanks in advance.
Thanks for the response Alan.
I created a new project and pasted the Hello world code into it, and it worked. I'll just work from this new project going forward.
...
Now that I have a few more minutes of experience, I think my problem was with version control. I thought that when I made a change in my code and updated the current version, then the current version published as a web app would reflect this change in my code. However, it seems that you have to create a new version of your code in order for your newly-published web-app to reflect the most recent changes in your code. My problem was that I was not creating new versions as I changed my code, so I kept accessing the old code which was always the same as when that version was first created.
(Using the Test web app for your latest code link (located in the Deploy as web app dialog which is accessed from the Publish menu) did reflect my most recent changes, but this was not adequate for my testing purposes since I was sending arguments to my web app url. (The latest code link only calls your web app with a read-only version of your web app url that has no arguments appended to it.) In order to properly test the web app with all arguments appended to the url, I needed to re-publish the new code under a different version number in order for those changes to be reflected in the web app that was published. Only then I could access this url that pointed to my latest code with all of my arguments appended.)
Again, just hitting the Update button in the Deploy as Web App dialog without specifying a new version does not actually update the current version with your new code. In order for your latest/newest code to be deployed you have to create a new version of your code that will reflect your latest changes. In order to create a new version, you first have to choose Manage versions... from the File menu and then save a new version that reflects your most recent code changes by hitting the Save New Version button. Once you have done this, you can choose to publish this new version in the Deploy as Web App dialog. The url for your web app will then access whichever version of your code that you last deployed/published.
I know that everyone on here probably already knows this, but I thought I'd clarify what my problem was (problem understanding the work-flow of the code-publish cycle) in case any newbie in the future also runs into this problem.
<<<<<UPDATE>>>>>
See the answer from Serge below about how to use the dev version of your web app url with parameters appended to it. In many cases, this can alleviate the need to create new (exec) versions of your web app as I described above if/when you are making only incremental changes to your code.
In order to get hold of your dev url in the browser address bar so you can copy it for further use (instead of getting the script.googleusercontent.com... url that is used to temporarily serve the content/output of your web app) just call an undefined function in your web app code. Then use the Test web app for your latest code link to call the dev version of your web app. This will cause an error page to be returned, and your dev url will then be available for copying in the browser address bar.
Following these steps I was able to get the Hello World Script to run:
Go to script.google.com
Paste your above code into the script area.
Save as Hello World.
Publish as version 1.0.
Go to the url it generates and "Hello, world!" is now displayed.
You can now also test the web app with the latest code when publishing.
Your statement that the .dev url is not able to support parameters is not exactly true (The latest code link only calls your web app with a read-only version of your web app url that has no arguments appended to it). Actually it does just like the exec one but you can only call this url directly from the browser (and not from another app) because only you can access the app using this special url.
demo code :
function doGet(e) {
var valToReturn = ContentService.createTextOutput('the parameter was '+e.parameter.val).setMimeType(ContentService.MimeType.TEXT);
return valToReturn;
}
The test .dev url with parameters goes like this :
https://script.google.com/macros/s/AKfycb___vWxs/dev?val='test'
and the return you get in your Browser is :