mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
fix: Add commands for tab interception and visiting (no-changelog) (#15866)
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
clickCreateNewCredential,
|
||||
getNdvContainer,
|
||||
selectResourceLocatorAddResourceItem,
|
||||
clickGetBackToCanvas,
|
||||
} from '../composables/ndv';
|
||||
import * as projects from '../composables/projects';
|
||||
import {
|
||||
@@ -294,14 +295,12 @@ describe('Projects', { disableAutoLogin: true }, () => {
|
||||
workflowPage.actions.saveWorkflowOnButtonClick();
|
||||
workflowPage.actions.addNodeToCanvas('Execute Workflow', true, true);
|
||||
|
||||
// This mock fails when running with `test:e2e:dev` but works with `test:e2e:ui`,
|
||||
// at least on macOS at version 1.94.0. ¯\_(ツ)_/¯
|
||||
cy.window().then((win) => cy.stub(win, 'open').callsFake((url) => cy.visit(url)));
|
||||
|
||||
cy.interceptNewTab();
|
||||
selectResourceLocatorAddResourceItem('workflowId', 'Create a');
|
||||
// Need to wait for the trigger node to auto-open after a delay
|
||||
|
||||
cy.visitInterceptedTab();
|
||||
getNdvContainer().should('be.visible');
|
||||
cy.get('body').type('{esc}');
|
||||
clickGetBackToCanvas();
|
||||
workflowPage.actions.addNodeToCanvas(NOTION_NODE_NAME, true, true);
|
||||
clickCreateNewCredential();
|
||||
setCredentialValues({
|
||||
|
||||
@@ -240,3 +240,18 @@ Cypress.Commands.add('resetDatabase', () => {
|
||||
admin: INSTANCE_ADMIN,
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('interceptNewTab', () => {
|
||||
cy.window().then((win) => {
|
||||
cy.stub(win, 'open').as('windowOpen');
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('visitInterceptedTab', () => {
|
||||
cy.get('@windowOpen')
|
||||
.should('have.been.called')
|
||||
.then((stub: any) => {
|
||||
const url = stub.firstCall.args[0];
|
||||
cy.visit(url);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -86,6 +86,8 @@ declare global {
|
||||
>;
|
||||
resetDatabase(): void;
|
||||
setAppDate(targetDate: number | Date): void;
|
||||
interceptNewTab(): Chainable<void>;
|
||||
visitInterceptedTab(): Chainable<void>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user