Giter VIP home page Giter VIP logo

solid-crud-tests's Introduction

storage-tests

Surface tests for CRUD and Websockets-pubsub functionality of a pod server

Usage

There are two ways to run these tests:

With some webid-oidc user

First, add 'https://tester' as a trusted app. Assuming the server has Solid OS as its web interface, the steps are as follows:

  • using your browser, log in to the pod
  • top right menu
  • Preferences
  • Preferences
  • Manage your trusted applications (may require a page refresh before it displays properly),
  • Tick Read + Write,
  • Click Add

Now, get a cookie that will allow this user to silently authenticate. You can use a curl command, for instance for node-solid-server it would POST 'username' and 'password' to /login/password and run the tests, as follows:

npm ci

export SERVER_ROOT=https://solid-crud-tests-example-1.solidcommunity.net
export USERNAME=solid-crud-tests-example-1
export PASSWORD=123
# This curl command is specific to node-solid-server:
export CURL_RESULT=`curl -i $SERVER_ROOT/login/password -d"username=$USERNAME&password=$PASSWORD" | grep Set-Cookie`
# The COOKIE will be used when going through the webid-oidc flow:
export COOKIE=`expr "$CURL_RESULT" : '^Set-Cookie:\ \(.*\).'`
# The SERVER_ROOT will be used both for webid-oidc discovery and as the base container to run the tests against:
echo Server root is $SERVER_ROOT
echo Cookie is $COOKIE
npm run jest
# Or: ./node_modules/.bin/jest --timeout=60000

You should see something like:

Tests:       17 failed, 55 passed, 62 total

You can also harvest the cookie using your web browser's developer tools instead of curl. Or for instance for programmatically getting a cookie for Nextcloud, our test suites use Puppeteer. Set it into the COOKIE env var, set the SERVER_ROOT, and run npm run jest.

With public access

If you run against a container with public read/write access, then it's not necessary to add https://tester as a trusted app. Instead (assuming the server has Solid OS as its web interface):

  • using your browser, log in to the pod
  • click the folder icon
  • click the green +
  • click the folder icon
  • pick a folder name
  • click the triangle before the name of the newly created container
  • click the padlock icon
  • Set specific sharing for this folder
  • Click the green +
  • Click the globe icon
  • If you don't see the globe icon appear next to 'Viewers', refresh the page
  • Drag the globe icon from 'Viewers' to 'Editors'

Now you can run without a COOKIE environment variable:

npm install
export SERVER_ROOT=https://solid-crud-tests-example-2.solidcommunity.net/test-folder/
npm run jest

In development

Start your server with a self-signed cert on port 443 of localhost and run with:

export NODE_TLS_REJECT_UNAUTHORIZED=0
export SERVER_ROOT=https://localhost

solid-crud-tests's People

Contributors

michielbdejong avatar ylebre avatar renovate-bot avatar rubenverborgh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.