Skip to content
Snippets Groups Projects
user-journeys.cy.ts 4.34 KiB
Newer Older
// const baseUrl = Cypress.config('baseUrl');
tzanmix's avatar
tzanmix committed

describe('user journey', () => {
  beforeEach(() => {
    //cy.visit(baseUrl);
    cy.visit(window.location.origin);
tzanmix's avatar
tzanmix committed
  
tzanmix's avatar
tzanmix committed
  context('user-not-logged-in', () => {
    it('checks services portal', () => {
tzanmix's avatar
tzanmix committed
      cy.navigateToServices(':nth-child(2) > .container > .row > :nth-child(2) > a > .btn');
    });
    it('checks services portal via image', () => {
      cy.navigateToServices(':nth-child(2) > .container > .row > .text-left');
tzanmix's avatar
tzanmix committed
    it('checks services portal via anchor', () => {
      cy.navigateToServices(':nth-child(1) > .nav-link');
    });

    it('checks resources portal', () => {
      //cy.get(':nth-child(2) > .nav-link').click();
tzanmix's avatar
tzanmix committed
      cy.navigateToResources(':nth-child(3) > .container > .row > .order-md-1 > a > .btn');
tzanmix's avatar
tzanmix committed
    it('checks resources portal via image', () => {
      cy.navigateToResources(':nth-child(3) > .container > .row > .order-md-2 > a > .img-fluid');
    })
    it('checks resources portal via anchor', () => {
      cy.navigateToResources(':nth-child(2) > .nav-link');
tzanmix's avatar
tzanmix committed
    it('checks testing portal', () => {
      cy.navigateToTesting(':nth-child(5) > .container > .row > .order-md-1 > a > .btn');
    });
    it('checks testing via image', () => {
      cy.navigateToTesting(':nth-child(5) > .container > .row > .order-md-2 > a > .img-fluid');
    })
    it('checks testing portal via anchor', () => {
      cy.navigateToTesting(':nth-child(4) > .nav-link')
    });
tzanmix's avatar
tzanmix committed
    it('checks products portal', () => {
      cy.navigateToProducts(':nth-child(6) > .container > .row > :nth-child(2) > a > .btn');
tzanmix's avatar
tzanmix committed
    it('checks products portal via image', () => {
      cy.navigateToProducts(':nth-child(6) > .container > .row > .text-left > a > .img-fluid');
    })
    it('checks products portal via anchor', () => {
      cy.navigateToProducts(':nth-child(5) > .nav-link');
    })
  context('<who we are> links', () => {
tzanmix's avatar
tzanmix committed
    beforeEach(() => {
      cy.get('[id="contact"]').scrollIntoView().should('be.visible');
    })
    it('checks ETSI SDG OpenSlice Link', () => {
      cy.get('.ng-star-inserted > :nth-child(1) > .text-white').click();
      cy.origin('https://osl.etsi.org/', () => {
        cy.location("pathname").should("equal", "/");

      });
    });
    it("checks OpenSLice by ETSI wiki", () => {
      cy.get(':nth-child(3) > .text-white').click();
      cy.origin('https://osl.etsi.org/', () => {
        cy.location("pathname").should("equal", "/documentation/latest/");

      });
    });
    it('checks <our wiki> link', () => {
      cy.get('.col-12 > :nth-child(3) > .font-weight-bold').click();
      cy.origin('https://osl.etsi.org/', () => {
        cy.location("pathname").should("equal", "/documentation/latest/");

      });
    });
tzanmix's avatar
tzanmix committed
    it('checks linkedin link', () => {
      cy.get(':nth-child(2) > .ng-star-inserted > :nth-child(1)').click();
      cy.origin('https://www.linkedin.com/company/openslice', ()=> {
        cy.location("pathname").should("equal", "/company/openslice");
      });
    });
    it('checks slack link', () => {
      cy.get(':nth-child(2) > .ng-star-inserted > :nth-child(2)').click();
      cy.origin('https://openslice.slack.com/', () => {
        cy.location("pathname").should("equal", "/");

      });
    });
    //twitter test cannot pass, depends on user login
tzanmix's avatar
tzanmix committed
    it('checks twitter link', () => {
      cy.get(':nth-child(2) > .ng-star-inserted > :nth-child(3)').click();
      cy.origin('https://x.com/OpensliceOSS', () => {
        cy.location("pathname").should("satisfy", (url) => {
          return url === '/OpensliceOSS' || url === '/i/flow/login';
        })
      });
    });
    it('checks ecosystem link', () => {
      cy.get('.col-md-10 > :nth-child(1) > a').click();
      cy.origin('https://osl.etsi.org/ecosystem/', () => {
        cy.location("pathname").should("equal", "/ecosystem/");
      });
    });
    //never loads, timeout
    it.skip('opens terms and conditions', () => {
      cy.get('[href="https://osl.etsi.org/files/SDG_OSL_Terms_and_Conditions.pdf"]').click();
tzanmix's avatar
tzanmix committed
      cy.origin('https://osl.etsi.org/files/SDG_OSL_Terms_and_Conditions.pdf/', () => {
        cy.location("pathname").should("equal", "/files/SDG_OSL_Terms_and_Conditions.pdf/")
      })
tzanmix's avatar
tzanmix committed
    })
    it('checks osl etsi link', () => {
      cy.get('[target="_blank"]').click();
      cy.location("pathname").should("equal", "/")
      
    })