Skip to content

Commit

Permalink
add bonus 49
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Jun 16, 2023
1 parent 8eb4291 commit babb9b1
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 43 deletions.
40 changes: 0 additions & 40 deletions cypress/e2e/inventory/logs-add-to-cart.cy.ts

This file was deleted.

23 changes: 23 additions & 0 deletions cypress/e2e/login/links.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { LoginPage } from '@support/pages/login.page'

describe('Login links', () => {
// 🚨 INCORRECT
// can you explain why the following test fails?
// Tip: the first click works, but the second fails
it('all lead back to the login page', () => {
cy.visit('/')
cy.get('a').click({ multiple: true })
LoginPage.showsError('Epic sadface')
cy.location('pathname').should('equal', '/')
})

it('all lead back to the login page (fixed)', () => {
cy.visit('/')
// get text for each link
// iterate over text for each "a" element
// find the link again using cy.contains command
// and click on it
// confirm the page shows an error
// and the page loads the "/" again
})
})
12 changes: 9 additions & 3 deletions src/pages/Login.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
.login_logo {
text-align: center;
padding: 30px 0;
background: url("../assets/img/SwagLabs_logo.png") no-repeat center center;
background: url('../assets/img/SwagLabs_logo.png') no-repeat center center;
margin-top: 30px;
}
.login_wrapper {
padding: 30px 0;
margin: 0px auto;
}
.login_links {
width: 100%;
display: flex;
justify-content: center;
margin: 1rem 0;
}
.login_wrapper-inner {
overflow: hidden;
}
Expand All @@ -27,7 +33,7 @@
float: none;
width: 100%;
height: 100%;
background: url("../assets/img/Login_Bot_graphic.png") no-repeat center center;
background: url('../assets/img/Login_Bot_graphic.png') no-repeat center center;
min-height: 260px;
min-width: 300px;
}
Expand Down Expand Up @@ -75,7 +81,7 @@
.bot_column {
float: right;
width: 48%;
background: url("../assets/img/Login_Bot_graphic.png") no-repeat center
background: url('../assets/img/Login_Bot_graphic.png') no-repeat center
center;
min-height: 260px;
min-width: 300px;
Expand Down
6 changes: 6 additions & 0 deletions src/pages/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ function Login(props) {
<div className="bot_column" />
</div>
<div className="login_credentials_wrap">
<div className="login_links">
<div>
Jump straight to <a href="/cart.html">cart</a>,{' '}
<a href="/inventory.html">inventory</a>
</div>
</div>
<div className="login_credentials_wrap-inner">
<div id="login_credentials" className="login_credentials">
<h4>Accepted usernames are:</h4>
Expand Down

0 comments on commit babb9b1

Please sign in to comment.