Advertisement
Guest User

Untitled

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