Change the default domain temporarily in cypress - automated-tests

I'm working with cypress to test a system where each service is in a different container and needs to be accessed via its IP address.
E.g http://10.30.0.1/home, http://10.30.0.2/cart, etc
I tried the cy.origin() but there's the limitation that all the interactions with the elements of that domain need to be inside the callback Fn.
The test project uses different classes to represent each screen of the system and they have all the interactions with that specific page. I know this is not recommended by Cypress but it was done this way.
So ideally, I'd like to be able to change the domain and continue navigating in it without the need to be inside the callback function.
Is there a way to achieve that in Cypress? It will take too much effort to change all the project to use cy.origin() as it is.
Thanks in advance

Related

Using another scenario from another feature in current scenario, Behat testing

So my question is can I use a bunch of steps defined in another scenario that was used in a different feature file?
eg: I have a feature file that helps create some pages on the website. Now i want a different scenario in a different feature file that will create the pages and also add some other steps to it. In this case, I want to create a page, and this triggers a notification to a particular user, and I want to work with the notifications. But cannot do so without triggering a page creation action by the user. It is just a bunch of 5 steps. but i am trying to reduce steps as much as possible to keep it simple.
Of the top of my head, maybe use tags and then use the tags to combine two scenarios. but i am not sure if we can do that
So i want to know if there is a way of code reuse in this case. And if so, HOW?
Thank you
You could define a new step like ‘I create a page’, and under the hood reuse the steps from other contexts as explained here:
https://behat-docs.readthedocs.io/en/mvp1.0/cookbooks/gathering_contexts_when_using_multiple_contexts.html

How to create several folders in Alfresco Share when creating a Site?

Am new to Alfresco, so this might be trivial, but I couldn't find the answer....
While using Alfresco Share, I will have many sites to be created. These are not known beforehand and will be done one at a time via the UI. I would like to have a standard set of 3 folders created each time I create a site. I think rules can be used for such a purpose?
Is this possible? If so, could you outline the detailed steps necessary? (New to Alfresco!)
thanks
Yes, a rule should be the starting point for this. The rule needs to be created on the Sites folder and set to "run on subfolders".
When your rule fires, it will be handed the folder that represents the site.
Sites have "containers" for the various tools used in the site which are just folders that site in the site's root folder. The container folders have a specific aspect and a component ID. Those containers get created lazily--they don't get created until the first user uses the component.
In your case, that means when you create a site, it doesn't contain a Document Library folder (it's actually named "documentLibrary") until someone uses the document library for the first time.
That means your rule will have to create the documentLibrary folder in the site folder. It needs to be named exactly like that, it needs to have the "st:siteContainer" aspect, and it needs to have st:componentId set to "documentLibrary".
Once that's done, your rule can create the standard set of folders, then you are done.
Because there is no out-of-the-box action that does what I've described, you'll use server-side JavaScript to implement this rule which just means you'll write the rule in JavaScript, upload it to Data Dictionary/Scripts, then point to it when you configure your rule.
As a side note, if your standard set of folders will change frequently, is complex, or needs to include documents (like sample content or something), you might want to use a space template and then create the documentLibrary folder based on that space template. If that sounds like overkill or isn't what you need, then forget I mentioned it and just have your rule create the three folders.

Drupal and Multi-sites?

I just want some opinions on what's the best way to go about meeting the following requirements.
I have
One main Drupal Installation
It is a typical "listings" site where users can list items
One user can have how many ever "listings" that are linked to his account
I want to be able to create sub-accounts, that use the same base site. However, for each subsite:
Only the users listings must appear on his site
It must have a completely different theme.
It must have its own menu items
The site must run off it's own domain OR subdomain
I need some answers:
Is this possible, or will each user need a completely new Drupal installation and just use a web service or something to get its listings from the main site?
What modules / components will make my life easier?
Any other suggestions to make this as simple as possible?
The problem description is not detailed enough to give a fully sound advice (and - additionally - it looks like you could probably get better advice on a drupal specific forum, as the question seems more related to installation and configuration than to programming), however - from what I understand - it looks to me that your solution could give in either of the two directions:
Tweaking a single installation to appear as different sites
Creating multiple sites that shares the same codebase and part of the data
The tweaking solution has the advantage that you have only one DB to mantain, but there is no actual real separation between the subsites. You could implement this by:
SUBSITES: mapping various subdomains on the same IP
CONTENT: using the native permission system to filter which list items to display (for example: each logged user can display only nodes created by himself, or set to be visible to its role, or having as associated taxonomy term its username...)
THEMES : if subsites will be used only by logged-in users, use the same mechanism that you would use for filtering content [each user can natively pick a different theme if you allow them to], if they must appear with a different look also to anonymous users, then use the URI to pick up the appropriate theme (if visitor X reaches the site via user1.example.com the site will have the blue theme, whilst if the URI is user2.example.com the theme will be pink).
The multiple sites solution has the advantage that you have a real separation between subsites (with even a different DB). But you would then have to either sync or transfer "on the fly" data between the main site and the subsites. If you go for this solution, you should probably take a look at the following links:
the services module, which allows to easy set up webservices
this page explaining how to connect drupal to different databases (surely faster than using webservices... reasonable solution if you for example have sites and subsites running on the same server)
I didn't want to stick this in a small comment but I am in agreement with mac on many of his points (upvote!).
The best way would be to create your subdomains and have them be symbolic links in the site folder to the default / main-domain folder.
Given what you have told us, you are much better off creating a module that creates its own node types (or even just CCK) and use a combination of the permission system (CCK offers this as well through content_permission), Views, etc. No need for separate sites, just need users to look at their own content.
The beauty of this approach is you can use Flag to allow user's to friend each other, use Views to allow them to see friend's lists, etc.
Theme's can be set on the account level, so no issues there.
"Have their own men" - does this mean have their own block on the sidebar or header than has customized links or a completely different menu SYSTEM? Will need clarification before I can answer that.

Best practice to implement back functionality in flex

I'm not using deep linking, so all the pages/states appear as http://site.com
Is it still possible to implement back functionality in this case? It looks like flex has a browser history feature, but not sure if it would still work given that all the pages are at site.com
The other option is that I would save information in the main file itself so I can go to the last page and retrieve whatever data was on it.
Anyone can advise what's generally the best practice way to handle back functionality?
Unfortunately I don't know of any other way to implement browser history (ie, back/forward) without using deep linking (eg, example.com/#foo). This is how the Flex browser history components implement it.
However, one thing you could do, if you need to keep the URL static, is stick your Flex application in a frame. That way the outter frame would still show example.com while the inner frame is at, for example, example.com/#widget=42.
Check out the Flex docs on Deep Linking and the Browser Manager.
The best practice and generally the only way to do it is to use deep linking.
it's best because the users can add a section of your application to "Favorites" and that's an important feature to have IMHO.
Do you need to keep your website with just http:// site.com or is that just how it looks now because deep linking is not implemented?
Checkout Angela's Accessible Rich Internet Application tutorial which gives instructions on how to quickly and easily set up deep linking using UrlKit. The added bonus of this site is that the tutorial is delivered in the environment described... IE: you can view the source for an "in production" example of the implementation.

Context module for block visibility

I have a site built in Drupal 6 that requires a number of blocks that are only visible to certain roles or on specific pages. Normally, I would use the block configuration settings to control page and role visibility. However I recently ran across the context module that effectively splits the site into "sections" or "groups" of related attributes.
My question is: When is it appropriate to control block visibility from context rather than the block configuration settings? Should I only use one or the other or a combination of both?
these are different approaches meant for different use cases, but they are not mutually exclusive.
context indeed splits the site into different contexts (and there is also the possibility of context types). and that is effectively its use case: context-based block showing/positioning.
however context won't check for user roles nor multilingual settings (i18n). block supports these cases (and you can combine both context and block to show something on a context depending on user role).
block also allows users to choose whether they want to see the box or not.
my final answer is: combine instead of choosing.
There is no hard and fast rule for when to use core block placement, and when to use context. In general though, if you have a lot of blocks, with different and complex visibiity logic, context will make things more manageable. Additionally, contexts can be exported to code, which allows one to more easily track block configurations in version control. When storing contexts in code, this also allows changes to blocks to be deployed to a production site by simply updating the code, rather than needing to log in and manually move things around via the UI.

Resources