Find Item e2e test
This adds a "find item" e2e test that confirms matching items show, and non-matching items don't. I also implemented the `waitForAnimations` config, but I found the results inconsistent via CLI, so I left those in, after much experimentation. There are a couple of improvements on reducing the number of `.find()` calls in the Cypress tests, when the elements aren't rendered in the Shadow DOM.
This commit is contained in:
parent
12f5e04f7f
commit
fe8e014ba8
|
@ -4,5 +4,6 @@
|
||||||
"video": false,
|
"video": false,
|
||||||
"chromeWebSecurity": false,
|
"chromeWebSecurity": false,
|
||||||
"screenshotOnRunFailure": false,
|
"screenshotOnRunFailure": false,
|
||||||
"videoUploadOnPasses": false
|
"videoUploadOnPasses": false,
|
||||||
|
"waitForAnimations": true
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,25 +5,24 @@ const testItem = {
|
||||||
url: "https://google.com",
|
url: "https://google.com",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const itemSearch = {
|
||||||
|
existing: "secret",
|
||||||
|
nonexistent: "apple",
|
||||||
|
};
|
||||||
|
|
||||||
describe("Items", () => {
|
describe("Items", () => {
|
||||||
it("can create an item without errors", () => {
|
it("can create an item without errors", () => {
|
||||||
cy.login();
|
cy.login();
|
||||||
|
|
||||||
// Click plus sign
|
// Click plus sign
|
||||||
cy.get("pl-app").find("pl-items").find("pl-items-list").find("pl-button:eq(2)").click({ force: true });
|
cy.get("pl-app").find("pl-items").find("pl-items-list").find("pl-button:eq(2)").click();
|
||||||
|
|
||||||
// Give the app some time to render the animations
|
|
||||||
cy.wait(100);
|
|
||||||
|
|
||||||
// Click create
|
// Click create
|
||||||
cy.get("pl-app").find("pl-create-item-dialog").find("footer pl-button.primary").click({ force: true });
|
cy.get("pl-app").find("pl-create-item-dialog").find("footer pl-button.primary").click();
|
||||||
|
|
||||||
cy.url().should("include", "/items/");
|
cy.url().should("include", "/items/");
|
||||||
cy.url().should("include", "/new");
|
cy.url().should("include", "/new");
|
||||||
|
|
||||||
// Give the app some (more) time to render the animations
|
|
||||||
cy.wait(100);
|
|
||||||
|
|
||||||
// Fill in form
|
// Fill in form
|
||||||
cy.get("pl-app")
|
cy.get("pl-app")
|
||||||
.find("pl-items")
|
.find("pl-items")
|
||||||
|
@ -34,35 +33,96 @@ describe("Items", () => {
|
||||||
cy.get("pl-app")
|
cy.get("pl-app")
|
||||||
.find("pl-items")
|
.find("pl-items")
|
||||||
.find("pl-item-view")
|
.find("pl-item-view")
|
||||||
.find("pl-scroller")
|
.find("pl-scroller pl-list pl-field:eq(0)")
|
||||||
.find("pl-list")
|
|
||||||
.find("pl-field:eq(0)")
|
|
||||||
.find("pl-input.value-input")
|
.find("pl-input.value-input")
|
||||||
.find("input.input-element")
|
.find("input.input-element")
|
||||||
.type(testItem.username, { force: true });
|
.type(testItem.username, { force: true });
|
||||||
cy.get("pl-app")
|
cy.get("pl-app")
|
||||||
.find("pl-items")
|
.find("pl-items")
|
||||||
.find("pl-item-view")
|
.find("pl-item-view")
|
||||||
.find("pl-scroller")
|
.find("pl-scroller pl-list pl-field:eq(1)")
|
||||||
.find("pl-list")
|
|
||||||
.find("pl-field:eq(1)")
|
|
||||||
.find("pl-input.value-input")
|
.find("pl-input.value-input")
|
||||||
.find("input.input-element")
|
.find("input.input-element")
|
||||||
.type(testItem.password, { force: true });
|
.type(testItem.password, { force: true });
|
||||||
cy.get("pl-app")
|
cy.get("pl-app")
|
||||||
.find("pl-items")
|
.find("pl-items")
|
||||||
.find("pl-item-view")
|
.find("pl-item-view")
|
||||||
.find("pl-scroller")
|
.find("pl-scroller pl-list pl-field:eq(2)")
|
||||||
.find("pl-list")
|
|
||||||
.find("pl-field:eq(2)")
|
|
||||||
.find("pl-input.value-input")
|
.find("pl-input.value-input")
|
||||||
.find("input.input-element")
|
.find("input.input-element")
|
||||||
.type(testItem.url, { force: true });
|
.type(testItem.url, { force: true });
|
||||||
|
|
||||||
// Click save
|
// Click save
|
||||||
cy.get("pl-app").find("pl-items").find("pl-item-view").find("pl-button.primary").click({ force: true });
|
cy.get("pl-app").find("pl-items").find("pl-item-view").find("pl-button.primary").click();
|
||||||
|
|
||||||
cy.url().should("include", "/items/");
|
cy.url().should("include", "/items/");
|
||||||
cy.url().should("not.include", "/new");
|
cy.url().should("not.include", "/new");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("can find an an item without errors", () => {
|
||||||
|
cy.unlock();
|
||||||
|
|
||||||
|
// Click search sign
|
||||||
|
cy.get("pl-app").find("pl-items").find("pl-items-list").find("pl-button:eq(3)").click();
|
||||||
|
|
||||||
|
// Find Item
|
||||||
|
cy.get("pl-app")
|
||||||
|
.find("pl-items")
|
||||||
|
.find("pl-items-list")
|
||||||
|
.find("pl-input#filterInput")
|
||||||
|
.find("input")
|
||||||
|
.type(itemSearch.existing, { force: true });
|
||||||
|
|
||||||
|
// Confirm we only find one
|
||||||
|
cy.get("pl-app")
|
||||||
|
.find("pl-items")
|
||||||
|
.find("pl-items-list")
|
||||||
|
.find("main pl-virtual-list pl-scroller")
|
||||||
|
.find("div.content")
|
||||||
|
.children("div")
|
||||||
|
.should("have.length", 1);
|
||||||
|
|
||||||
|
// Confirm we find the right one
|
||||||
|
cy.get("pl-app")
|
||||||
|
.find("pl-items")
|
||||||
|
.find("pl-items-list")
|
||||||
|
.find("main pl-virtual-list pl-scroller")
|
||||||
|
.find("div.content pl-vault-item-list-item")
|
||||||
|
.find("div > div > div.semibold")
|
||||||
|
.should("include.text", testItem.name);
|
||||||
|
|
||||||
|
// Click clear search sign
|
||||||
|
cy.get("pl-app")
|
||||||
|
.find("pl-items")
|
||||||
|
.find("pl-items-list")
|
||||||
|
.find("pl-input#filterInput")
|
||||||
|
.find("pl-button.slim")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
// Click search sign
|
||||||
|
cy.get("pl-app").find("pl-items").find("pl-items-list").find("pl-button:eq(3)").click();
|
||||||
|
|
||||||
|
// Find non-existent Item
|
||||||
|
cy.get("pl-app")
|
||||||
|
.find("pl-items")
|
||||||
|
.find("pl-items-list")
|
||||||
|
.find("pl-input#filterInput")
|
||||||
|
.find("input")
|
||||||
|
.type(itemSearch.nonexistent, { force: true });
|
||||||
|
|
||||||
|
// Confirm we find none
|
||||||
|
cy.get("pl-app")
|
||||||
|
.find("pl-items")
|
||||||
|
.find("pl-items-list")
|
||||||
|
.find("main pl-virtual-list pl-scroller")
|
||||||
|
.find("div.content")
|
||||||
|
.children("div")
|
||||||
|
.should("have.length", 0);
|
||||||
|
|
||||||
|
cy.get("pl-app")
|
||||||
|
.find("pl-items")
|
||||||
|
.find("pl-items-list")
|
||||||
|
.find("main > div.centering")
|
||||||
|
.should("contain.text", "did not match any items");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue