-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reworking the framework from .js to .ts
- Loading branch information
1 parent
7b5d917
commit bb4eb7f
Showing
29 changed files
with
323 additions
and
302 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,12 +15,12 @@ module.exports = defineConfig({ | |
viewportHeight: 1080, | ||
video: false, | ||
baseUrl: 'http://www.automationpractice.pl/', | ||
loginAPIUrl: 'http://www.automationpractice.pl/index.php?controller=authentication', | ||
account: { | ||
userEmail: '[email protected]', | ||
password: 'simple_automation_com_2021', | ||
userName: 'John Wick' | ||
}, | ||
env:{ | ||
userEmail: '[email protected]', | ||
password: 'simple_automation_com_2021', | ||
userName: 'John Wick', | ||
loginAPIUrl: 'http://www.automationpractice.pl/index.php?controller=authentication', | ||
} | ||
}, | ||
}); | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import Home from '../src/pages/Home'; | ||
|
||
const homePage = new Home(); | ||
|
||
describe('User Login tests', () => { | ||
it('Sign in page (Valid data)', () => { | ||
homePage | ||
.visit() | ||
.checkPageUrl() | ||
.header.clickOnSignInButton() | ||
.alreadyRegisteredComponent | ||
.enterUserEmail(Cypress.env('userEmail')) | ||
.enterPassword(Cypress.env('password')) | ||
.clickOnLoginButton() | ||
.checkPageUrl() | ||
.checkTextIsPresent('Welcome to your account. Here you can manage all of your personal information and orders.') | ||
.header.checkUserNameIsPresent(Cypress.env('userName')); | ||
}); | ||
|
||
it('Log In via API (Valid data)', () => { | ||
cy.logInApi(Cypress.env('userEmail'), Cypress.env('password')) | ||
homePage | ||
.visit() | ||
.checkPageUrl() | ||
.header.checkUserNameIsPresent(Cypress.env('userName')); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import Home from '../src/pages/Home'; | ||
|
||
const homePage = new Home(); | ||
|
||
describe('Navigation tests', () => { | ||
it('Navigate to the Home page, and verify url', () => { | ||
homePage.visit().checkPageUrl(); | ||
}); | ||
|
||
it('Navigate to the Contact Us page via header, and verify url', () => { | ||
homePage | ||
.visit() | ||
.checkPageUrl() | ||
.header.clickOnContactUsButton() | ||
.checkPageUrl(); | ||
}); | ||
|
||
it('Navigate to the Sign In page via header, and verify url', () => { | ||
homePage | ||
.visit() | ||
.checkPageUrl() | ||
.header.clickOnSignInButton() | ||
.checkPageUrl(); | ||
}); | ||
|
||
it('Check links on Follow us section in footer', () => { | ||
homePage | ||
.visit() | ||
.checkPageUrl() | ||
.footer.checkFollowUsSectionLinks(); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Home from '../src/pages/Home'; | ||
|
||
const homePage = new Home(); | ||
|
||
describe('Check product on site', () => { | ||
it('Check item discount', () => { | ||
homePage | ||
.visit() | ||
.checkPageUrl() | ||
.productList | ||
.clickOnBestSellersBtn() | ||
.openQuickViewModalForFirstProductWithPriceDiscount() | ||
.waitForLoad() | ||
.checkSumWithDiscountCalculatedCorrectly(); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export default class BasePage { | ||
private url: string; | ||
|
||
constructor(url: string) { | ||
this.url = url; | ||
} | ||
|
||
public checkPageUrl(): this { | ||
cy.url().should('eq', `${Cypress.config('baseUrl')}${this.url}`); | ||
return this; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import Account from '../pages/Account'; | ||
|
||
export default class AlreadyRegistered { | ||
private alreadyRegisteredContainerLocator: string = '#login_form'; | ||
private loginFieldLocator: string = '#email'; | ||
private passwordFieldLocator: string = '#passwd'; | ||
private loginButtonLocator: string = '#SubmitLogin'; | ||
|
||
private get inputEmailField(): Cypress.Chainable { | ||
return cy | ||
.get(this.alreadyRegisteredContainerLocator) | ||
.find(this.loginFieldLocator); | ||
} | ||
|
||
private get inputPasswordField(): Cypress.Chainable { | ||
return cy | ||
.get(this.alreadyRegisteredContainerLocator) | ||
.find(this.passwordFieldLocator); | ||
} | ||
|
||
private get loginButton(): Cypress.Chainable { | ||
return cy | ||
.get(this.alreadyRegisteredContainerLocator) | ||
.find(this.loginButtonLocator); | ||
} | ||
|
||
public enterUserEmail(userEmail: any): this { | ||
this.inputEmailField.type(userEmail); | ||
return this; | ||
} | ||
|
||
public enterPassword(password: string): this { | ||
this.inputPasswordField.type(password); | ||
return this; | ||
} | ||
|
||
public clickOnLoginButton(): Account { | ||
this.loginButton.click(); | ||
return new Account(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export default class Footer { | ||
private footerContainerLocator: string = '#footer'; | ||
|
||
private get followUsSectionLinksList(): Cypress.Chainable { | ||
return cy.get(this.footerContainerLocator).find('#social_block a'); | ||
} | ||
|
||
public checkFollowUsSectionLinks(): void { | ||
this.followUsSectionLinksList.each((element) => { | ||
cy.request({ | ||
method: 'GET', | ||
url: element.attr('href'), | ||
failOnStatusCode: false, | ||
}).then((response) => { | ||
if (response.status === 200) { | ||
expect(response.status).eq(200); | ||
} else if (response.status === 404) { | ||
expect(response.status).eq(404); | ||
} else { | ||
console.log(`${element.attr('href')}${response.status}`); | ||
} | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.