Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
update page styling
jgiwinski committed Jan 30, 2024
1 parent 7dd4b5d commit 29fc68f
Showing 6 changed files with 141 additions and 84 deletions.
Binary file removed cypress/downloads/downloads.html
Binary file not shown.
82 changes: 56 additions & 26 deletions cypress/e2e/spec.cy.js
@@ -11,26 +11,47 @@ context('SACDS', () => {
.should('have.class', 'logo')
})

it('Displays information text', () => {

})

it('Displays Seamless Action button on page', () => {
cy.get('a.sa-button')
.should('be.visible')
.and('have.attr', 'href')
.then((hrefAttribute) => {
// Extract entityID and returnUrl from the href attribute
const urlParams = new URLSearchParams(hrefAttribute);
const entityID = urlParams.get('entityID');
const returnUrl = urlParams.get('return');
it('Displays information links', () => {
cy.get('#menu').should('be.visible');

// Assert that entityID and returnUrl are present and not empty
expect(entityID).to.be.a('string').and.not.empty;
expect(returnUrl).to.be.a('string').and.not.empty;
// Check each link within the menu
cy.get('#menu a').each(($link) => {
cy.wrap($link).should('have.attr', 'target', '_blank'); // Check if the link opens in a new tab
});

// Check the specific attributes of the second and third links
cy.get('#menu a').eq(1).should('have.attr', 'href', 'https://internet2.edu/community/about-us/policies/privacy/').and('have.class', 'last');
cy.get('#menu a').eq(2).should('have.attr', 'href', 'https://incommon.org/help/').and('have.class', 'last');
});

it('Displays copyright text', () => {
cy.contains('© Copyright 2020, InCommon, LLC').should('be.visible');
});

cy.get('.sa-button-logo').should('be.visible');
cy.get('.sa-button-text').should('be.visible').and('contain.text', 'Access through your institution');

it('Displays Seamless Action button on page', () => {
cy.fixture('testData').then((testData) => {
const { entityID, returnUrl, error } = testData;

// Visit the page with mock data as query parameters
cy.visit(`http://localhost:3000/?entityID=${entityID}&return=${returnUrl}`);
cy.get('a.sa-button')
.should('be.visible')
.and('have.attr', 'href')
.then((hrefAttribute) => {
// Extract entityID and returnUrl from the href attribute
const hrefParams = new URLSearchParams(hrefAttribute);
const extractedEntityID = hrefParams.get('entityID');
const extractedReturnUrl = hrefParams.get('returnUrl');

// Assert that entityID and returnUrl are present and not empty
// expect(extractedEntityID).to.be.a('string').and.not.empty;
// expect(extractedReturnUrl).to.be.a('string').and.not.empty;


cy.get('.sa-button-logo').should('be.visible');
cy.get('.sa-button-text').should('be.visible').and('contain.text', 'Access through your institution');
});
});
})

@@ -40,21 +61,30 @@ context('SACDS', () => {
cy.get('p a')
.should('be.visible')
.and('have.attr', 'href', 'LINK_FROM_I2');
cy.get('p a').should('contain.text', 'Click Here for more information.');
cy.get('p a').should('contain.text', 'Click Here');
})

})

describe('SA button functionality', () => {

it('Takes in entityID and returnUrl from URL and feeds to SA button', () => {

})

it('Routes user to their entity after clicking SA button', () => {

cy.fixture('testData').then((testData) => {
const { entityID, returnUrl, error } = testData;

// Visit the page with mock data as query parameters
cy.visit(`http://localhost:3000/?entityID=${entityID}&return=${returnUrl}`);

// Check if the SA button is visible
cy.get('.sa-button').should('be.visible');

// Check if the Seamless Access button's href attribute contains the correct entityID and returnUrl
cy.get('.sa-button').should(
'have.attr',
'href',
`https://service.seamlessaccess.org/ds/?entityID=${entityID}&return=${returnUrl}`
);
});
})

})
})

5 changes: 0 additions & 5 deletions cypress/fixtures/example.json

This file was deleted.

5 changes: 5 additions & 0 deletions cypress/fixtures/testData.json
@@ -0,0 +1,5 @@
{
"entityID": "123",
"returnUrl": "http://mockReturnURL.com",
"error": "Both Entity ID and return URL are required."
}
54 changes: 30 additions & 24 deletions src/App.js
@@ -25,38 +25,44 @@ function App() {
const returnUrlParam = queryParams.return || '';

if (!entityIdParam || !returnUrlParam) {
// Handle missing parameters
setError('Both Entity ID and return URL are required.');
} else {
// Set parameters if available
setEntityID(entityIdParam);
setReturnUrl(returnUrlParam);
}

console.log('IDs', entityIdParam, returnUrlParam)
}, []);

return (
<div className="app d-flex">
<div className="d-flex column align-items-center container box-with-shadow">
<img src={logo} className="logo" alt="InCommon-Logo" />
{error ? (
<>
<h1>{error}</h1>
<p><a href="LINK_FROM_I2" target="_blank">Click Here</a> for more information.</p>
</>
) : (
<>
<a href={`https://service.seamlessaccess.org/ds/?entityID=${entityID}&return=${returnUrl}`} className="d-flex sa-button">
<div className="sa-button-logo-wrap">
<img src="https://service.seamlessaccess.org/sa-white.svg" alt="Seamless Access Logo" className="sa-button-logo"/>
</div>
<div className="d-flex justify-content-center align-items-center sa-button-text text-truncate">
<div className="sa-button-text-primary text-truncate">Access through your institution</div>
</div>
</a>
</>
)}
<div className="app d-flex justify-content-center">
<div className="d-flex column justify-content-between align-items-center container">
<div className="d-flex column align-items-center">
<img src={logo} className="logo" alt="InCommon-Logo" />
{error ? (
<>
<h1>{error}</h1>
<p><a href="LINK_FROM_I2" target="_blank">Click Here</a> for more information.</p>
</>
) : (
<>
<a href={`https://service.seamlessaccess.org/ds/?entityID=${entityID}&return=${returnUrl}`} className="d-flex sa-button">
<div className="sa-button-logo-wrap">
<img src="https://service.seamlessaccess.org/sa-white.svg" alt="Seamless Access Logo" className="sa-button-logo"/>
</div>
<div className="d-flex justify-content-center align-items-center sa-button-text text-truncate">
<div className="sa-button-text-primary text-truncate">Access through your institution</div>
</div>
</a>
</>
)}
</div>
<div>
<div id="menu">
<a href="https://incommon.org/federation/" target="_blank">About the InCommon Federation</a>
<a href="https://internet2.edu/community/about-us/policies/privacy/" className="last" target="_blank">Data Privacy</a>
<a href="https://incommon.org/help/" className="last" target="_blank">Help</a>
</div>
<p>© Copyright 2020, InCommon, LLC | incommon.org | InCommon: Identity and Access for Research and Education</p>
</div>
</div>
</div>
);
79 changes: 50 additions & 29 deletions src/assets/stylesheets/App.css
@@ -16,34 +16,27 @@ html, body {

.app {
width: 100%;
height: 75%;
margin-top: 50px;
height: 100vh;
}

.logo {
height: 75px;
padding-bottom: 30px;
height: 50px;
margin: 100px 0;
}

.container, .error-message {
width: 100%;
height: 50%;
margin: 0 auto;
border-radius: 10px;
.container {
width: 75%;
height: 100%;
margin: 0;
background-color: #f0f0f0;
padding: 40px;
}

.box-with-shadow {
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
padding: 0 40px;
}

/* Flexbox properties */
.d-flex {
display: flex;
&.column {
flex-direction: column;
justify-content: center;
}
}

@@ -55,17 +48,33 @@ html, body {
justify-content: center;
}

/* .header {
display: flex;
align-items: center;
} */
.justify-content-between {
justify-content: space-between;
}

.head-text {
text-align: left !important;
font-size: 20px;
font-weight: 700;
}

#menu {
display: flex;
flex-direction: row;
justify-content: center;
}

#menu a {
margin-right: 10px
}

.last {
background: url(https://wayf.incommonfederation.org/DS/images/separator.png) no-repeat scroll left center transparent;
padding-left: 8px;
float: left;
list-style: none;
}

/* Text truncation */
.text-truncate {
overflow: hidden;
@@ -225,7 +234,7 @@ html, body {
vertical-align: middle;
}

/*

#container {
display: flex;
flex-direction: column;
@@ -340,14 +349,9 @@ footer {
font-size: 14px;
font-weight: 500;
text-align: left;
} */
}

@media screen and (min-width: 901px) {
#root {
margin-top: 80px;
margin-left: 20%;
margin-right: 20%;
}
header {
margin-bottom: 50px;
}
@@ -363,9 +367,7 @@ footer {

@media screen and (max-width: 900px) {
#root {
margin-top: 50px;
margin-left: 5%;
margin-right: 5%;
margin: 10% 0 10% 0;
}
header {
margin-bottom: 40px;
@@ -383,4 +385,23 @@ footer {
margin-right: 2rem;
margin-left: 2rem;
}
.container {
width: 100%;
height: 90%;
}
.logo {
height: 50px;
margin: 50px 0 100px 0;
}
#menu {
display: flex;
flex-direction: column;
align-items: center;
}
.last {
background: none;
padding-left: 8px;
float: left;
list-style: none;
}
}

0 comments on commit 29fc68f

Please sign in to comment.