Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.65 KB | None | 0 0
  1. describe('Search a film', () => {
  2.  
  3. before(() => {
  4. cy.log('Begin the test');
  5. });
  6.  
  7. after(() => {
  8. cy.log('Completed test block');
  9. });
  10.  
  11. beforeEach(() => {
  12. cy.log('Runs on each test');
  13. cy.visit('/');
  14. cy.hash().should('eq', '');
  15. cy.get('.title').should('contain', 'OMDb API')
  16. });
  17.  
  18. afterEach(() => {
  19. cy.log('Test completed correctly');
  20. });
  21.  
  22. it('Search the title of a movie and show the list of films', () => {
  23. cy.get('.box-search input').type('indiana jones');
  24. cy.get('.box-search a').click();
  25. cy.get('img').should('have.length','11');
  26. cy.get('.image-data').should('have.length', '11');
  27. });
  28.  
  29. it('When we write a search, the search icon is displayed', () => {
  30. cy.get('.box-search input').type('test icons');
  31. cy.get('.box-search > a > .svg-inline--fa').should('have.class', 'fa-search');
  32.  
  33. });
  34.  
  35. it('Search the title of a movie and show the details of the film', () => {
  36. cy.get('.box-search input').type('indiana jones');
  37. cy.get('.box-search a').click();
  38. cy.wait(1000);
  39. cy.get(':nth-child(1) > .image-data > table > :nth-child(1) > th > .icon-right').click();
  40. cy.wait(1000);
  41. cy.get('img').should('have.length', 1);
  42. cy.get(':nth-child(1) > th').should('contain', 'Title');
  43. cy.get(':nth-child(2) > th').should('contain', 'Year');
  44. cy.get(':nth-child(3) > th').should('contain', 'Rated');
  45. cy.get(':nth-child(4) > th').should('contain', 'Released');
  46. cy.get(':nth-child(5) > th').should('contain', 'Runtime');
  47. cy.get(':nth-child(6) > th').should('contain', 'Genre');
  48. cy.get(':nth-child(7) > th').should('contain', 'Director');
  49. cy.get(':nth-child(8) > th').should('contain', 'Writer');
  50. cy.get(':nth-child(9) > th').should('contain', 'Actors');
  51. cy.get(':nth-child(10) > th').should('contain', 'Plot');
  52. cy.get(':nth-child(11) > th').should('contain', 'Language');
  53. cy.get(':nth-child(12) > th').should('contain', 'Country');
  54. cy.get(':nth-child(13) > th').should('contain', 'Awards');
  55. cy.get(':nth-child(14) > th').should('contain', 'Ratings');
  56. cy.get(':nth-child(15) > th').should('contain', 'Metascore');
  57. cy.get(':nth-child(16) > th').should('contain', 'imdbRating');
  58. cy.get(':nth-child(17) > th').should('contain', 'imdbVotes');
  59. cy.get(':nth-child(18) > th').should('contain', 'imdbID');
  60. cy.get(':nth-child(19) > th').should('contain', 'Type');
  61. cy.get(':nth-child(20) > th').should('contain', 'DVD');
  62. cy.get(':nth-child(21) > th').should('contain', 'BoxOffice');
  63. cy.get(':nth-child(22) > th').should('contain', 'Production');
  64. cy.get(':nth-child(23) > th').should('contain', 'Website');
  65. });
  66.  
  67. it('Search the title of a movie incorrect and shows error message', () => {
  68. cy.get('.box-search input').type('awsedrftgqysgtwuwhshd');
  69. cy.get('.box-search a').click();
  70. cy.get('.error').should('be.visible').and('contain', 'Movie not found!');
  71. });
  72.  
  73. it('Search the title of a movie and show the name of the movie that was found', () => {
  74. cy.get('.box-search input').type('indiana jones');
  75. cy.get('.box-search a').click();
  76. cy.get('.busqueda > h1').should('be.visible').and('contain', 'Buscando');
  77. });
  78.  
  79. });
  80.  
  81. describe('Navigation on the page', () => {
  82.  
  83. it('When we are in the home option', () => {
  84. cy.get('.router-link-exact-active').contains('Home').click();
  85. cy.get('[href="/contact"]').should('contain', 'Contacto');
  86.  
  87. });
  88.  
  89. it('When we are in the contact option', () => {
  90. cy.get('[href="/contact"]').contains('Contacto').click();
  91. cy.get('.router-link-exact-active').contains('Contacto');
  92. cy.get('h1').should('be.visible').and('contain', 'Donde estamos');
  93. cy.get('#gmap_canvas').should('be.visible');
  94. });
  95.  
  96. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement