Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(client): make all fixtures use default options #2864

Merged
merged 31 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1b6cf49
wip: refactor e2e tests
leafty Oct 23, 2023
30db8f2
wip: refactored all commands
leafty Oct 24, 2023
fad623c
cleanup
leafty Oct 24, 2023
aa5bded
wip: refactor e2e fixtures
leafty Oct 24, 2023
a28bb86
wip: refactor fixtures
leafty Oct 24, 2023
06b3dfa
wip: refactor fixtures
leafty Oct 24, 2023
91a4148
wip: refactor fixtures (projects)
leafty Oct 25, 2023
187406d
wip: refactor fixtures (projects)
leafty Oct 25, 2023
dfa05e9
wip: refactor fixtures (projects)
leafty Oct 26, 2023
3fe586a
Merge remote-tracking branch 'origin/master' into leafty/refactor-cyp…
leafty Oct 26, 2023
79de24c
done pass 1
leafty Oct 26, 2023
04317b7
always mock network
leafty Oct 26, 2023
baec7e8
cleanup
leafty Oct 26, 2023
2385ca7
simplify
leafty Oct 26, 2023
ad2de66
cleanup
leafty Oct 26, 2023
0fd36c8
Merge remote-tracking branch 'origin/master' into leafty/refactor-cyp…
leafty Oct 27, 2023
95cf18d
fixes
leafty Oct 27, 2023
87908e9
improve dashboard wait
leafty Oct 27, 2023
5127348
address review - part 1
leafty Oct 27, 2023
e1b88f9
address review - part 2
leafty Oct 27, 2023
d2dc134
fixes
leafty Oct 27, 2023
13a259d
fixes
leafty Oct 27, 2023
1cb0d42
cleanup
leafty Oct 30, 2023
3030df2
remove only
leafty Oct 30, 2023
55fa2ba
try to fix flaky test - Cloud storage settings page / is accessible f…
leafty Oct 30, 2023
84fc15f
Merge remote-tracking branch 'origin/master' into leafty/refactor-cyp…
leafty Oct 30, 2023
d029a48
adjust tests
leafty Oct 30, 2023
679569b
try to fix flaky tests
leafty Oct 30, 2023
9255df0
Apply suggestions from code review
leafty Nov 1, 2023
037428a
apply suggestion
leafty Nov 1, 2023
3e86b2c
Merge remote-tracking branch 'origin/master' into leafty/refactor-cyp…
leafty Nov 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion tests/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export default defineConfig({
specPattern: "cypress/e2e/**/*.{js,jsx,ts,tsx}",
},
env: {
USE_FIXTURES: true,
CLOUD_STORAGE_READWRITE_ENABLED: false,
},
retries: {
Expand Down
92 changes: 35 additions & 57 deletions tests/cypress/e2e/addDatasetToProject.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,24 @@
* limitations under the License.
*/

import Fixtures from "../support/renkulab-fixtures";
import fixtures from "../support/renkulab-fixtures";

describe("Add dataset to existing project", () => {
const fixtures = new Fixtures(cy);
fixtures.useMockedData = Cypress.env("USE_FIXTURES") === true;
const datasetName = "abcd";
const datasetIdentifier = "4577b68957b7478bba1f07d6513b43d2";
const pathOrigin = "e2e/testing-datasets";
const projectSelected = "e2e/local-test-project";

beforeEach(() => {
fixtures.config().versions().userTest();
fixtures.landingUserProjects(
"getLandingUserProjects",
"projects/member-projects.json"
);
fixtures.datasetById(datasetIdentifier);
fixtures.landingUserProjects({ fixture: "projects/member-projects.json" });
fixtures.datasetById({ id: datasetIdentifier });
fixtures
.project(pathOrigin, "getProject", "projects/project.json", false)
.project({ projectPath: pathOrigin, statistics: false })
.cacheProjectList();
fixtures.projectMigrationUpToDate({
name: "migrationCheckDatasetProject",
queryUrl: "*",
fixtureName: "migrationCheckDatasetProject",
});
fixtures.importToProject();
fixtures.importJobCompleted();
Expand Down Expand Up @@ -70,8 +65,8 @@ describe("Add dataset to existing project", () => {
});

it("successfully import dataset", () => {
fixtures.projectTestContents(undefined, 9);
fixtures.projectKGDatasetList(projectSelected);
fixtures.projectTestContents({ coreServiceV8: { coreVersion: 9 } });
fixtures.projectKGDatasetList({ projectPath: projectSelected });
fixtures.projectDatasetList();
fixtures.projectTest();
fixtures.projectLockStatus();
Expand Down Expand Up @@ -120,8 +115,6 @@ describe("Add dataset to existing project", () => {
});

describe("Add dataset to new project", () => {
const fixtures = new Fixtures(cy);
fixtures.useMockedData = Cypress.env("USE_FIXTURES") === true;
const datasetName = "abcd";
const datasetIdentifier = "4577b68957b7478bba1f07d6513b43d2";
const pathOrigin = "e2e/testing-datasets";
Expand All @@ -132,19 +125,15 @@ describe("Add dataset to new project", () => {
fixtures.config().versions().userTest().namespaces().templates();
fixtures
.projects()
.landingUserProjects(
"getLandingUserProjects",
"projects/member-projects.json"
);
fixtures.datasetById(datasetIdentifier);
.landingUserProjects({ fixture: "projects/member-projects.json" });
fixtures.datasetById({ id: datasetIdentifier });
fixtures
.project(pathOrigin, "getProject", "projects/project.json", false)
.project({ projectPath: pathOrigin, statistics: false })
.cacheProjectList();
fixtures.interceptMigrationCheck(
"migrationCheckDatasetProject",
"project/migrationStatus/level1-all-good.json",
"*"
);
fixtures.interceptMigrationCheck({
name: "migrationCheckDatasetProject",
queryUrl: "*",
});
cy.visit(`datasets/${datasetIdentifier}/add`);
fixtures.importToProject();
fixtures.importJobCompleted();
Expand All @@ -158,22 +147,16 @@ describe("Add dataset to new project", () => {
});

it("valid dataset, successful import", () => {
fixtures.interceptMigrationCheck(
"migrationCheckSelectedProject",
"project/migrationStatus/level1-all-good.json",
"*"
);
fixtures.projectTestContents(undefined, 9);
fixtures.projectKGDatasetList(newProjectPath);
fixtures.interceptMigrationCheck({
name: "migrationCheckSelectedProject",
queryUrl: "*",
});
fixtures.projectTestContents({ coreServiceV8: { coreVersion: 9 } });
fixtures.projectKGDatasetList({ projectPath: newProjectPath });
fixtures.projectDatasetList();
// fill form new project
cy.createProjectAndAddDataset(newProjectTitle, newProjectPath, fixtures);
fixtures.project(
newProjectPath,
"getNewProject2",
"projects/project.json",
true
);
fixtures.project({ name: "getNewProject2", projectPath: newProjectPath });
cy.wait("@importToProject");
cy.wait("@importJobCompleted", { timeout: 20_000 });
cy.url().should(
Expand All @@ -184,11 +167,10 @@ describe("Add dataset to new project", () => {
});

it("error importing dataset", () => {
fixtures.interceptMigrationCheck(
"migrationCheckSelectedProject",
"project/migrationStatus/level1-all-good.json",
"*"
);
fixtures.interceptMigrationCheck({
name: "migrationCheckSelectedProject",
queryUrl: "*",
});
fixtures.importJobError();
cy.createProjectAndAddDataset(newProjectTitle, newProjectPath, fixtures);
cy.wait("@importToProject");
Expand All @@ -201,36 +183,32 @@ describe("Add dataset to new project", () => {
});

describe("Invalid dataset", () => {
const fixtures = new Fixtures(cy);
fixtures.useMockedData = Cypress.env("USE_FIXTURES") === true;
beforeEach(() => {
fixtures.config().versions().userTest();
fixtures
.projects()
.landingUserProjects(
"getLandingUserProjects",
"projects/member-projects.json"
);
.landingUserProjects({ fixture: "projects/member-projects.json" });
});

it("displays warning when dataset doesn't exist", () => {
const datasetIdentifier = "4577b68957b7478bba1f07d6513b43d2";
fixtures.invalidDataset(datasetIdentifier);
fixtures.invalidDataset({ id: datasetIdentifier });
cy.visit(`datasets/${datasetIdentifier}/add`);
cy.wait("@invalidDataset");
cy.get("h3").contains("Dataset not found").should("be.visible");
});

it("displays warning when dataset is invalid", () => {
const datasetIdentifier = "4577b68957b7478bba1f07d6513b43d2";
fixtures.datasetById(datasetIdentifier);
fixtures.datasetById({ id: datasetIdentifier });
const pathOrigin = "e2e/testing-datasets";
fixtures.errorProject(pathOrigin).cacheProjectList();
fixtures.interceptMigrationCheck(
"migrationCheckDatasetProject",
"project/migrationStatus/level1-all-good.json",
"*"
);
fixtures
.errorProject({ project: { projectPath: pathOrigin } })
.cacheProjectList();
fixtures.interceptMigrationCheck({
name: "migrationCheckDatasetProject",
queryUrl: "*",
});
cy.visit(`datasets/${datasetIdentifier}/add`);
cy.wait("@getDatasetById");
cy.wait("@getErrorProject");
Expand Down
3 changes: 1 addition & 2 deletions tests/cypress/e2e/adminPage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
* limitations under the License.
*/

import Fixtures from "../support/renkulab-fixtures";
import fixtures from "../support/renkulab-fixtures";

describe("admin page", () => {
const fixtures = new Fixtures(cy);
beforeEach(() => {
fixtures.config().versions();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/cypress/e2e/autostartSession.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
* limitations under the License.
*/

import Fixtures from "../support/renkulab-fixtures";
import fixtures from "../support/renkulab-fixtures";

describe("launch autostart sessions", () => {
const fixtures = new Fixtures(cy);
const projectUrl = "/projects/e2e/local-test-project";
beforeEach(() => {
fixtures.config().versions().projects().landingUserProjects();
Expand Down
23 changes: 6 additions & 17 deletions tests/cypress/e2e/coreServiceVersion.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/**
* Fix the core service version to specific values and test a few calls
*/
import Fixtures from "../support/renkulab-fixtures";
import fixtures from "../support/renkulab-fixtures";

const config = {
overrides: {
Expand All @@ -33,15 +33,9 @@ const config = {
};

describe("display a project", () => {
const fixtures = new Fixtures(cy);
fixtures.useMockedData = true;
beforeEach(() => {
fixtures.config(config).versions().userTest();
fixtures
.projects()
.landingUserProjects()
.projectTest()
.projectById("getProjectsById", 39646);
fixtures.projects().landingUserProjects().projectTest().projectById();
fixtures.projectLockStatus().projectMigrationUpToDate();
cy.visit("/projects/e2e/local-test-project");
});
Expand Down Expand Up @@ -72,21 +66,16 @@ describe("display a project", () => {
});

describe("Project dataset", () => {
const fixtures = new Fixtures(cy);
fixtures.useMockedData = Cypress.env("USE_FIXTURES") === true;
const projectPath = "e2e/testing-datasets";

beforeEach(() => {
fixtures.config(config).versions().userTest();
fixtures.projects().landingUserProjects();
fixtures.project(projectPath);
fixtures.projectKGDatasetList(projectPath);
fixtures.project({ projectPath });
fixtures.projectKGDatasetList({ projectPath });
fixtures.projectDatasetList();
fixtures.projectTestContents(undefined, 9);
fixtures.projectMigrationUpToDate({
queryUrl: "*",
fixtureName: "getMigration",
});
fixtures.projectTestContents({ coreServiceV8: { coreVersion: 9 } });
fixtures.projectMigrationUpToDate({ queryUrl: "*" });
fixtures.projectLockStatus();
});

Expand Down
Loading