Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion final/client/src/components/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function Footer() {
return (
<Container>
<InnerContainer>
<MenuItem to="/">
<MenuItem id='home' to="/">
<HomeIcon />
Home
</MenuItem>
Expand Down
1 change: 1 addition & 0 deletions final/client/src/components/launch-tile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const LaunchTile: React.FC<LaunchTileProps> = ({ launch }) => {
style={{
backgroundImage: getBackgroundImage(id),
}}
id={`${id}`}
>
<h3>{mission ? mission.name : ''}</h3>
<h5>{rocket && rocket.name}</h5>
Expand Down
1 change: 1 addition & 0 deletions final/client/src/containers/action-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const ToggleTripButton: React.FC<ActionButtonProps> = ({ id }) => {
}
}}
data-testid={'action-button'}
id="add-to-cart"
>
{isInCart ? 'Remove from Cart' : 'Add to Cart'}
</Button>
Expand Down
44 changes: 39 additions & 5 deletions final/node_testing/auth_tests.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require('chromedriver');
const {Builder, By, Key, until, WebDriver} = require('selenium-webdriver');
const assert = require('assert');
const testEmail = 'SeleniumTest@Gmail.Test'
Expand All @@ -15,12 +16,22 @@ async function runTests(){
await navigateToCart();
await userVerificationTest();
await naviageToProfile();
await naviageToHome();
await userVerificationTest();
await cartTests();
await userVerificationTest();
await naviageToLogout();
await verifyNoPermissionRedirectTest();
await closeApp();
}

async function cartTests() {
await accessLaunchTile();
await addStarlinkToCart();
await navigateToCart();
await verifystartLinkAddedInTheCart();
}

async function openApp() {
//Make sure both client and server are running prior to exectuing this script.
await driver.get('http://localhost:3000/');
Expand All @@ -46,12 +57,14 @@ async function loginTest() {
}

async function userVerificationTest() {
//Verify that the SeleniumTest user is logged in.
var actualUsername = await driver.wait(until.elementLocated(By.tagName('h5')), 5000).getText();
await driver.wait(until.elementLocated(By.tagName('h5')), 5000).then(async() => {
//Verify that the SeleniumTest user is logged in.
var actualUsername = await driver.findElement(By.tagName('h5')).getText();

//the css puts this in upper case.
assert.equal(actualUsername, testEmail.toUpperCase());
console.log('Pass: User authenticated on page.')
//the css puts this in upper case.
assert.equal(actualUsername, testEmail.toUpperCase());
console.log('Pass: User authenticated on page.')
});
}

async function navigateToCart() {
Expand All @@ -62,6 +75,27 @@ async function naviageToProfile() {
await driver.findElement(By.id('profile')).click();
}

async function naviageToHome() {
await driver.findElement(By.id('home')).click();
}

async function accessLaunchTile() {
await driver.wait(until.elementLocated(By.id('109')), 5000).click();
}

async function addStarlinkToCart() {
await driver.wait(until.elementLocated(By.id('add-to-cart')), 5000).click();
console.log('Pass: 1 item added to the cart');
}

async function verifystartLinkAddedInTheCart() {
await driver.wait(until.elementLocated(By.id('109')), 5000).then(async() => {
var url = await driver.findElement(By.id('109')).getAttribute('href');
assert.equal(url, 'http://localhost:3000/launch/109');
console.log('Pass: 1 item available in cart');
});
}

async function naviageToLogout() {
await driver.findElement(By.id('logout-button')).click();
}
Expand Down