import SignInPage from "../../support/pages/signIn-page"; it("double space and search", () => { // Type a double space cy.get("input").type(" "); // Press the enter key cy.get("input").type("{enter}" : Notes">

NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

/// <reference types="cypress" />

import SignInPage from "../../support/pages/signIn-page";


it("double space and search", () => {
// Type a double space
cy.get("input").type(" ");
// Press the enter key
cy.get("input").type("{enter}");
cy.wait(3000);
// expecting movie title
cy.get(
":nth-child(4) > .g-0 > .col-sm-8 > .card-body > .card-title"
).should("contain", "GANTZ:O");
cy.wait(2000);
// Movie description
cy.get(":nth-child(4) > .g-0 > .col-sm-8 > .card-body > .card-text").should(
"contain",
"After being brutally murdered in a subway station, a teen boy awakens to find himself resurrected by a strange computer..."
);
//Movie rating
cy.get(
":nth-child(4) > .g-0 > .col-sm-8 > .card-body > .list-group-flush > :nth-child(1)"
).should("contain", "7.332 (by 653 raters)");
// Release Date
cy.get(
":nth-child(4) > .g-0 > .col-sm-8 > .card-body > .list-group-flush > :nth-child(2)"
).should("contain", "Oct 13, 2016");
});

// it("Validating Movie Title", () => {});
});



ENV

{
"baseUrl": "http://localhost:3000/",
"env": {
"NEXT_PUBLIC_MOVIE_API_KEY": "4aa8835b6e80b1f2541357f871794e08"
}
}


my path

fix my error
my fixture candidate-msehharcypressfixturessearchResultPage.json
my locators candidate-msehharcypresse2elocatorssearchResultPage.js
my test C:UsersMohammedDesktopMohammed_Wispcandidate-msehharcypresse2esearchPage.cy.js


//almostready.cy.js
describe("Movie Search", () => {
const movieTitle = "Star Wars";
const movieDescription =
"After being brutally murdered in a subway station, a teen boy awakens to find himself resurrected by a strange computer...";

beforeEach(() => {
cy.visit("http://localhost:3000/");
cy.get("input").type(" Star Wars{enter}");
cy.wait(2000);
});

it("Searches for a movie", () => {
cy.get(":nth-child(4) > .g-0 > .col-sm-8 > .card-body > .card-title").then(
($el) => {
expect($el.text()).to.contain("Star Wars");
}
);
cy.wait(2000);
});

it("Validating Movie Title", () => {
cy.get(":nth-child(4) > .g-0 > .col-sm-8 > .card-body > .card-title").then(
($el) => {
expect($el.text()).to.contain("Star Wars");
}
);
});

it("Validating Movie Description", () => {
cy.get("input").type(" Star Wars{enter}");
// Clicking the search button
cy.get('[data-cy="submitSearch"]').click();

cy.get(":nth-child(4) > .g-0 > .col-sm-8 > .card-body > .card-text").should(
"contain",
movieDescription
);
});
// it("Validating Movie Rating", () => {});
// it("Validating Movie Release Date", () => {});
// it("Page Pagination", () => {});
});

FInal version

describe("Movie Search", () => {
const movieDescription =
"Princess Leia is captured and held hostage by the evil Imperial forces in their effort to take over the";
const movieRating = "8.2 (by 18884 raters)";
const releaseDate = "May 24, 1977";

function checkPagination() {
cy.get('[data-cy="pagination"] > .page-item').then(($pageItems) => {
if ($pageItems.length > 1) {
// do something if pagination is available for more than one page
cy.get(
'[data-cy="pagination"] > .page-item:nth-child(2) > .page-link'
).click();
} else {
// do something if pagination is not available for more than one page
}
});
}

beforeEach(() => {
cy.visit("http://localhost:3000/");
cy.get("input").type(" Star Wars{enter}");
cy.wait(2000);
});

it("Searches for a movie", () => {
cy.get(":nth-child(4) > .g-0 > .col-sm-8 > .card-body > .card-title").then(
($el) => {
expect($el.text()).to.contain("Star Wars");
}
);
cy.wait(2000);
});

it("Validating Movie Title", () => {
cy.get(":nth-child(4) > .g-0 > .col-sm-8 > .card-body > .card-title").then(
($el) => {
expect($el.text()).to.contain("Star Wars");
}
);
});

it("Validating Movie Description", () => {
// cy.get('input').type(' Star Wars');
// Clicking the search button
cy.get('[data-cy="submitSearch"]').click();

cy.get(":nth-child(4) > .g-0 > .col-sm-8 > .card-body > .card-text").then(
($el) => {
expect($el.text()).to.contain(movieDescription);
}
);
});

it("Validating Movie Rating", () => {
cy.get(
":nth-child(4) > .g-0 > .col-sm-8 > .card-body > .list-group-flush > :nth-child(1)"
).then(($el) => {
expect($el.text()).to.contain(movieRating);
});
});

it("Validating Movie Release Date", () => {
// Release Date
cy.get(
":nth-child(4) > .g-0 > .col-sm-8 > .card-body > .list-group-flush > :nth-child(2)"
).then(($el) => {
expect($el.text()).to.contain(releaseDate);
});
});

it("Validating Page Pagination", () => {
checkPagination();
});

// it("Type Ahead", () => {});
});


Auto Result

it.skip("Auto Result", () => {
cy.visit("http://localhost:3000/");
cy.get("input").type("Baba, Baby o");
cy.wait(1000);
cy.get('[data-cy="autoResults"] > .list-group-item').should("have.length", 5);
// cy.get('[data-cy="autoResults"] > .list-group-item')
// .eq(0)
// .should("contain", "Baba, Baby 0");
cy.get('[data-cy="autoResults"] > .list-group-item')
.eq(1)
.should("contain", "The Pacifier");
cy.get('[data-cy="autoResults"] > .list-group-item')
.eq(2)
.should("contain", "The Sitter");
cy.get('[data-cy="autoResults"] > .list-group-item')
.eq(3)
.should("contain", "My Babysitter's a Vampire");
cy.get('[data-cy="autoResults"] > .list-group-item')
.eq(4)
.should("contain", "Son of Ali Baba");
});


tsx.json



{
"compilerOptions": {
"baseUrl": "./",
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}




     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.