Skip to content
Snippets Groups Projects
Commit 7d2e373e authored by tzanmix's avatar tzanmix
Browse files

basic-user-journey-tests-user-not-logged-in

parent 48130836
No related branches found
No related tags found
1 merge request!22Draft: Resolve "Implement user journey tests"
This commit is part of merge request !22. Comments created here will be created in the context of that merge request.
import { defineConfig } from "cypress";
export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});
describe('user journey', () => {
beforeEach(() => {
cy.visit('http://localhost:4200/');
})
context('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/");
});
});
//infinite loop
// it.only('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", "/");
// });
// });
it.only('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
// it.only('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("equal", '/')
// });
// });
});
})
\ No newline at end of file
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
/// <reference types="cypress" />
// ***********************************************
// This example commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }
\ No newline at end of file
// ***********************************************************
// This example support/e2e.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands'
\ No newline at end of file
This diff is collapsed.
......@@ -56,6 +56,7 @@
"@types/jasminewd2": "~2.0.3",
"@types/node": "~12.11.1",
"codelyzer": "~6.0.2",
"cypress": "^14.0.1",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.4.1",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment