-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
134 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
describe("create zlink in collection", () => { | ||
let url; | ||
beforeEach(() => { | ||
cy.app("clean"); | ||
cy.createUser("testuser").then((user) => { | ||
url = cy.createUrl({ | ||
keyword: "cla", | ||
url: "https://cla.umn.edu", | ||
group_id: user.context_group_id, | ||
}); | ||
}); | ||
|
||
cy.login("testuser"); | ||
}); | ||
|
||
context("url show page (aka stats page)", () => { | ||
beforeEach(() => { | ||
cy.visit("/shortener/urls/cla"); | ||
}); | ||
|
||
it("adds a note to a url", () => { | ||
cy.get("[data-cy='note-form']").within(() => { | ||
cy.get("[data-cy='note-input']").type("This is a note"); | ||
cy.contains("Save").click(); | ||
}); | ||
|
||
cy.contains("Note saved").should("be.visible"); | ||
|
||
// reload the page | ||
cy.visit("/shortener/urls/cla"); | ||
// check that the note is there | ||
cy.get("[data-cy='note-input']").should("contain", "This is a note"); | ||
}); | ||
|
||
it("limits the note contents to 1000 characters", () => { | ||
cy.get("[data-cy='note-form']").within(() => { | ||
cy.get("[data-cy='note-input']").type("a".repeat(1001), { delay: 0 }); | ||
cy.contains("Save").click(); | ||
}); | ||
|
||
cy.contains("Note is too long").should("be.visible"); | ||
}); | ||
}); | ||
|
||
context("url index page", () => { | ||
beforeEach(() => { | ||
cy.visit("/shortener/urls"); | ||
}); | ||
|
||
it("edits a note and shows it in the table", () => { | ||
cy.get("#urls-table").contains("cla").closest("tr").as("claRow"); | ||
cy.get("@claRow").find(".dropdown").as("claDropdown"); | ||
cy.get("@claDropdown").find(".actions-dropdown-button").click(); | ||
cy.get("@claDropdown").contains("Edit").click(); | ||
|
||
cy.get("[data-cy='note-input']").type("edited note"); | ||
|
||
cy.contains("Submit").click(); | ||
|
||
// check that the note is in the table row | ||
cy.get("@claRow").contains("edited note").should("be.visible"); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddUrlNote < ActiveRecord::Migration[7.1] | ||
def change | ||
add_column :urls, :note, :text, null: true, default: nil | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters