forked from fyodorio/ng-hotrod
-
Notifications
You must be signed in to change notification settings - Fork 2
feat(test): add playwright configuration, add e2e tests, improve esli… #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d41a85e
feat(test): add playwright configuration, add e2e tests, improve esli…
jzolnowski 4db173e
fix: lint issues, improve playwright configuation, add babel configur…
jzolnowski a2b2b7e
fix(test): apply changes after George's code review
jzolnowski fc1bcf8
fix(e2e): Remove no needed githubRepoName Locator
jzolnowski e5af403
fix: restored the deleted rules and reconfigured them, remove set ngH…
jzolnowski 2345db0
fix: configure import-order rule to sort imports based on package name
jzolnowski 5f0392b
chore: set engine-strict to true, set engine npm version to 9 and nod…
c708c15
fix: hero image alt text
e9f6c73
chore: update .nvmrc to use node v18
ca6c50c
chore: remove engine-strict flag
2cd3d67
fix: change hero-image alt text, remove engine property from package.…
f85ec1d
fix(package-lock): remove engines field
a284582
fix(lint): Failed to load parser '@babel/eslint-parser' issue by addi…
fd0c3df
chore: merge with master branch
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,18 @@ | ||
{ | ||
"presets": [ | ||
// "env", | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"corejs": 3, | ||
"modules": "commonjs", // resolves https://github.com/noppa/ng-hot-reload/issues/31 | ||
"shippedProposals": true, | ||
"useBuiltIns": "usage" | ||
} | ||
] | ||
], | ||
"plugins": [ | ||
"@babel/plugin-proposal-object-rest-spread", | ||
"@babel/plugin-transform-object-assign" | ||
] | ||
} |
This file contains hidden or 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
This file contains hidden or 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 |
---|---|---|
|
@@ -9,3 +9,7 @@ node_modules | |
*.log | ||
dist/ | ||
yarn.lock | ||
|
||
/test-results/ | ||
/playwright-report/ | ||
/playwright/.cache/ |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 @@ | ||
export class HomePage { | ||
title; | ||
heroImage; | ||
featuring; | ||
|
||
constructor(page) { | ||
this.page = page; | ||
this.title = page.getByTestId('title'); | ||
this.heroImage = page.getByTestId('hero-image'); | ||
this.featuring = page.getByTestId('featuring').getByRole('link'); | ||
} | ||
|
||
async clickOnAngularMaterialLink() { | ||
await this.page.getByRole('link', { name: 'Angular Material' }).click(); | ||
} | ||
} |
This file contains hidden or 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,14 @@ | ||
export class NavBarPage { | ||
logo; | ||
header; | ||
|
||
constructor(page) { | ||
this.page = page; | ||
this.logo = this.page.getByTestId('ng-hotrod-logo'); | ||
this.header = this.page.getByTestId('header'); | ||
} | ||
|
||
async clickOnGitHubIcon() { | ||
await this.page.getByTestId('github').click(); | ||
} | ||
} |
This file contains hidden or 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,65 @@ | ||
import { expect, test } from '@playwright/test'; | ||
import { HomePage } from '../pages/home-page'; | ||
import { NavBarPage } from '../pages/nav-bar-page'; | ||
|
||
test.describe('AngularJS-Material-Vite app', () => { | ||
jzolnowski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
let errorLogs; | ||
gkalpak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
test.beforeEach(async ({ page }) => { | ||
errorLogs = []; | ||
|
||
page.on('console', message => { | ||
if (message.type() === 'error') { | ||
errorLogs.push(message.text()); | ||
} | ||
}); | ||
|
||
page.on('pageerror', err => { | ||
errorLogs.push(err.message); | ||
}); | ||
|
||
await page.goto(''); | ||
}); | ||
|
||
test.afterEach(async () => { | ||
expect(errorLogs).toStrictEqual([]); | ||
}); | ||
|
||
test.describe('TopNav', () => { | ||
test('Navbar', async ({ page }) => { | ||
const navBarPage = new NavBarPage(page); | ||
|
||
await expect(navBarPage.logo).toHaveAttribute('src', '/assets/img/icon-ng-hotrod-light.svg'); | ||
await expect(navBarPage.header).toHaveText('ng-hotrod'); | ||
}); | ||
|
||
test('Redirect to GitHub page', async ({ page }) => { | ||
const navBarPage = new NavBarPage(page); | ||
|
||
await navBarPage.clickOnGitHubIcon(); | ||
|
||
await expect(page.url()).toBe('https://github.com/xlts-dev/angularjs-material-vite'); | ||
}); | ||
}); | ||
|
||
test.describe('Home', () => { | ||
test('HomePage content', async ({ page }) => { | ||
const homePage = new HomePage(page); | ||
|
||
await expect(homePage.title).toHaveText('Modern starter for AngularJS + Angular Material'); | ||
await expect(homePage.heroImage).toHaveAttribute( | ||
'src', | ||
'https://res.cloudinary.com/fyodorio/image/upload/v1611994660/my-logos/hotrod-logo_rhkfxy.jpg', | ||
); | ||
await expect(await homePage.featuring.all()).toHaveLength(8); | ||
}); | ||
|
||
test('Redirect to Angular Material page', async ({ page }) => { | ||
const homePage = new HomePage(page); | ||
|
||
await homePage.clickOnAngularMaterialLink(); | ||
|
||
await expect(page.url()).toBe('https://material.angularjs.org/latest/'); | ||
}); | ||
}); | ||
}); | ||
gkalpak marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.