Skip to content

Commit

Permalink
fix tests (#444)
Browse files Browse the repository at this point in the history
fix acceptance test by using a fixed and unreleased version of the test package
  • Loading branch information
leafty authored Mar 27, 2024
1 parent c9c9b38 commit 2047521
Show file tree
Hide file tree
Showing 6 changed files with 267 additions and 67 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-and-push-to-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,7 @@ jobs:
build-args: |
RENKU_BASE=${{ steps.vars.outputs.renku_base }}
BASE_IMAGE=${{ matrix.BASE_IMAGE_NAME }}:${{ matrix.RVERSION }}
RSTUDIO_VERSION_OVERRIDE=${{ matrix.RSTUDIO_VERSION }}
context: docker/r
labels: ${{ steps.meta.outputs.labels }}
push: true
Expand Down
47 changes: 45 additions & 2 deletions tests/cypress/e2e/jupyterlab.cy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
import { basicJupyterTests } from "@renku/notebooks-cypress-tests";
import {
jupyterlabTestFuncs,
registerCustomCommands,
validateLogin,
} from "@renku/notebooks-cypress-tests";

basicJupyterTests(Cypress.env("URL"));
const username = Cypress.env("USERNAME");
const password = Cypress.env("PASSWORD");
const url_or_path = Cypress.env("URL");
const url =
url_or_path.slice(-1) === "/" ? url_or_path.slice(0, -1) : url_or_path;

describe("Test jupyter notebook", () => {
before(() => {
registerCustomCommands();
});
beforeEach(() => {
cy.session(
"login-rstudio",
() => {
cy.visit(url);
cy.renkuLoginIfRequired(username, password);
},
{
validate: () => validateLogin(username, password),
}
);
cy.visit(url);
cy.wait(100);
});
it("Successfully loads", jupyterlabTestFuncs.findExpectedElements);
it("Can launch a terminal", jupyterlabTestFuncs.launchTerminal);
it(
"Can run terminal command to create a file",
jupyterlabTestFuncs.makeFileWithTerminal("new-file.txt")
);
it(
"Can remove the file",
jupyterlabTestFuncs.removeFileWithTerminal("new-file.txt")
);
it("Can close the terminal", jupyterlabTestFuncs.closeTerminal);
it(
"Can find expected start page elements again",
jupyterlabTestFuncs.findExpectedElements
);
});
47 changes: 45 additions & 2 deletions tests/cypress/e2e/rstudio.cy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
import { basicRstudioTests } from "@renku/notebooks-cypress-tests";
import {
rstudioTestFuncs,
registerCustomCommands,
validateLogin,
} from "@renku/notebooks-cypress-tests";

basicRstudioTests(Cypress.env("URL"));
const username = Cypress.env("USERNAME");
const password = Cypress.env("PASSWORD");
const url_or_path = Cypress.env("URL");
const url =
url_or_path.slice(-1) === "/" ? url_or_path.slice(0, -1) : url_or_path;

describe("Basic Rstudio functionality", () => {
before(() => {
registerCustomCommands();
});
beforeEach(() => {
cy.session(
"login-rstudio",
() => {
cy.visit(url);
cy.renkuLoginIfRequired(username, password);
},
{
validate: () => validateLogin(username, password),
}
);
cy.visit(url);
cy.wait(100);
});
it("Successfully loads", rstudioTestFuncs.findExpectedElements);
it("Can launch a terminal", rstudioTestFuncs.launchTerminal);
it(
"Can run terminal command to create a file",
rstudioTestFuncs.makeFileWithTerminal("new-file.txt")
);
it(
"Can remove the file",
rstudioTestFuncs.removeFileWithTerminal("new-file.txt")
);
it("Can close the terminal", rstudioTestFuncs.closeTerminal);
it(
"Can find expected start page elements again",
rstudioTestFuncs.findExpectedElements
);
});
2 changes: 1 addition & 1 deletion tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe(`Starting container with image ${imageName} and name ${containerName}`,
configFile: "cypress.config.ts",
browser: "chrome"
})
assert_(!results.totalFailed, `Tests failed with errors on chrome.`)
assert_(results.status !== 'failed' && !results.totalFailed, `Tests failed with errors on chrome.`)
});
after(async function () {
console.log(`Stopping container with image ${imageName} and name ${containerName}`)
Expand Down
Loading

0 comments on commit 2047521

Please sign in to comment.