Skip to content

Commit

Permalink
e2e - sourceCodeActions.cy.ts flakyness fix attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
tplevko authored and lordrip committed Mar 14, 2024
1 parent f2b6fa9 commit 0bf85f5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ describe('Test for Multi route actions from the code editor', () => {
cy.uploadFixture('flows/MultiflowCR.yaml');
const stepToInsert = ` - setHeader:
constant: test`;
const insertLine = 8;
cy.editorAddText(insertLine, stepToInsert);
cy.editorAddText(9, stepToInsert);
cy.openDesignPage();

// CHECK the set-header step was added
Expand All @@ -76,9 +75,7 @@ describe('Test for Multi route actions from the code editor', () => {
cy.uploadFixture('flows/MultiflowCR.yaml');
const stepToInsert = ` - setBody:
constant: test`;
const insertLine = 19;

cy.editorAddText(insertLine, stepToInsert);
cy.editorAddText(20, stepToInsert);

cy.openDesignPage();
cy.showAllRoutes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ describe('Test source code editor', () => {
apiVersion: camel.apache.org/v1
name: insert-field-action
kind: Kamelet`;
const insertLine = 10;
cy.editorAddText(insertLine, stepToInsert);
cy.editorAddText(11, stepToInsert);
cy.openDesignPage();

// CHECK the insert-field-action step was added
Expand Down Expand Up @@ -66,13 +65,11 @@ describe('Test source code editor', () => {

it('User Add a new branch in the YAML', () => {
cy.uploadFixture('flows/ComplexKamelet.yaml');

const stepToInsert = `\n - simple: {{}{{}?test}}
const stepToInsert = ` - simple: {{}{{}?test}}
steps:
- to:
uri: atlasmap:null`;
const insertLine = 40;
cy.editorAddText(insertLine, stepToInsert);
cy.editorAddText(42, stepToInsert);
cy.openDesignPage();

// CHECK branch with atlasmap was created
Expand Down
6 changes: 2 additions & 4 deletions packages/ui-tests/cypress/e2e/designer/uriRouteConfig.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ describe('Test URI node config', () => {

it('User adds URI step to the YAML', () => {
cy.uploadFixture('flows/UriConfKamelet.yaml');
const insertLine = 43;
const stepToInsert = ` - to: aws2-s3:testBucket?autoCreateBucket=true`;
cy.editorAddText(insertLine, stepToInsert);
cy.editorAddText(43, stepToInsert);
cy.openDesignPage();

// CHECK the insert-field-action step was added
Expand All @@ -56,9 +55,8 @@ describe('Test URI node config', () => {

it('User adds URI step to the YAML', () => {
cy.uploadFixture('flows/UriConfRoute.yaml');
const insertLine = 10;
const stepToInsert = ` - to: aws2-s3:testBucket?autoCreateBucket=true`;
cy.editorAddText(insertLine, stepToInsert);
cy.editorAddText(11, stepToInsert);
cy.openDesignPage();

// CHECK the insert-field-action step was added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ metadata:
annotations:
camel.apache.org/kamelet.support.level: "Stable"
camel.apache.org/catalog.version: "main-SNAPSHOT"
camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTkuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIKCSB2aWV3Qm94PSIwIDAgNjAgNjAiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDYwIDYwOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxwYXRoIGQ9Ik00OC4wMTQsNDIuODg5bC05LjU1My00Ljc3NkMzNy41NiwzNy42NjIsMzcsMzYuNzU2LDM3LDM1Ljc0OHYtMy4zODFjMC4yMjktMC4yOCwwLjQ3LTAuNTk5LDAuNzE5LTAuOTUxCgljMS4yMzktMS43NSwyLjIzMi0zLjY5OCwyLjk1NC01Ljc5OUM0Mi4wODQsMjQuOTcsNDMsMjMuNTc1LDQzLDIydi00YzAtMC45NjMtMC4zNi0xLjg5Ni0xLTIuNjI1di01LjMxOQoJYzAuMDU2LTAuNTUsMC4yNzYtMy44MjQtMi4wOTItNi41MjVDMzcuODU0LDEuMTg4LDM0LjUyMSwwLDMwLDBzLTcuODU0LDEuMTg4LTkuOTA4LDMuNTNDMTcuNzI0LDYuMjMxLDE3Ljk0NCw5LjUwNiwxOCwxMC4wNTYKCXY1LjMxOWMtMC42NCwwLjcyOS0xLDEuNjYyLTEsMi42MjV2NGMwLDEuMjE3LDAuNTUzLDIuMzUyLDEuNDk3LDMuMTA5YzAuOTE2LDMuNjI3LDIuODMzLDYuMzYsMy41MDMsNy4yMzd2My4zMDkKCWMwLDAuOTY4LTAuNTI4LDEuODU2LTEuMzc3LDIuMzJsLTguOTIxLDQuODY2QzguODAxLDQ0LjQyNCw3LDQ3LjQ1OCw3LDUwLjc2MlY1NGMwLDQuNzQ2LDE1LjA0NSw2LDIzLDZzMjMtMS4yNTQsMjMtNnYtMy4wNDMKCUM1Myw0Ny41MTksNTEuMDg5LDQ0LjQyNyw0OC4wMTQsNDIuODg5eiIvPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K"
camel.apache.org/provider: "Apache Software Foundation"
camel.apache.org/kamelet.group: "Users"
labels:
Expand Down
19 changes: 13 additions & 6 deletions packages/ui-tests/cypress/support/next-commands/sourceCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@ Cypress.Commands.add('waitForEditorToLoad', () => {

Cypress.Commands.add('editorAddText', (line, text) => {
cy.waitForEditorToLoad();
text.split('\n').forEach((lineToWrite, i) => {
cy.get('.pf-v5-c-code-editor')
.click()
.type('{pageUp}{pageUp}' + '{downArrow}'.repeat(line + i) + '{enter}{upArrow}' + lineToWrite, {
delay: 1,
});
cy.get('.pf-v5-c-code-editor')
.click()
.type('{ctrl}' + '{g}', { delay: 1 });
// Select the line number where to insert the new text
cy.get('input[aria-describedby="quickInput_message"]')
.click()
.type(`${line}` + '{enter}');
// insert new line, so the new text can be added
cy.focused().type('{enter}{upArrow}', { delay: 1 });
text.split('\n').forEach((lineToWrite) => {
cy.focused().type('{enter}{enter}{upArrow}', { delay: 1 });
cy.focused().type('{ctrl}{l}', { delay: 1 });
cy.focused().type(lineToWrite, { delay: 1 });
});
});

Expand Down

0 comments on commit 0bf85f5

Please sign in to comment.