@appsemble/e2e 0.40.5 → 0.40.7-node-brotli.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 +3 -3
- package/fixtures/test/index.d.ts +2 -0
- package/fixtures/test/index.js +17 -1
- package/fixtures/test/live-app/index.js +1 -1
- package/package.json +7 -6
- package/tests/demo-apps/mail.spec.d.ts +1 -0
- package/tests/demo-apps/mail.spec.js +31 -0
- package/tests/static-ui/apps.spec.js +3 -3
- package/tests/studio/organizations.spec.js +4 -0
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 and provide Appsemble fixtures
|
|
4
4
|
|
|
5
|
-
[](https://gitlab.com/appsemble/appsemble/-/releases/0.40.7-node-brotli.0)
|
|
6
6
|
[](https://prettier.io)
|
|
7
7
|
|
|
8
8
|
## Table of Contents
|
|
@@ -102,5 +102,5 @@ When writing end-to-end tests, have a look at the
|
|
|
102
102
|
|
|
103
103
|
## License
|
|
104
104
|
|
|
105
|
-
[LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.40.
|
|
105
|
+
[LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.40.7-node-brotli.0/LICENSE.md) ©
|
|
106
106
|
[Appsemble](https://appsemble.com)
|
package/fixtures/test/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MailpitClient } from 'mailpit-api';
|
|
1
2
|
/**
|
|
2
3
|
* Base test object with all utility fixtures
|
|
3
4
|
*/
|
|
@@ -9,4 +10,5 @@ export declare const baseTest: import("@playwright/test").TestType<import("@play
|
|
|
9
10
|
*/
|
|
10
11
|
export declare const authenticatedTest: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & import("./accessibility/index.js").AccessibilityFixtures & import("./app/index.js").AppFixtures & import("./app-collection/index.js").AppCollectionFixtures & import("./demo-app/index.js").DemoAppFixtures & import("./group/index.js").GroupFixtures & import("./live-app/index.js").LiveAppFixtures & import("./organization/index.js").OrganizationFixtures & import("./resource/index.js").ResourceFixtures & import("./studio/index.js").StudioFixtures & import("./test-utils/index.js").TestUtilsFixtures & import("./training/index.js").TrainingFixtures & object, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & {
|
|
11
12
|
workerStorageState: string;
|
|
13
|
+
mailpit: MailpitClient;
|
|
12
14
|
}>;
|
package/fixtures/test/index.js
CHANGED
|
@@ -13,10 +13,12 @@ import { test as resourceFixtures } from './resource/index.js';
|
|
|
13
13
|
import { test as studioFixtures } from './studio/index.js';
|
|
14
14
|
import { test as testUtilsFixtures } from './test-utils/index.js';
|
|
15
15
|
import { test as trainingFixtures } from './training/index.js';
|
|
16
|
+
import { MailpitClient } from 'mailpit-api';
|
|
16
17
|
/**
|
|
17
18
|
* Base test object with all utility fixtures
|
|
18
19
|
*/
|
|
19
20
|
export const baseTest = mergeTests(accessibilityFixtures, appFixtures, appCollectionFixtures, demoAppFixtures, groupFixtures, liveAppFixtures, organizationFixtures, resourceFixtures, studioFixtures, testUtilsFixtures, trainingFixtures);
|
|
21
|
+
const mailpitURL = process.env.MAILPIT_URL ?? 'http://localhost:8025';
|
|
20
22
|
/**
|
|
21
23
|
* Test object with the worker's storage state saved
|
|
22
24
|
*
|
|
@@ -41,7 +43,7 @@ export const authenticatedTest = baseTest.extend({
|
|
|
41
43
|
await page.getByTestId('password').fill(password);
|
|
42
44
|
await page.getByTestId('login').click();
|
|
43
45
|
// Wait until auth state is saved in browser storage
|
|
44
|
-
await expect(page.getByText('My
|
|
46
|
+
await expect(page.getByText('My apps')).toBeVisible();
|
|
45
47
|
await page.context().storageState({ path: fileName });
|
|
46
48
|
await page.close();
|
|
47
49
|
await use(fileName);
|
|
@@ -60,5 +62,19 @@ export const authenticatedTest = baseTest.extend({
|
|
|
60
62
|
await use(newRequest);
|
|
61
63
|
await newRequest.dispose();
|
|
62
64
|
},
|
|
65
|
+
mailpit: [
|
|
66
|
+
async ({}, use, testInfo) => {
|
|
67
|
+
const mailpit = new MailpitClient(mailpitURL);
|
|
68
|
+
const queryEmailsToThisWorker = `to:worker-${testInfo.parallelIndex}@appsemble.com`;
|
|
69
|
+
await mailpit.deleteMessagesBySearch({ query: queryEmailsToThisWorker });
|
|
70
|
+
try {
|
|
71
|
+
await use(mailpit);
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
await mailpit.deleteMessagesBySearch({ query: queryEmailsToThisWorker });
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{ scope: 'worker' },
|
|
78
|
+
],
|
|
63
79
|
});
|
|
64
80
|
//# sourceMappingURL=index.js.map
|
|
@@ -43,7 +43,7 @@ export const test = base.extend({
|
|
|
43
43
|
const response = await request.post(`/api/users/current/auth/oauth2/apps/${appId}/consent/agree`, {
|
|
44
44
|
data: {
|
|
45
45
|
redirectUri: url,
|
|
46
|
-
scope: 'openid',
|
|
46
|
+
scope: 'email groups:read groups:write openid profile resources:manage',
|
|
47
47
|
},
|
|
48
48
|
});
|
|
49
49
|
expect(response.status()).toBe(201);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appsemble/e2e",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.7-node-brotli.0",
|
|
4
4
|
"description": "End-to-end tests used for testing Appsemble apps in an existing environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -40,11 +40,12 @@
|
|
|
40
40
|
"@playwright/test": "Pinned exact and kept in sync with the mcr.microsoft.com/playwright:v<version>-noble tags of the `mermaid svgs`, `e2e node`, and `e2e keycloak` jobs in .gitlab-ci.yml; Renovate bumps them all together (see renovate.json)."
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@appsemble/lang-sdk": "0.40.
|
|
44
|
-
"@appsemble/node-utils": "0.40.
|
|
45
|
-
"@appsemble/types": "0.40.
|
|
46
|
-
"@axe-core/playwright": "4.
|
|
47
|
-
"@playwright/test": "1.
|
|
43
|
+
"@appsemble/lang-sdk": "0.40.7-node-brotli.0",
|
|
44
|
+
"@appsemble/node-utils": "0.40.7-node-brotli.0",
|
|
45
|
+
"@appsemble/types": "0.40.7-node-brotli.0",
|
|
46
|
+
"@axe-core/playwright": "4.14.0",
|
|
47
|
+
"@playwright/test": "1.64.1",
|
|
48
|
+
"mailpit-api": "^2.1.0",
|
|
48
49
|
"strip-indent": "^4.0.0"
|
|
49
50
|
},
|
|
50
51
|
"engines": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { expect, authenticatedTest as test } from '../../index.js';
|
|
3
|
+
let appId;
|
|
4
|
+
let organizationId;
|
|
5
|
+
test.describe('Mail', () => {
|
|
6
|
+
test.beforeAll(async ({ createApp, createOrganization, randomTestId, giveAppConsent }) => {
|
|
7
|
+
const appDefinition = await readFile('../../apps/mail/app-definition.yaml', 'utf8');
|
|
8
|
+
organizationId = (await createOrganization({ id: randomTestId() })).id;
|
|
9
|
+
appId = (await createApp(organizationId, appDefinition)).id;
|
|
10
|
+
await giveAppConsent(appId);
|
|
11
|
+
});
|
|
12
|
+
test.beforeEach(async ({ visitApp, loginAppAppsembleOAuth }) => {
|
|
13
|
+
await visitApp(appId);
|
|
14
|
+
await loginAppAppsembleOAuth();
|
|
15
|
+
});
|
|
16
|
+
test.afterAll(async ({ deleteApp, deleteOrganization }) => {
|
|
17
|
+
await deleteApp(appId);
|
|
18
|
+
await deleteOrganization(organizationId);
|
|
19
|
+
});
|
|
20
|
+
test('should send an email when pressing the email button', async ({ page, mailpit, }, testInfo) => {
|
|
21
|
+
await page.locator('[data-block="@appsemble/action-button"]').getByRole('button').click();
|
|
22
|
+
await page.waitForResponse('**/actions/pages.0.blocks.0.actions.onClick');
|
|
23
|
+
const message = await mailpit.waitForMessage({
|
|
24
|
+
query: `to:worker-${testInfo.parallelIndex}@appsemble.com from:Appsemble Mail App`,
|
|
25
|
+
});
|
|
26
|
+
expect(message.Subject).toBe('Test Email');
|
|
27
|
+
expect(message.From.Name).toBe('Appsemble Mail App');
|
|
28
|
+
expect(message.Text.trim()).toBe('This is a test email.');
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=mail.spec.js.map
|
|
@@ -13,16 +13,16 @@ test.describe('Apps', () => {
|
|
|
13
13
|
await page.goto('/en/apps');
|
|
14
14
|
});
|
|
15
15
|
test('should show the page header', async ({ page }) => {
|
|
16
|
-
await expect(page.getByRole('heading', { name: 'All
|
|
16
|
+
await expect(page.getByRole('heading', { name: 'All apps', exact: true })).toBeVisible();
|
|
17
17
|
});
|
|
18
|
-
test('should display “My
|
|
18
|
+
test('should display “My apps” when logged in', async ({ browser, loginUserOnPage, randomTestId, }) => {
|
|
19
19
|
const name = 'Test user';
|
|
20
20
|
const email = `${randomTestId()}@test.com`;
|
|
21
21
|
const password = '1';
|
|
22
22
|
await createUser(name, email, password);
|
|
23
23
|
const page = await browser.newPage({ storageState: undefined });
|
|
24
24
|
await loginUserOnPage(email, password, page);
|
|
25
|
-
await expect(page.getByRole('heading', { name: 'My
|
|
25
|
+
await expect(page.getByRole('heading', { name: 'My apps', exact: true })).toBeVisible();
|
|
26
26
|
await deleteUser(email);
|
|
27
27
|
});
|
|
28
28
|
test('should render list of apps', async ({ page }) => {
|
|
@@ -17,6 +17,8 @@ test.describe('Organizations', () => {
|
|
|
17
17
|
await page.getByRole('button', { name: 'Add members' }).click();
|
|
18
18
|
await page.getByRole('textbox', { name: 'Email' }).fill(email);
|
|
19
19
|
await page.locator('form').getByRole('button', { name: 'Add members' }).click();
|
|
20
|
+
// The page can be used while the dialog transitions out, so wait until it's gone.
|
|
21
|
+
await expect(page.getByRole('dialog')).toBeHidden();
|
|
20
22
|
const memberRow = page.getByRole('row', { name: email });
|
|
21
23
|
await expect(memberRow).toBeVisible();
|
|
22
24
|
await memberRow.getByRole('button', { name: '' }).click();
|
|
@@ -29,6 +31,8 @@ test.describe('Organizations', () => {
|
|
|
29
31
|
await page.getByRole('button', { name: 'Add members' }).click();
|
|
30
32
|
await page.getByRole('textbox', { name: 'Email' }).fill(email);
|
|
31
33
|
await page.locator('form').getByRole('button', { name: 'Add members' }).click();
|
|
34
|
+
// The page can be used while the dialog transitions out, so wait until it's gone.
|
|
35
|
+
await expect(page.getByRole('dialog')).toBeHidden();
|
|
32
36
|
const memberRow = page.getByRole('row', { name: email });
|
|
33
37
|
await expect(memberRow).toBeVisible();
|
|
34
38
|
await memberRow.getByRole('button', { name: '' }).click();
|