plum-e2e 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/backend/_scaffold/pages/LoginPage.ts +24 -0
- package/backend/_scaffold/step_definitions/{LoginSteps.js → LoginSteps.ts} +1 -1
- package/backend/_scaffold/utils/constants.ts +1 -0
- package/backend/_scaffold/utils/hooks.ts +36 -0
- package/backend/_scaffold/utils/utils.ts +13 -0
- package/backend/_scaffold/utils/world.ts +25 -0
- package/backend/config/scripts/run-tests.js +19 -6
- package/backend/cucumber.json +3 -2
- package/backend/package-lock.json +3598 -3403
- package/backend/package.json +4 -2
- package/backend/playwright.config.js +3 -3
- package/backend/tsconfig.json +13 -0
- package/frontend/package-lock.json +2894 -2894
- package/package.json +4 -2
- package/backend/_scaffold/pages/LoginPage.js +0 -22
- package/backend/_scaffold/utils/constants.js +0 -3
- package/backend/_scaffold/utils/hooks.js +0 -65
- package/backend/_scaffold/utils/utils.js +0 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plum-e2e",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/silverlunah/plum.git"
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
"init": "(npm install) && (cd backend && npm install && npm run create-env && node config/scripts/create-settings.js) && (cd ../frontend && npm install && echo 'Frontend install complete')",
|
|
12
12
|
"format": "prettier --write .",
|
|
13
13
|
"add-license": "npx license-check-and-add add -f license-config.json",
|
|
14
|
-
"prepare": "husky"
|
|
14
|
+
"prepare": "husky",
|
|
15
|
+
"docker:up": "docker compose up -d --build",
|
|
16
|
+
"docker:down": "docker compose down"
|
|
15
17
|
},
|
|
16
18
|
"keywords": [],
|
|
17
19
|
"bin": {
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const { SAMPLE_CONSTANT } = require('../utils/constants');
|
|
2
|
-
const Utils = require('../utils/utils');
|
|
3
|
-
|
|
4
|
-
class LoginPage {
|
|
5
|
-
constructor(page) {
|
|
6
|
-
this.page = page;
|
|
7
|
-
this.utils = new Utils(this.page);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
async goToLoginPage() {
|
|
11
|
-
console.log(SAMPLE_CONSTANT);
|
|
12
|
-
await this.utils.goToPage(process.env.BASE_URL);
|
|
13
|
-
await this.page.waitForTimeout(3000);
|
|
14
|
-
throw Error();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async skipTest() {
|
|
18
|
-
test.skip();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
module.exports = LoginPage;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of Plum.
|
|
3
|
-
*
|
|
4
|
-
* Plum is free software: you can redistribute it and/or modify
|
|
5
|
-
* it under the terms of the GNU General Public License as published by
|
|
6
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
7
|
-
* (at your option) any later version.
|
|
8
|
-
*
|
|
9
|
-
* Plum is distributed in the hope that it will be useful,
|
|
10
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
* GNU General Public License for more details.
|
|
13
|
-
*
|
|
14
|
-
* You should have received a copy of the GNU General Public License
|
|
15
|
-
* along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
require('dotenv').config();
|
|
19
|
-
|
|
20
|
-
const { Before, After, setWorldConstructor } = require('@cucumber/cucumber');
|
|
21
|
-
const { chromium } = require('playwright');
|
|
22
|
-
const fs = require('fs');
|
|
23
|
-
const path = require('path');
|
|
24
|
-
const Utils = require('../utils/utils');
|
|
25
|
-
const LoginPage = require('../pages/LoginPage');
|
|
26
|
-
|
|
27
|
-
class CustomWorld {
|
|
28
|
-
constructor({ attach }) {
|
|
29
|
-
// Enable attaching files to reports
|
|
30
|
-
this.attach = attach;
|
|
31
|
-
|
|
32
|
-
// Instance
|
|
33
|
-
this.browser = null;
|
|
34
|
-
this.context = null;
|
|
35
|
-
this.page = null;
|
|
36
|
-
|
|
37
|
-
// Pages
|
|
38
|
-
this.loginPage = null;
|
|
39
|
-
this.utils = null;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
setWorldConstructor(CustomWorld);
|
|
44
|
-
|
|
45
|
-
Before(async function () {
|
|
46
|
-
this.browser = await chromium.launch({ headless: process.env.IS_HEADLESS === 'true' });
|
|
47
|
-
this.context = await this.browser.newContext();
|
|
48
|
-
this.page = await this.context.newPage();
|
|
49
|
-
this.loginPage = new LoginPage(this.page);
|
|
50
|
-
this.utils = new Utils(this.page);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
After(async function (scenario) {
|
|
54
|
-
if (scenario.result.status === 'FAILED') {
|
|
55
|
-
const screenshotPath = path.join('reports/screenshots', `screenshot_${Date.now()}.png`);
|
|
56
|
-
await this.page.screenshot({ path: screenshotPath });
|
|
57
|
-
|
|
58
|
-
// Attach screenshot to the Cucumber report
|
|
59
|
-
const screenshotData = fs.readFileSync(screenshotPath);
|
|
60
|
-
this.attach(screenshotData, 'image/png');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Close the browser after each test
|
|
64
|
-
await this.browser.close();
|
|
65
|
-
});
|