Skip to content

Commit 6af791e

Browse files
committed
test: login modal
1 parent 24342f6 commit 6af791e

7 files changed

+46
-15
lines changed

editions/online/tiddlywiki.info

+21-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,31 @@
11
{
2-
"plugins": [],
2+
"plugins": [
3+
"noteself/core"
4+
],
35
"themes": [],
46
"languages": [],
5-
"includeWikis": [ {"path": "../base", "read-only": true} ],
7+
"includeWikis": [
8+
{
9+
"path": "../base",
10+
"read-only": true
11+
}
12+
],
613
"build": {
714
"index": [
8-
"--output", "./dist/online/",
9-
"--rendertiddler", "$:/core/save/all", "index.html", "text/plain"
15+
"--output",
16+
"./dist/online/",
17+
"--rendertiddler",
18+
"$:/core/save/all",
19+
"index.html",
20+
"text/plain"
1021
],
1122
"dev": [
12-
"--output", "./dist/dev/",
13-
"--rendertiddler", "$:/core/save/all", "index.html", "text/plain"
23+
"--output",
24+
"./dist/dev/",
25+
"--rendertiddler",
26+
"$:/core/save/all",
27+
"index.html",
28+
"text/plain"
1429
]
1530
}
1631
}

jest.config.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,7 @@ module.exports = {
117117
// setupFiles: [],
118118

119119
// A list of paths to modules that run some code to configure or set up the testing framework before each test
120-
setupFilesAfterEnv: [ '<rootDir>/test/jest-setup.js' ],
121-
122-
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
123-
// snapshotSerializers: [],
124-
125-
// The test environment that will be used for testing
126-
// testEnvironment: "jest-environment-jsdom",
120+
setupFilesAfterEnv: [ '<rootDir>/test/jest-setup.js', "expect-puppeteer" ],
127121

128122
// Options that will be passed to the testEnvironment
129123
// testEnvironmentOptions: {},
@@ -174,6 +168,4 @@ module.exports = {
174168
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
175169
// watchPathIgnorePatterns: [],
176170

177-
// Whether to use watchman for file crawling
178-
// watchman: true,
179171
};

test/integration.test.js

+19
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
const puppeteer = require('puppeteer');
44
const path = require('path');
55

6+
const wait = time => new Promise(res => setTimeout(res, time))
7+
68
const waitForWikiLoad = async (page) => {
79
await page.waitForSelector('#TP_splash_screen', { hidden: true });
810
await page.waitForSelector('body.tc-body.tc-dirty', { hidden: true });
@@ -32,6 +34,23 @@ describe('Visual regression test of online version', () => {
3234
expect(image).toMatchImageSnapshot();
3335
});
3436

37+
it('login modal', async () => {
38+
await page.click('[aria-label="login"]')
39+
await page.waitForSelector('.tc-ns-login-popup', {visible: true})
40+
await wait(1000)
41+
const image = await page.screenshot({fullPage: true});
42+
expect(image).toMatchImageSnapshot();
43+
});
44+
45+
it('custom login tab', async () => {
46+
await expect( page ).toClick('[aria-label="login"]')
47+
await page.waitForSelector('.tc-ns-login-popup', {visible: true})
48+
await wait(1000)
49+
await expect(page).toClick('button',{text: 'Custom'})
50+
const image = await page.screenshot({fullPage: true});
51+
expect(image).toMatchImageSnapshot();
52+
});
53+
3554
afterAll(async () => {
3655
await browser.close();
3756
});

yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -2555,6 +2555,11 @@ expand-tilde@^1.2.2:
25552555
dependencies:
25562556
os-homedir "^1.0.1"
25572557

2558+
expect-puppeteer@^4.4.0:
2559+
version "4.4.0"
2560+
resolved "https://registry.yarnpkg.com/expect-puppeteer/-/expect-puppeteer-4.4.0.tgz#1c948af08acdd6c8cbdb7f90e617f44d86888886"
2561+
integrity sha512-6Ey4Xy2xvmuQu7z7YQtMsaMV0EHJRpVxIDOd5GRrm04/I3nkTKIutELfECsLp6le+b3SSa3cXhPiw6PgqzxYWA==
2562+
25582563
expect@^26.0.1:
25592564
version "26.0.1"
25602565
resolved "https://registry.yarnpkg.com/expect/-/expect-26.0.1.tgz#18697b9611a7e2725e20ba3ceadda49bc9865421"

0 commit comments

Comments
 (0)