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

Overhaul images, videos, and Git UI + repo cleanup #61

Merged
merged 32 commits into from
Oct 2, 2024
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6d9c1df
add init button
rogermparent Sep 25, 2024
2e2d7a1
tests b
rogermparent Sep 25, 2024
9287369
edit b a bit
rogermparent Sep 25, 2024
e828656
fix new tests
rogermparent Sep 26, 2024
c624490
Rename test image and suppress bugged image resize cache
rogermparent Sep 26, 2024
0e1f48c
resizing b
rogermparent Sep 26, 2024
18369c6
Ignore current transforms
rogermparent Sep 26, 2024
4350e6e
edit resize test B
rogermparent Sep 27, 2024
0761c4c
fix tests, remove broken tests from portfolio
rogermparent Sep 27, 2024
c43ef73
Fix build, rename image props, set stage for video test debug
rogermparent Sep 27, 2024
ca3ad33
video test b
rogermparent Sep 27, 2024
6d55583
fix vid test
rogermparent Sep 27, 2024
a1fd30e
refactors a
rogermparent Sep 27, 2024
1d13c5c
edit a
rogermparent Sep 27, 2024
5d76684
improved git b
rogermparent Sep 27, 2024
a629346
improve branch form and tests
rogermparent Sep 28, 2024
14766ca
git log tests a
rogermparent Sep 28, 2024
f96232c
re-add old tests
rogermparent Sep 28, 2024
4d86356
only new tests
rogermparent Sep 28, 2024
b9bd363
git log UI B
rogermparent Sep 28, 2024
bf217e3
Edit git log B
rogermparent Sep 28, 2024
14c28a9
Add git bundle fixture support
rogermparent Sep 28, 2024
d937195
Catch errors in branch create and clean comments
rogermparent Sep 28, 2024
84f244d
remote branches b
rogermparent Sep 28, 2024
4ab8838
branchlocal
rogermparent Sep 28, 2024
fb72550
Create RemoteSelector frontend with stub action
rogermparent Sep 29, 2024
4221106
remote tests A
rogermparent Sep 29, 2024
ddc2a80
remote code a
rogermparent Sep 29, 2024
f153fa2
Edit A
rogermparent Sep 29, 2024
abd3363
remote changes a
rogermparent Sep 29, 2024
8def64e
Fix git remote tests
rogermparent Oct 2, 2024
f2346fd
remove .only
rogermparent Oct 2, 2024
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
Prev Previous commit
Next Next commit
git log tests a
rogermparent committed Sep 28, 2024
commit 14766ca216295f17f7f8bc27f41419af4813ca40
209 changes: 81 additions & 128 deletions websites/recipe-website/editor/cypress/e2e/git.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
describe("Git content", function () {
describe("when empty", function () {
it("should navigate to the Git UI from home and create a branch", function () {
it("should display an empty git log", function () {
cy.resetData();
cy.initializeContentGit();
cy.visit("/");
@@ -9,127 +9,37 @@ describe("Git content", function () {
cy.fillSignInForm();
cy.findByText("Git").click();

cy.findByLabelText("Branch Name").type("other-branch");
cy.findByText("Create").click();
cy.findByText("Branches").should("exist");
cy.findByText("other-branch").should("exist");
});

it("should initialize a Git repository", function () {
cy.resetData();
cy.visit("/git");
cy.fillSignInForm();

cy.findByText("Content directory is not tracked with Git.").should(
"exist",
);

cy.findByText("Initialize").click();
cy.findByText("Content directory is not tracked with Git.").should(
"not.exist",
);
cy.findByText("Branches").should("exist");
});

it("should display an error message when creating a branch with an empty name", function () {
cy.resetData();
cy.initializeContentGit();
cy.visit("/git");
cy.fillSignInForm();

cy.findByText("Create").click();

// Adjust to fit your error message if needed
cy.findByText("Branch Name is required").should("exist");
});

it("should display an error message when using checkout with no selected branch", function () {
cy.resetData();
cy.initializeContentGit();
cy.visit("/git");
cy.fillSignInForm();

cy.findByRole("radio").should("not.be.checked");

cy.findByText("Checkout").should("be.disabled");
cy.findByText("Checkout").invoke("attr", "disabled", false);
cy.findByText("Checkout").click({ force: true });

// Adjust to fit your error message if needed
cy.findByText("Invalid branch").should("exist");
cy.findByText("No commits yet").should("exist");
});
});

it("should display an error message when using delete with no selected branch", function () {
cy.resetData();
cy.initializeContentGit();
cy.visit("/git");
cy.fillSignInForm();

cy.findByRole("radio").should("not.be.checked");

cy.findByText("Delete").should("be.disabled");
cy.findByText("Delete").invoke("attr", "disabled", false);
cy.findByText("Delete").click({ force: true });

// Adjust to fit your error message if needed
cy.findByText("Invalid branch").should("exist");
});

it("should display an error message when using force delete with no selected branch", function () {
cy.resetData();
cy.initializeContentGit();
cy.visit("/git");
cy.fillSignInForm();

cy.findByRole("radio").should("not.be.checked");
describe("when not empty", function () {
const firstRecipeName = "Recipe A";
const secondRecipeName = "Recipe B";

cy.findByText("Force Delete").should("be.disabled");
cy.findByText("Force Delete").invoke("attr", "disabled", false);
cy.findByText("Force Delete").click({ force: true });
const firstRecipeSlug = "recipe-a";
const secondRecipeSlug = "recipe-b";

// Adjust to fit your error message if needed
cy.findByText("Invalid branch").should("exist");
});
const editedTestName = "edited";

it("should indicate when the content directory is not tracked by git", function () {
cy.resetData();
cy.visit("/git");
cy.fillSignInForm();
const mainBranchName = "main";
const otherBranchName = "other-branch";

cy.findByText("Content directory is not tracked with Git.");
cy.findAllByText("Branches").should("not.exist");
});
function makeTestRecipe(recipeName: string) {
cy.visit("/new-recipe");
cy.findByLabelText("Name").type(recipeName);
cy.findByText("Submit").click();
cy.findByText(recipeName, { selector: "h1" });
}

it("should be able to work with a git-tracked content directory", function () {
beforeEach(function () {
cy.resetData();
cy.initializeContentGit();
cy.visit("/");

// Verify we're at the initial commit state
cy.getContentGitLog().should("have.ordered.members", ["Initial Commit"]);

cy.findByText("Sign In").click();
cy.fillSignInForm();

const firstRecipeName = "Recipe A";
const secondRecipeName = "Recipe B";

const firstRecipeSlug = "recipe-a";
const secondRecipeSlug = "recipe-b";

const editedTestName = "edited";
//const editedTestSlug = "edited";

const mainBranchName = "main";
const otherBranchName = "other-branch";

function makeTestRecipe(recipeName: string) {
cy.visit("/new-recipe");
cy.findByLabelText("Name").type(recipeName);
cy.findByText("Submit").click();
cy.findByText(recipeName, { selector: "h1" });
}

// Make two recipes to build some test history
makeTestRecipe(firstRecipeName);
makeTestRecipe(secondRecipeName);
@@ -164,38 +74,81 @@ describe("Git content", function () {
`Add new recipe: ${firstRecipeSlug}`,
"Initial Commit",
]);
cy.visit("/");
cy.checkNamesInOrder([editedTestName]);

// Checkout main
cy.findByText("Settings").click();
cy.findByText("Git").click();
cy.findByText(mainBranchName, { selector: "label" }).click();
cy.findByText("Checkout").click();
cy.findByLabelText("main").should("be.disabled");
});

// Verify we're in the state we were in when the branch was copied
cy.visit("/");
cy.checkNamesInOrder([secondRecipeName, firstRecipeName]);
it("should display the git log below the branches menu", function () {
cy.visit("/git");
cy.findByText("Branches").should("exist");
cy.findByText("Initial Commit").should("exist");
cy.findByText(`Add new recipe: ${firstRecipeSlug}`).should("exist");
cy.findByText(`Add new recipe: ${secondRecipeSlug}`).should("exist");
cy.findByText(`Update recipe: ${secondRecipeSlug}`).should("exist");
cy.findByText(`Delete recipe: ${firstRecipeSlug}`).should("exist");
});

it("should display the correct commit order in the git log", function () {
cy.visit("/git");
cy.getContentGitLog().should("have.ordered.members", [
`Delete recipe: ${firstRecipeSlug}`,
`Update recipe: ${secondRecipeSlug}`,
`Add new recipe: ${secondRecipeSlug}`,
`Add new recipe: ${firstRecipeSlug}`,
"Initial Commit",
]);
});

it("should display commit details when clicking on a commit", function () {
cy.visit("/git");
// Test delete: try to normal delete branch which should fail because unmerged
cy.findByText("other-branch").click();
cy.findByText("Delete").click();
cy.findByText(`Update recipe: ${secondRecipeSlug}`).click();

cy.findByText("Commit Details").should("exist");
cy.findByText(`Update recipe: ${secondRecipeSlug}`).should("exist");
cy.findByText("Author").should("exist");
cy.findByText("Date").should("exist");
cy.findByText("Diff").should("exist");

cy.findByText("Close").click();
cy.findByText("Commit Details").should("not.exist");
});

it("should display the correct commit details", function () {
cy.visit("/git");
cy.findByText(`Update recipe: ${secondRecipeSlug}`).click();

cy.findByText("Commit Details").should("exist");
cy.findByText(`Update recipe: ${secondRecipeSlug}`).should("exist");
cy.findByText("Author").should("exist");
cy.findByText("Date").should("exist");
cy.findByText("Diff").should("exist");

cy.findByText("- Name: Recipe B").should("exist");
cy.findByText("+ Name: edited").should("exist");
});

it("should display the correct commit details for a delete commit", function () {
cy.visit("/git");
cy.findByText(`Delete recipe: ${firstRecipeSlug}`).click();

cy.findByText("Commit Details").should("exist");
cy.findByText(`Delete recipe: ${firstRecipeSlug}`).should("exist");
cy.findByText("Author").should("exist");
cy.findByText("Date").should("exist");
cy.findByText("Diff").should("exist");

cy.findByText(/the branch 'other-branch' is not fully merged/);
cy.findByText(`- Recipe A`).should("exist");
});

it("should display the correct commit details for an add commit", function () {
cy.visit("/git");
cy.findByText(`Add new recipe: ${firstRecipeSlug}`).click();

// Test force delete: delete should succeed and branch should be removed
cy.findByText("other-branch").click();
cy.findByText("Force Delete").click();
cy.findByText("Commit Details").should("exist");
cy.findByText(`Add new recipe: ${firstRecipeSlug}`).should("exist");
cy.findByText("Author").should("exist");
cy.findByText("Date").should("exist");
cy.findByText("Diff").should("exist");

cy.findAllByText("other-branch").should("not.exist");
cy.findByText(`+ Recipe A`).should("exist");
});
});
});