Skip to content
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

Add playwright testing for the new web package #513

Merged
merged 35 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5456f26
Add playwright testing for the new web package
SergioCasCeb Oct 13, 2023
3dd4cd5
Ignored test results and Added test script
SergioCasCeb Oct 13, 2023
28e3c51
Added remaining tests and fixed template.html
SergioCasCeb Oct 13, 2023
d49e9da
Adding the test description in the readme file
SergioCasCeb Oct 13, 2023
db89428
Merge branch 'eclipse-thingweb:master' into Changes-web-new
SergioCasCeb Oct 13, 2023
14572a3
Fixed failing AAS test
SergioCasCeb Oct 20, 2023
93a6d9b
Separated the full test, from simple test
SergioCasCeb Nov 13, 2023
be48a3e
Fixed failing test
SergioCasCeb Nov 13, 2023
830dbf8
Bump @babel/traverse from 7.18.11 to 7.23.2 in /packages/defaults
dependabot[bot] Oct 18, 2023
c0cfd95
Bump @babel/traverse from 7.18.11 to 7.23.2 in /packages/core
dependabot[bot] Oct 18, 2023
fa3cde4
Bump @babel/traverse from 7.18.11 to 7.23.2 in /packages/td_to_openAPI
dependabot[bot] Oct 18, 2023
d512879
Bump @babel/traverse from 7.18.11 to 7.23.2 in /packages/td_to_asyncapi
dependabot[bot] Oct 18, 2023
1efe327
Bump @babel/traverse in /packages/json-spell-checker
dependabot[bot] Oct 18, 2023
9369f8f
Bump @babel/traverse from 7.22.20 to 7.23.2 in /packages/web-new
dependabot[bot] Oct 18, 2023
85c7b43
Adding error handling for AAS conversion
SergioCasCeb Oct 13, 2023
66c6c41
Minor fixes with the new close tab prompts
SergioCasCeb Oct 13, 2023
7295807
Removed the "Save as" button
SergioCasCeb Oct 13, 2023
26dff23
Removed the AAS AID protocol error msg
SergioCasCeb Oct 20, 2023
b8af518
Bump browserify-sign from 4.2.1 to 4.2.2 in /packages/web
dependabot[bot] Oct 27, 2023
280eb82
Bump browserify-sign from 4.2.1 to 4.2.2 in /packages/td_to_asyncapi
dependabot[bot] Oct 27, 2023
22c93bc
Bump browserify-sign from 4.2.1 to 4.2.2 in /packages/core
dependabot[bot] Oct 27, 2023
654a574
Bump browserify-sign from 4.2.1 to 4.2.2 in /packages/td_to_openAPI
dependabot[bot] Oct 27, 2023
2b49abe
Bump @babel/traverse from 7.20.1 to 7.23.2 in /packages/web
dependabot[bot] Oct 28, 2023
feb9862
Bump semver from 6.3.0 to 6.3.1 in /packages/web
dependabot[bot] Oct 28, 2023
e431748
Bump browserify-sign from 4.2.1 to 4.2.2 in /packages/defaults
dependabot[bot] Oct 27, 2023
dd58bd9
web: use new node-wot release
egekorkan Nov 14, 2023
895cf17
web-new: regen package.lock
egekorkan Nov 14, 2023
976d2c5
web-new: add HTTPS indication
egekorkan Nov 14, 2023
9b602fc
Bump axios from 1.1.2 to 1.6.1
dependabot[bot] Nov 11, 2023
0ca59e4
Bump browserify-sign from 4.2.1 to 4.2.2 in /packages/assertions
dependabot[bot] Oct 27, 2023
ce15a4b
Add playwright testing for the new web package
SergioCasCeb Oct 13, 2023
ab7fc7f
regenerate example paths
egekorkan Nov 14, 2023
e948ecf
added custom popup event for side settings menu
egekorkan Nov 14, 2023
7a22272
Merge branch 'master' into Changes-web-new
egekorkan Nov 14, 2023
d190b93
remove custom event emission
egekorkan Nov 14, 2023
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: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ node_modules

# test screenshots for web package
test_results/
test-results/
playwright-report/

# dist directory should be included only in the Package but not Repository
dist
Expand Down
19 changes: 17 additions & 2 deletions packages/web-new/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The `webpack.config.js` file is used to set up Webpack for the project. It manag
- `optimization`: Contains settings for optimizing the build, including minimizing CSS using `CssMinimizerPlugin`


## Deployment
### 4. Deployment

Requires [Lerna](https://www.npmjs.com/package/lerna) to be installed globally (`npm install -g lerna`).

Expand Down Expand Up @@ -108,4 +108,19 @@ npm run dev
```sh
npm run build
npm run serve
```
```

### 5. Testing with Playwright

To utilize the Playwright package for testing the application, you need to install it using `npm install` since it's not intended for production use. Additionally, to set up the supported browsers required for Playwright to run tests, you should execute the command `npx playwright install`.

You can assess the visual appearance and functionality of the package in all browsers by running the command `npm run test`. This will execute all the tests in the supported browsers, and once the tests have finished, Playwright will host the reports at `http://localhost:9323`.

If the reports aren't displayed automatically, you can also use the command `npx playwright show-report` to view the test results.

For a more visual approach to writing and visualizing tests, you can use the command `npx playwright test --ui`. This command provides a visual interface that allows you to step through each part of the test and observe what occurs before, during, and after each step.

Debugging can also be accomplished by running the Playwright test command with the `--debug` flag, like this: `npx playwright test --debug`.

For additional information on how to run and debug tests, please refer to the [official Playwright website](https://playwright.dev/docs/running-tests).

60 changes: 60 additions & 0 deletions packages/web-new/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion packages/web-new/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
"build": "node external-scripts/generate-paths.js && webpack --mode production",
"dev": "webpack serve --mode development",
"serve": "node server/server.js",
"examples": "node external-scripts/generate-paths.js"
"examples": "node external-scripts/generate-paths.js",
"test": "npx playwright test"
},
"devDependencies": {
"@babel/core": "^7.22.9",
"@babel/preset-env": "^7.22.9",
"@playwright/test": "^1.39.0",
"babel-loader": "^9.1.3",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.8.1",
Expand Down
72 changes: 72 additions & 0 deletions packages/web-new/playwright.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// @ts-check
const { defineConfig, devices } = require('@playwright/test');

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();

/**
* @see https://playwright.dev/docs/test-configuration
*/
module.exports = defineConfig({
testDir: './tests',
// Folder for test artifacts such as screenshots, videos, traces, etc.
outputDir: 'test-results',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: 'http://127.0.0.1:5100',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},

/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
// use: { ...devices['Desktop Chrome'], headless: false, slowMo: 500},
},

{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},

/* Test against branded browsers. */
{
name: 'Microsoft Edge',
use: { ...devices['Desktop Edge'], channel: 'msedge' },
},
{
name: 'Google Chrome',
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
},
],

/* Run your local dev server before starting the tests */
webServer: {
command: 'npm run serve',
url: 'http://127.0.0.1:5100',
reuseExistingServer: !process.env.CI,
},
});

16 changes: 10 additions & 6 deletions packages/web-new/src/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -565,13 +565,17 @@ <h3 class="settings__preferences">Preferences</h3>
</div>

<footer>
<p><a href="https://www.thingweb.io/" target="_blank">© 2023 The Eclipse Thingweb Project</a></p>
<p><a href="https://www.thingweb.io/" target="_blank" id="thingweb-link">© 2023 The Eclipse Thingweb
Project</a></p>
<div class="footer-links">
<a href="https://www.eclipse.org" target="_blank">Eclipse</a>
<a href="https://www.eclipse.org/legal/privacy.php" target="_blank">Privacy Policy</a>
<a href="https://www.eclipse.org/legal/termsofuse.php" target="_blank">Terms of Use</a>
<a href="https://www.eclipse.org/legal/copyright.php" target="_blank">Copyright Agent</a>
<a href="https://www.eclipse.org/legal/" target="_blank">Legal</a>
<a href="https://www.eclipse.org" target="_blank" id="eclipse-link">Eclipse</a>
<a href="https://www.eclipse.org/legal/privacy.php" target="_blank" id="privacy-link">Privacy
Policy</a>
<a href="https://www.eclipse.org/legal/termsofuse.php" target="_blank" id="terms-link">Terms of
Use</a>
<a href="https://www.eclipse.org/legal/copyright.php" target="_blank" id="copyright-link">Copyright
Agent</a>
<a href="https://www.eclipse.org/legal/" target="_blank" id="legal-link">Legal</a>
</div>
</footer>
</div>
Expand Down
Loading
Loading