57 lines
1.7 KiB
JavaScript
57 lines
1.7 KiB
JavaScript
// https://docs.cypress.io/api/introduction/api.html
|
|
|
|
describe("SEARCH", () => {
|
|
it("Search works properly", () => {
|
|
cy.visit("/login");
|
|
|
|
cy.get("input[name=username]")
|
|
.clear()
|
|
.type(Cypress.env("adminusername"));
|
|
|
|
// {enter} causes the form to submit
|
|
cy.get("input[name=password]")
|
|
.clear()
|
|
.type(`${Cypress.env("adminpassword")}{enter}`);
|
|
|
|
// we should be redirected to /dashboard
|
|
cy.url().should("include", "/home-dashboard");
|
|
|
|
cy.visit("/home-search");
|
|
cy.url().should("include", "/home-search");
|
|
|
|
cy.get("[data-cy=phrase]").type("we{enter}");
|
|
cy.get("[data-cy=btnexcerpt1]").click();
|
|
//note: it doesn';t show in the test but it's there
|
|
cy.get("[data-cy=btnopenitem1] > .v-list-item__subtitle").should("exist");
|
|
//check that the cache is working
|
|
//nav to about form
|
|
cy.get("[data-cy=contextmenu]").click();
|
|
cy.get('[data-cy="app:nav:abt"]').click();
|
|
cy.url().should("include", "/about");
|
|
cy.go("back");
|
|
cy.get("[data-cy=btnopenitem1] > .v-list-item__subtitle").should("exist");
|
|
//get the text in the subtitle
|
|
|
|
//save the start url for later
|
|
let sub = null;
|
|
//funcs are async so need to get result via then
|
|
|
|
// cy.url().then(url => {
|
|
// startUrl = url;
|
|
// });
|
|
|
|
cy.get("[data-cy=btnopenitem1] > .v-list-item__title")
|
|
.invoke("text")
|
|
.then((t) => {
|
|
sub = t;
|
|
//nave to first result form
|
|
cy.get("[data-cy=btnopenitem1]").click();
|
|
cy.url().should("include", "/widget");
|
|
//name field should contain whatever was shown in search results list
|
|
cy.contains(sub).should("exist");
|
|
});
|
|
|
|
//-----
|
|
});
|
|
});
|