Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

228
Vistas
How can I track DOB that is given in text format in a Wikipedia page and assert that one DOB is greater than other one using cypress? learning cypress

This is what I am working on:

  • Accesses this page: https://en.wikipedia.org/wiki/The_Beatles
  • Clicks on the first link to Paul McCartney’s Wikipedia page
  • Keeps track of the date Paul McCartney was born
  • Goes back to The Beatles page
  • Clicks on the first link to John Lennon’s Wikipedia page
  • Keeps track of the date that John Lennon was born
  • Asserts that John Lennon was born before Paul McCartney
describe('iCONNECT Test Suite', function () {
  it('Test Case 1', function () {
    cy.visit('https://en.wikipedia.org/wiki/The_Beatles')
    cy.get(':nth-child(8) > [href="/wiki/Paul_McCartney"]').click()
    cy.get('.mw-parser-output > :nth-child(6)').contains('18 June 1942')
    cy.go(-1)
    cy.wait(7000)
    cy.get(':nth-child(8) > [href="/wiki/John_Lennon"]').click()
    cy.get('.mw-parser-output > :nth-child(6)').contains('9 October 1940')
    expect(1940).to.be.lessThan(1942)
  })
})
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can do something like this:

describe('iCONNECT Test Suite', function () {
  it('Test Case 1', function () {
    cy.visit('https://en.wikipedia.org/wiki/The_Beatles')
    cy.get('.infobox-data')
      .find('li > [href="/wiki/Paul_McCartney"]', {timeout: 7000})
      .click()
    cy.get('.infobox-data', {timeout: 6000})
      .eq(0)
      .should('be.visible')
      .invoke('text')
      .should('include', '18 June 1942') //Assert the birth day for Paul McCartney
    cy.get('.infobox-data')
      .eq(0)
      .find('span')
      .invoke('text')
      .then((text) => text.slice(2, 6))
      .as('paulBirthYear') //Get Birth year for Paul McCartney
    cy.go(-1)
    cy.get('.infobox-data')
      .find('li > [href="/wiki/John_Lennon"]', {timeout: 7000})
      .click()
    cy.get('.infobox-data', {timeout: 6000})
      .eq(0)
      .should('be.visible')
      .invoke('text')
      .should('include', '9 October 1940') //Assert the birth day for John Lennon
    cy.get('.infobox-data')
      .eq(0)
      .find('span')
      .invoke('text')
      .then((text) => text.slice(1, 5))
      .as('johnBirthYear') //Get Birth year for John Lennon
    cy.get('@paulBirthYear').then((paulBirthYear) => {
      cy.get('@johnBirthYear').then((johnBirthYear) => {
        expect(+johnBirthYear).to.be.lessThan(+paulBirthYear) //Assert John Lennon is older than Paul McCartney
      })
    })
  })
})

Test Runner Execution:

Test runner execution

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda