How to manually upload baseline screenshots in Percy for base branch - react-native

I am currently working on a react-native application and want to use Percy, a visual testing service to catch UI changes in my app.
I don't go the storybook way.
Currently, we use detox for testing, it generates screenshots artifacts which we directly upload to Percy.
But the test comparison always fails right now because we don't have corresponding baseline snapshots for the base branch, develop.
So, I want to be able to upload those baseline snapshots for the default branch manually and change them when I want.
I need help with that.
I have already checked the #percy/cli docs, I only see a way to upload manually but I don't see how to do it for the base branch.
Thanks

You can use PERCY_BRANCH to change the builds git branch and run a build to upload a set of screenshots you'd like to use for a baseline. https://docs.percy.io/docs/environment-variables#optional Something like:
PERCY_BRANCH="your-baseline-branch-name-here" npx percy upload ./screenshots (or whatever the CLI command you're running -- if it's the CLI the PERCY_BRANCH env var will work)

Related

Using Cro run for rebuilding changed client side files

cro run stops the server, recompiles, restarts the server when anything in the directory tree changes. That's great.
But when developing the client side UI, and using NPX/yarn/webpack, there is an additional step that is needed to produce the main.js file.
In the Cro tutorial this step seems to be done manually, viz., we have the line "And there we have it. npm run build, refresh, and give it a spin." Here npm run build is a command that has to be run 'manually'.
Is there a simple way, eg., using .cro.yml to force another command when changes in a sub-directory tree are detected? Eg, if the client side UI files are under path/to/cro-app/client-ui-directory and the command to be run if any files change is path/to/cro-app/client-ui/directory/yarn build
The cro-tools repo has all the file watching code associated with cro run.
So, one way would be to subclass the appropriate stuff in that repo and make a super-cro run command.
But I think the thing to do would be to set up a file watcher and trigger the rebuild in your server process. Cro files set environment variables, so you could use them to configure this behavior.

Need Example of JGit to push code files to git server

I am trying to push the selenium scripts to git server so that jenkins will automatically download the latest scripts. I wanted to give web interface to select the automation scripts and upload the same scripts in Git. I want to programatically handle the pushing of choosen files to server so that only those files are run for automation. I need an example from JGit.
You use the PushCommand for invoking a push to a remote server. There are options among others for choosing which remote is pushed to.
Keep in mind that you cannot push some files selectively, but only whole commits on a branch, so there is no way to do what you would like with simple push. An option would be to create separate commits on a separate branch and only push this one branch via defining the references via the PushCommand.add() method.
try (Git git = new Git(repository)) {
git.push().call();
}
See also a related snippet in the jgit-cookbook

Project not up-to-date after building with IntelliJ

I'm a newbie to both IntelliJ and Aurelia. I did my last web project almost a decade ago, and I find myself a bit lost between all those new libraries. That said, my question is probably of rather trivial nature:
I've downloaded the Aurelia skeleton project [1], imported the sources into a new node js project in IntelliJ and started index.html. Voila. Browser opens, shows the site.
Then I changed something (added a new route to src/app.js).
I hit the run button to show index.html again: No changes. Hm?
I rebuild the project in IntelliJ, and retried. Still my changes aren't shown.
I run gulp watch on the command line, open the browser, and my changes are shown.
So, I'm asking two things: What needs to be done to really refresh the build within IntelliJ?
And secondly, when did it become a sport to create inter-depending Javascript libraries with blurry names? Just kidding... (though I'm not laughing)
[1] https://github.com/aurelia/skeleton-navigation/blob/master/skeleton-esnext/src/child-router.js
I found it out myself. You need to put 'gulp build' to the pre-launch list of the run configuration. This is because the sources get transpiled and copied to the dist directory, from where the server is actually running.
Just building the sources from IntelliJ isn't enough.
Project rebuild start automatically after any files was changed in project directory. You do not need to build it from IDE-- only save your changes and wait a few seconds to refresh.
Of cause it will work only when you run project build with watch statement like gulp watch (e.g. run gulp watch and your project will rebuild automatically).
But if there were some errors in code -- gulp process will stop and you must restart it again. I recommend you change IDE's settings to disable automatically saving to files and use <CTRL+S> buttons to save data manually.

How to restrict runners to a specific branch and lock the .gitlab-ci.yml from changes?

Right now, anyone that creates a branch in my project and adds a .gitlab-ci.yml file to it, can execute commands on my server using the runner. How can I make it so that only masters or owners can upload CI config files and make changes to them?
I'm using https://gitlab.com/gitlab-org/gitlab-ci-multi-runner running on bash.
The GitLab runner wasn't really designed for this scenario and thus you are unable to do this. What you could do instead is have a new project with just your .gitlab-ci.yml file and configure it so that it pulls the original repository. From there you can do all the other things you want to do with your repository.

Rally - clone existing app

I'm trying to create a custom release burnup app for my group. There is an existing app called 'Release Burnup' in Rally, and based on the instructions for rally-app-builder I thought I would be able to clone this app as a starting point.
However, when I use the rally-app-builder clone RallyApps ReleaseBurnup command, it doesn't seem to do anything except change the title in the output html files to "Son of ReleaseBurnup". When I tried the same thing with the example from the github page (which uses rally-app-builder clone RallyApps StoryBoard) then it seems to be successfully cloning an app, with updates to the App.js file, etc.
I'm guessing that I might be using the wrong name to clone, but I'm not sure how to know what names are valid for this command to clone the app I want.
Unfortunately rally-app-builder clone functionality predates newer developments and the availability of source code of catalog apps from RallyApps/app-catalog, so it does not support drilling down those directories.
clone RallyApps StoryBoard works because there is a StoryBoard app at that location. There is no ReleaseBurnup there. ReleaseBurnup code is not available.
Here are the steps to build an app from javascript source files from GitHub app-catalog repository
Prerequisites:
Node.js
rally-app-builder
Get the source to a local directory (you may either fork the
app-catalog repo, or download zip from the same location):
in terminal, cd to the directory of the app you want to work on, and call this command:
rally-app-builder build.
As a result a deploy folder is created with App.html and
App-uncompressed.html inside, and App-debug.html is created in the
root folder of the app.
These steps make sense only if you intent to customize the catalog app and want to use the source as basis. If you want to use a catalog app as it was designed, install the app directly from the AppCatalog as described in this help document.