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

describe('user journey', () => {

  beforeEach(() => {
tzanmix's avatar
tzanmix committed
    cy.visit(baseUrl);
tzanmix's avatar
tzanmix committed
  
  context.skip('user-not-logged-in', () => {
    it('checks services portal', () => {
      cy.get(':nth-child(2) > .container > .row > :nth-child(2) > a > .btn').click();
      //cy.get(':nth-child(1) > .nav-link').click()
      cy.location("pathname").should("equal", "/services");
      cy.get('.btn').should("contain", "Sign In");
      cy.get(':nth-child(2) > .nav-item > .nav-link').should("exist");

      //service marketplace button should exist and should redirect to /services_marketplace
      cy.get('.mr-auto > .nav-item > .nav-link').click();
      cy.get('.jumbotron > h5.ng-tns-c147-1').should("contain", "Browse available services and sign in to order");
      cy.get('.catalog-tree-header').should("exist");

      //sign in button should exist
      cy.get(':nth-child(2) > .nav-item > .nav-link').click();

      //sign in button should redirect to auth form
      cy.origin('http://portal.openslice.eu', () => {
        cy.location("pathname").should("equal", "/auth/realms/openslice/protocol/openid-connect/auth");

      });

    });
    it('checks resources portal', () => {
      cy.get(':nth-child(3) > .container > .row > .order-md-1 > a > .btn').click();
      //cy.get(':nth-child(2) > .nav-link').click();
      cy.location("pathname").should("equal", "/resources");
      //sign in button should exist
      cy.get('.btn').should('exist').click();
      //cy.get('nav-link').should('exist').click();

      //sign in button should redirect to auth form
      cy.origin('http://portal.openslice.eu', () => {
        cy.location("pathname").should("equal", "/auth/realms/openslice/protocol/openid-connect/auth");

      });
    });
    it('checks testing portal', () => {
      cy.get(':nth-child(5) > .container > .row > .order-md-1 > a > .btn').click();
      //cy.get(':nth-child(2) > .nav-link').click();
      cy.location("pathname").should("equal", "/testing");
      //sign in button should exist
      cy.get('.btn').should('exist').click();
      //cy.get('nav-link').should('exist').click();

      //sign in button should redirect to auth form
      cy.origin('http://portal.openslice.eu', () => {
        cy.location("pathname").should("equal", "/auth/realms/openslice/protocol/openid-connect/auth");

      });
    });
    it('checks products portal', () => {
      cy.get(':nth-child(6) > .container > .row > :nth-child(2) > a > .btn').click();
      //cy.get(':nth-child(1) > .nav-link').click()
      cy.location("pathname").should("equal", "/products");
      cy.get('.btn').should("contain", "Sign In");
      cy.get(':nth-child(2) > .nav-item > .nav-link').should("exist");

      //marketplace button should exist and should redirect to products/marketplace
      cy.get('.mr-auto > .nav-item > .nav-link').click();
      cy.get('.catalog-tree-header').should("exist");
      cy.get('.mb-0').should("contain", "Product Catalog Explorer");

      //sign in button should exist
      cy.get(':nth-child(2) > .nav-item > .nav-link').click();

      //sign in button should redirect to auth form
      cy.origin('http://portal.openslice.eu', () => {
        cy.location("pathname").should("equal", "/auth/realms/openslice/protocol/openid-connect/auth");

      });
    });
  });
  context('<who we are> links', () => {
    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();
      // 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/")
      // })
    })
    it('checks osl etsi link', () => {
      cy.get('[target="_blank"]').click();
      cy.location("pathname").should("equal", "/")
      
    })