Skip to content

Commit

Permalink
FIX tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pubkey committed Nov 21, 2024
1 parent ab59948 commit ebdebc4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions examples/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"start": "concurrently \"npm run server\" \"npm run dev\"",
"server": "pouchdb-server --host 0.0.0.0 -p 10102 -m -d /tmp/pouchdb-server/ -n true",
"test:react": "react-scripts test --env=jsdom",
"test": "testcafe chromium -e test/ --hostname localhost --selector-timeout 30000",
"test:build": "concurrently \"npm run server\" \"npm run build:serve\" \"npm run test\" --kill-others --success first"
"test": "testcafe chromium -e test/e2e.test.js --hostname localhost --selector-timeout 30000 --ajax-request-timeout 1000",
"test:build": "npm run build && concurrently \"npm run server\" \"npm run build:serve\" \"npm run test\" --kill-others --success first"
},
"browserslist": {
"production": [
Expand Down
7 changes: 5 additions & 2 deletions examples/react/src/Database.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,23 @@ import {
} from './Schema';

import { replicateCouchDB } from 'rxdb/plugins/replication-couchdb';
import { wrappedValidateAjvStorage } from 'rxdb/plugins/validate-ajv';

import { RxDBLeaderElectionPlugin } from 'rxdb/plugins/leader-election';
addRxPlugin(RxDBLeaderElectionPlugin);

const syncURL = 'http://' + window.location.hostname + ':10102/';
console.log('host: ' + syncURL);

import { RxDBDevModePlugin } from 'rxdb/plugins/dev-mode';
let dbPromise = null;

const _create = async () => {
addRxPlugin(RxDBDevModePlugin);

console.log('DatabaseService: creating database..');
const db = await createRxDatabase({
name: 'heroesreactdb',
storage: getRxStorageDexie()
storage: wrappedValidateAjvStorage({ storage: getRxStorageDexie() })
});
console.log('DatabaseService: created database');
window['db'] = db; // write to window for debugging
Expand Down
4 changes: 2 additions & 2 deletions examples/react/test/e2e.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import AsyncTestUtil from 'async-test-util';

// eslint-disable-next-line @typescript-eslint/no-unused-expressions, no-unused-expressions
fixture`Example page`
.page`http://0.0.0.0:8888/`;
.page`http://localhost:8888/`;


test('insert/edit/remove a hero', async t => {
test.page('http://localhost:8888/')('insert/edit/remove a hero', async t => {
// clear previous heroes
const heroElements = Selector('#heroes-list li');
const amount = await heroElements.count;
Expand Down
8 changes: 4 additions & 4 deletions examples/vue/test/e2e.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import {
import AsyncTestUtil from 'async-test-util';

fixture('Example page')
.page('http://0.0.0.0:8888/');
.page('http://localhost:8888/');


test('insert/edit/remove a hero', async (t) => {
test.page('http://localhost:8888/')('insert/edit/remove a hero', async (t) => {
// input name
const heroNameInput = Selector('#insert-box input[name=name]');
await t
Expand Down Expand Up @@ -35,7 +35,7 @@ test('insert/edit/remove a hero', async (t) => {
await t.expect(Selector('#list-box .hero-name').count).eql(0);
});

test.page('http://0.0.0.0:8888/multitab.html?frames=2')('multitab: insert hero and check other tab', async (t) => {
test.page('http://localhost:8888/multitab.html?frames=2')('multitab: insert hero and check other tab', async (t) => {

await t.switchToIframe('#frame_0');

Expand All @@ -58,7 +58,7 @@ test.page('http://0.0.0.0:8888/multitab.html?frames=2')('multitab: insert hero a
});


test.page('http://0.0.0.0:8888/multitab.html?frames=6')('leader-election: Exact one tab should become leader', async (t) => {
test.page('http://localhost:8888/multitab.html?frames=6')('leader-election: Exact one tab should become leader', async (t) => {
// wait until last tab loaded
await t.switchToIframe('#frame_5');
const heroNameInput = Selector('#insert-box input[name=name]');
Expand Down

0 comments on commit ebdebc4

Please sign in to comment.