Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:/orchest/orchest into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ricklamers committed Oct 14, 2021
2 parents 1da9907 + 8d9733c commit 620dd2d
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 25 deletions.
2 changes: 1 addition & 1 deletion cypress/cypress.json
Expand Up @@ -8,6 +8,6 @@
"viewportHeight": 1080,
"videoCompression": false,
"videoUploadOnPasses": false,
"defaultCommandTimeout": 10000,
"defaultCommandTimeout": 15000,
"numTestsKeptInMemory": 1
}
7 changes: 4 additions & 3 deletions cypress/cypress/integration/interactive-runs.spec.ts
Expand Up @@ -8,6 +8,7 @@ import {
SAMPLE_PIPELINE_NAMES,
SAMPLE_STEP_NAMES,
setStepParameters,
piped_click,
} from "../support/common";

describe("interactive runs", () => {
Expand Down Expand Up @@ -270,8 +271,8 @@ describe("interactive runs", () => {
timeout: 20000,
});

// Press ESC to close the step menu.
cy.triggerESC();
// Close the step menu.
cy.findByTestId(TEST_ID.STEP_CLOSE_DETAILS).pipe(piped_click);

// Select and run B.
cy.wait(100);
Expand Down Expand Up @@ -362,7 +363,7 @@ describe("interactive runs", () => {
});

// Press ESC to close the step menu.
cy.triggerESC();
cy.findByTestId(TEST_ID.STEP_CLOSE_DETAILS).pipe(piped_click);

// Select and run B.
cy.wait(100);
Expand Down
3 changes: 2 additions & 1 deletion cypress/cypress/integration/jobs.spec.ts
Expand Up @@ -11,6 +11,7 @@ import {
DATA_DIR,
SAMPLE_JOB_NAMES,
JOB_STATUS,
piped_click,
} from "../support/common";

// Assumes to be in a JobView and that all runs can have their pipeline
Expand Down Expand Up @@ -40,7 +41,7 @@ function verifyJobRunsParameters(stepName: string, expectedParameters: {}[]) {
})
.then((stepParams) => {
// Close the step panel.
cy.triggerESC();
cy.findByTestId(TEST_ID.STEP_CLOSE_DETAILS).pipe(piped_click);

// Get the pipeline parameters.
cy.findByTestId(TEST_ID.PIPELINE_SETTINGS).click();
Expand Down
3 changes: 2 additions & 1 deletion cypress/cypress/integration/pipelines.spec.ts
Expand Up @@ -6,6 +6,7 @@ import {
SAMPLE_PROJECT_NAMES,
SAMPLE_PIPELINE_NAMES,
SAMPLE_STEP_NAMES,
piped_click,
} from "../support/common";

let pathTestCases = [
Expand Down Expand Up @@ -205,7 +206,7 @@ describe("pipelines", () => {
cy.get(`[data-test-title=${SAMPLE_STEP_NAMES.ST1}]`)
.scrollIntoView()
.click({ force: true });
cy.findByTestId(TEST_ID.STEP_VIEW_IN_JUPYTERLAB).click();
cy.findByTestId(TEST_ID.STEP_VIEW_IN_JUPYTERLAB).pipe(piped_click);
waitForJupyterlab();
});
});
Expand Down
33 changes: 17 additions & 16 deletions cypress/cypress/support/commands.ts
@@ -1,10 +1,12 @@
import "cypress-localstorage-commands";
import "cypress-pipe";
import "@testing-library/cypress/add-commands";
import { TEST_ID } from "../support/common";
import { LOCAL_STORAGE_KEY } from "../support/common";
import { DATA_DIR } from "../support/common";
import { PROJECTS_DIR } from "../support/common";
import { assertTotalEnvironmentImages } from "../support/common";
import { piped_click } from "../support/common";

type TBooleanString = "true" | "false";

Expand Down Expand Up @@ -55,7 +57,6 @@ declare global {
project?: string,
environment?: string
): Chainable<number>;
triggerESC(): Chainable<undefined>;
}
}
}
Expand Down Expand Up @@ -270,32 +271,39 @@ Cypress.Commands.add(
(title: string, createNewFile?: boolean, fileName?: string) => {
cy.location("pathname").should("eq", "/pipeline");
cy.intercept("POST", /.*/).as("allPosts");
cy.findByTestId(TEST_ID.STEP_CREATE).click();
cy.findByTestId(TEST_ID.STEP_CREATE).should("be.visible").pipe(piped_click);
cy.findByTestId(TEST_ID.STEP_TITLE_TEXTFIELD)
.type("{selectall}{backspace}")
.type(title);
cy.findByTestId(TEST_ID.FILE_PICKER_FILE_PATH_TEXTFIELD).click();
cy.wait("@allPosts");
cy.findByTestId(TEST_ID.FILE_PICKER_FILE_PATH_TEXTFIELD).pipe(piped_click);
if (createNewFile) {
cy.findByTestId(TEST_ID.FILE_PICKER_NEW_FILE).click();
cy.findByTestId(TEST_ID.FILE_PICKER_NEW_FILE).pipe(piped_click);
cy.findByTestId(
TEST_ID.PROJECT_FILE_PICKER_CREATE_NEW_FILE_DIALOG
).should("be.visible");
if (fileName !== undefined) {
cy.findByTestId(TEST_ID.PROJECT_FILE_PICKER_FILE_NAME_TEXTFIELD)
.type("{selectall}{backspace}")
.type(fileName);
cy.wait("@allPosts");
}
cy.findByTestId(TEST_ID.PROJECT_FILE_PICKER_CREATE_FILE).click();
cy.findByTestId(TEST_ID.PROJECT_FILE_PICKER_CREATE_FILE)
// Apparently, using a piped_click here won't work, i.e the step
// will be updated with the new file at the json level, but the
// UI state will not, the step will still show the placeholder
// name.
.should("be.visible")
.click();
} else if (fileName !== undefined) {
cy.findByTestId(TEST_ID.FILE_PICKER_FILE_PATH_TEXTFIELD)
.type("{selectall}{backspace}")
.type(fileName);
}
cy.wait("@allPosts");
// press esc to close the step menu.
cy.get("body").trigger("keydown", { keycode: 27 });
cy.wait(100);
cy.get("body").trigger("keyup", { keycode: 27 });
cy.findByTestId(TEST_ID.STEP_CLOSE_DETAILS)
.should("be.visible")
.pipe(piped_click);
}
);

Expand Down Expand Up @@ -374,13 +382,6 @@ Cypress.Commands.add(
}
);

Cypress.Commands.add("triggerESC", () => {
// Press ESC to close the step menu.
cy.get("body").trigger("keydown", { keyCode: 27 });
cy.wait(100);
cy.get("body").trigger("keyup", { keyCode: 27 });
});

Cypress.Commands.add(
"totalEnvironmentImages",
(project?: string, environment?: string) => {
Expand Down
5 changes: 5 additions & 0 deletions cypress/cypress/support/common.ts
Expand Up @@ -459,3 +459,8 @@ export function assertEnvIsBuilt() {

cy.goToMenu("pipelines");
}

// Used in conjunction with cypress-pipe as an attempt to fix DOM
// detachment and focus trap issues. See
// https://github.com/cypress-io/cypress/issues/7306
export const piped_click = ($el) => $el.click();
3 changes: 2 additions & 1 deletion cypress/package.json
Expand Up @@ -15,6 +15,7 @@
"@testing-library/cypress": "7.0.7",
"cypress-localstorage-commands": "1.5.0",
"@types/node": "15.0.1",
"typescript": "4.3.2"
"typescript": "4.3.2",
"cypress-pipe": "2.0.0"
}
}
10 changes: 8 additions & 2 deletions cypress/tsconfig.json
Expand Up @@ -4,7 +4,13 @@
"allowJs": true,
"baseUrl": ".",
"isolatedModules": false,
"types": ["node", "cypress", "cypress-localstorage-commands", "@testing-library/cypress"],
"types": [
"node",
"cypress",
"cypress-localstorage-commands",
"cypress-pipe",
"@testing-library/cypress"
]
},
"include": ["**/*.ts"]
}
}
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 620dd2d

Please sign in to comment.