@appsemble/e2e 0.32.3 → 0.33.0
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
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#  Appsemble End 2 End Tests
|
|
2
2
|
|
|
3
3
|
> Run end 2 end tests on an Appsemble environment
|
|
4
4
|
|
|
5
|
-
[](https://gitlab.com/appsemble/appsemble/-/releases/0.33.0)
|
|
6
6
|
[](https://prettier.io)
|
|
7
7
|
|
|
8
8
|
## Table of Contents
|
|
@@ -60,5 +60,5 @@ When writing end-to-end tests, have a look at the
|
|
|
60
60
|
|
|
61
61
|
## License
|
|
62
62
|
|
|
63
|
-
[LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.
|
|
63
|
+
[LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.33.0/LICENSE.md) ©
|
|
64
64
|
[Appsemble](https://appsemble.com)
|
|
@@ -3,5 +3,11 @@ export interface TrainingFixtures {
|
|
|
3
3
|
* Resets the user's training progress
|
|
4
4
|
*/
|
|
5
5
|
resetTrainingProgress: () => Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* Set the given training to 'complete' on the server for the currently logged in user
|
|
8
|
+
*
|
|
9
|
+
* @param trainingId ID of the training to complete
|
|
10
|
+
*/
|
|
11
|
+
completeTraining: (trainingId: string) => Promise<void>;
|
|
6
12
|
}
|
|
7
13
|
export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & TrainingFixtures, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions>;
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import { test as base, expect } from '@playwright/test';
|
|
2
2
|
export const test = base.extend({
|
|
3
|
-
async resetTrainingProgress({
|
|
3
|
+
async resetTrainingProgress({ request }, use) {
|
|
4
4
|
await use(async () => {
|
|
5
|
-
const
|
|
6
|
-
expect(accessToken).not.toBeNull();
|
|
7
|
-
const { status } = await fetch(`${baseURL}/api/trainings/completed`, {
|
|
8
|
-
method: 'DELETE',
|
|
5
|
+
const response = await request.delete('/api/trainings/completed', {
|
|
9
6
|
headers: {
|
|
10
|
-
Authorization: `Bearer ${
|
|
11
|
-
'Content-Type': 'application/json',
|
|
7
|
+
Authorization: `Bearer ${process.env.ACCESS_TOKEN}`,
|
|
12
8
|
},
|
|
13
9
|
});
|
|
14
|
-
expect(status).toBe(204);
|
|
10
|
+
expect(response.status()).toBe(204);
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
async completeTraining({ request }, use) {
|
|
14
|
+
await use(async (trainingId) => {
|
|
15
|
+
const response = await request.post(`/api/trainings/completed/${trainingId}`, {
|
|
16
|
+
headers: {
|
|
17
|
+
Authorization: `Bearer ${process.env.ACCESS_TOKEN}`,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
expect(response.status()).toBe(201);
|
|
15
21
|
});
|
|
16
22
|
},
|
|
17
23
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appsemble/e2e",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "End-to-end tests used for testing Appsemble apps in an existing environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"test": "vitest"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@appsemble/utils": "0.
|
|
42
|
-
"@appsemble/types": "0.
|
|
41
|
+
"@appsemble/utils": "0.33.0",
|
|
42
|
+
"@appsemble/types": "0.33.0",
|
|
43
43
|
"jwt-decode": "^4.0.0",
|
|
44
44
|
"@fortawesome/fontawesome-free": "^6.0.0",
|
|
45
45
|
"@playwright/test": "1.51.1",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { expect, test } from '../../../
|
|
1
|
+
import { expect, test } from '../../../index.js';
|
|
2
2
|
test.beforeEach(async ({ page, resetTrainingProgress }) => {
|
|
3
3
|
await resetTrainingProgress();
|
|
4
4
|
await page.goto('/en/trainings');
|
|
@@ -40,4 +40,54 @@ test('should unlock next chapter once blocking chapter is completed', async ({ p
|
|
|
40
40
|
await expect(page.getByTestId(name)).toHaveChapterStatus(status);
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
+
test('should unlock all blocked chapters once blocker is completed', async ({ completeTraining, page, }) => {
|
|
44
|
+
await expect(page.getByTestId('rf__node-data-transformation')).toHaveChapterStatus('blocked');
|
|
45
|
+
await expect(page.getByTestId('rf__node-styling-apps')).toHaveChapterStatus('blocked');
|
|
46
|
+
const prerequisiteTrainings = [
|
|
47
|
+
'what-is-appsemble',
|
|
48
|
+
'get-familiar-with-the-studio',
|
|
49
|
+
'app-structure',
|
|
50
|
+
'what-is-a-page',
|
|
51
|
+
'what-is-a-block',
|
|
52
|
+
'simple-app',
|
|
53
|
+
'events',
|
|
54
|
+
'actions',
|
|
55
|
+
'what-is-a-resource',
|
|
56
|
+
'storing-resource-entry',
|
|
57
|
+
'fetching-resources',
|
|
58
|
+
];
|
|
59
|
+
for (const trainingId of prerequisiteTrainings) {
|
|
60
|
+
await completeTraining(trainingId);
|
|
61
|
+
}
|
|
62
|
+
await page.reload();
|
|
63
|
+
await expect(page.getByTestId('rf__node-data-transformation')).toHaveChapterStatus('available');
|
|
64
|
+
await expect(page.getByTestId('rf__node-styling-apps')).toHaveChapterStatus('available');
|
|
65
|
+
});
|
|
66
|
+
test('should unlock chapter that is blocked by multiple chapters when they are all completed', async ({ completeTraining, page, }) => {
|
|
67
|
+
await expect(page.getByTestId('rf__node-basic-app')).toHaveChapterStatus('blocked');
|
|
68
|
+
const prerequisiteTrainings = [
|
|
69
|
+
'what-is-appsemble',
|
|
70
|
+
'get-familiar-with-the-studio',
|
|
71
|
+
'app-structure',
|
|
72
|
+
'what-is-a-page',
|
|
73
|
+
'what-is-a-block',
|
|
74
|
+
'simple-app',
|
|
75
|
+
'events',
|
|
76
|
+
'actions',
|
|
77
|
+
'what-is-a-resource',
|
|
78
|
+
'storing-resource-entry',
|
|
79
|
+
'fetching-resources',
|
|
80
|
+
'what-are-remappers',
|
|
81
|
+
'remapper-chaining',
|
|
82
|
+
'remapper-history',
|
|
83
|
+
'styling-options',
|
|
84
|
+
'bulma-theming',
|
|
85
|
+
'custom-css',
|
|
86
|
+
];
|
|
87
|
+
for (const trainingId of prerequisiteTrainings) {
|
|
88
|
+
await completeTraining(trainingId);
|
|
89
|
+
}
|
|
90
|
+
await page.reload();
|
|
91
|
+
await expect(page.getByTestId('rf__node-basic-app')).toHaveChapterStatus('available');
|
|
92
|
+
});
|
|
43
93
|
//# sourceMappingURL=logged-in.spec.js.map
|