Git Product home page Git Product logo

web-platform-tests / wpt Goto Github PK

View Code? Open in Web Editor NEW
4.6K 388.0 2.9K 1.02 GB

Test suites for Web platform specs — including WHATWG, W3C, and others

Home Page: https://web-platform-tests.org/

License: Other

HTML 86.33% Python 3.58% CSS 0.06% JavaScript 9.94% Makefile 0.01% Shell 0.04% Perl 0.03% Roff 0.01% Batchfile 0.01% Dockerfile 0.01% XSLT 0.01%
testing html test-automation browser w3c whatwg test-runner web-standards javascript dom

wpt's Introduction

The web-platform-tests Project

Taskcluster CI Status documentation manifest Python 3

The web-platform-tests Project is a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This in turn gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.

The most important sources of information and activity are:

  • github.com/web-platform-tests/wpt: the canonical location of the project's source code revision history and the discussion forum for changes to the code
  • web-platform-tests.org: the documentation website; details how to set up the project, how to write tests, how to give and receive peer review, how to serve as an administrator, and more
  • wpt.live: a public deployment of the test suite, allowing anyone to run the tests by visiting from an Internet-enabled browser of their choice
  • wpt.fyi: an archive of test results collected from an array of web browsers on a regular basis
  • Real-time chat room: the wpt:matrix.org matrix channel; includes participants located around the world, but busiest during the European working day.
  • Mailing list: a public and low-traffic discussion list
  • RFCs: a repo for requesting comments on substantial changes that would impact other stakeholders or users; people who work on WPT infra are encouraged to watch the repo.

If you'd like clarification about anything, don't hesitate to ask in the chat room or on the mailing list.

Setting Up the Repo

Clone or otherwise get https://github.com/web-platform-tests/wpt.

Note: because of the frequent creation and deletion of branches in this repo, it is recommended to "prune" stale branches when fetching updates, i.e. use git pull --prune (or git fetch -p && git merge).

Running the Tests

See the documentation website and in particular the system setup for running tests locally.

Command Line Tools

The wpt command provides a frontend to a variety of tools for working with and running web-platform-tests. Some of the most useful commands are:

  • wpt serve - For starting the wpt http server
  • wpt run - For running tests in a browser
  • wpt lint - For running the lint against all tests
  • wpt manifest - For updating or generating a MANIFEST.json test manifest
  • wpt install - For installing the latest release of a browser or webdriver server on the local machine.
  • wpt serve-wave - For starting the wpt http server and the WAVE test runner. For more details on how to use the WAVE test runner see the documentation.

Windows Notes

On Windows wpt commands must be prefixed with python or the path to the python binary (if python is not in your %PATH%).

python wpt [command]

Alternatively, you may also use Bash on Ubuntu on Windows in the Windows 10 Anniversary Update build, then access your windows partition from there to launch wpt commands.

Please make sure git and your text editor do not automatically convert line endings, as it will cause lint errors. For git, please set git config core.autocrlf false in your working tree.

Publication

The master branch is automatically synced to wpt.live and w3c-test.org.

Contributing

Save the Web, Write Some Tests!

Absolutely everyone is welcome to contribute to test development. No test is too small or too simple, especially if it corresponds to something for which you've noted an interoperability bug in a browser.

The way to contribute is just as usual:

  • Fork this repository (and make sure you're still relatively in sync with it if you forked a while ago).
  • Create a branch for your changes: git checkout -b topic.
  • Make your changes.
  • Run ./wpt lint as described above.
  • Commit locally and push that to your repo.
  • Create a pull request based on the above.

Issues with web-platform-tests

If you spot an issue with a test and are not comfortable providing a pull request per above to fix it, please file a new issue. Thank you!

wpt's People

Contributors

andreastt avatar andruud avatar annevk avatar autofoolip avatar ayg avatar bfgeek avatar chromium-wpt-export-bot avatar dbaron avatar dependabot[bot] avatar domenic avatar emilio avatar foolip avatar fred-wang avatar frivoal avatar gsnedders avatar jgraham avatar jugglinmike avatar kojiishi avatar masayuki-nakano avatar mrego avatar ms2ger avatar mstensho avatar nt1m avatar plehegar avatar rhauck avatar sideshowbarker avatar stephenmcgruer avatar whimboo avatar youennf avatar zcorpan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wpt's Issues

XMLHttpRequest/data-uri-basic.htm is incorrect

According to https://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#data:-urls-and-http, only requests with method GET have the prescribed processing applied, therefore asserting that the prescribed processing is applied for requests with the POST method is incorrect.

If anything, the POST requests should assert that no special processing is applied, so presumably a status code of 0 (but I don't believe there is any prescribed status code or header set)

Mention installing html5lib to run the tests in the readme

Arriving at python tools/scripts/manifest.py MANIFEST.json, I met an error:

Traceback (most recent call last):
  File "tools/scripts/manifest.py", line 466, in <module>
    update_manifest(repo_root, out_dir)
  File "tools/scripts/manifest.py", line 456, in update_manifest
    update(manifest)
  File "tools/scripts/manifest.py", line 436, in update
    import html5lib
ImportError: No module named html5lib

URL test data: tests starting with '#' are interpreted as comments

In urltestdata.txt any line starting with # is a comment, but there are a few test lines that start with #:

#  s:http h:example.org p:/foo/bar f:#
#/  s:http h:example.org p:/foo/bar f:#/
#\\  s:http h:example.org p:/foo/bar f:#\\
#;?  s:http h:example.org p:/foo/bar f:#;?

Comment syntax should be changed to something that is not ambiguous. For example:
/* ... */
-- ...

But not ; ..., which could lead to the same problem quite easily.

webmessaging tests with postMessage API

I have tried to fix a few issues with some of the tests with /webmessaging, there are still some outstanding issues.

I just want to leave a quick message for those that might stumble upon them.

Most are caused by the messages being sent from testharness.js that arrive before the actual message being tested. Therefore, without proper testing of either data type or data itself the test were failing.

'mediastream-finished-add' looks like a test for undefined behavior

audio.getAudioTracks()[0].stop();
assert_true(audio.ended, "Audio stream is ended after stopping its only audio track");
assert_throws("INVALID_STATE_ERR", function () { ... }, "Adding a track from a finished stream raises an INVALID_STATE_ERR exception");

Since following Bugs, INVALID_STATE_ERR is not defined.

Bug 24928: Remove MediaStream state check from addTrack() algorithm.
Bug 24930: Remove MediaStream state check from the removeTrack() algorithm.

And the spec document have not defined "If track is ended, throw an INVALID_STATE_ERR exception."

So, 'mediastream-finished-add' looks like a test for undefined behavior.
It looks like remove this test or change the spec.

Can't generate manifest file with steps as proposed

STR:

git clone [email protected]:w3c/web-platform-tests.git
cd web-platform-tests
git submodule init
git submodule update --recursive
python tools/scripts/manifest.py MANIFEST.json

The manifest file isn't generated and the following is printed:

INFO:Web platform tests:Working directory not clean, adding local changes

git status reveals modified: tools/pywebsocket (untracked content) which contains a bunch of untracked src/mod_pywebsocket/*.pyc files.

Reverting changes allows to generate the manifest, but then python serve.py doesn't work. That's solve by doing git submodule update --recursive again.

Maybe the issue can be solved with adding the guilty files to .gitignore somewhere.

delay.py not actually handling requests

XMLHttpRequest/xmlhttprequest-timeout-worker-aborted.html and XMLHttpRequest/xmlhttprequest-timeout-aborted.html 's third tests fail, but I think this is actually because delay.py is never used. serve.py is giving us a 404 for this request immediately after, so the tests are broken.

I'll see if I can figure out why, but my python-fu isn't the greatest. Broken tests aren't super helpful :3

Make a better CONTRIBUTING file.

Any time somebody creates a new issue or PR, they'll see a dialog that includes a link to
the CONTRIBUTING.md file, with the link text saying:

Please review the guidelines for contributing to this repository.

Unfortunately the current CONTRIBUTING.md file only contains information about the license for the test suite—it doesn't contain any actual guidelines for contributing.

We should update it to include some (at least minimal) guidelines for contributing.

set_dirty is using unspecified behaviour in html/semantics/forms/constraints/support/validator.js

CC @xiaojunwu
set_dirty is using non-standard behaviour not supported by Gecko to make an <input> "dirty" via document.execCommand("delete"). Using execCommand on without designMode/contentEditable is not specified in any current spec AFAIK. The suites setting dirty: true do not have accurate results because of this issue e.g.:

  • form-validation-validity-tooLong.html
  • form-validation-validity-tooShort.html
  • form-validation-validity-valid.html

XMLHttpRequest/abort-event-order.htm test incorrect

The expected result is impossible to attain due to the structure of the test.

It expects the following collection

[1, 4, "upload.abort", "upload.loadend", "abort", "loadend"];

however it performs the assertion in the event handler in upload.onloadend(), and so the assertions are evaluated before the other events are dispatched.

This would have worked, prior to 10010b1 --- perhaps the Verify function needs to be moved as well?

I'll submit a quick patch for that, because yeah I'm fairly sure this is what was intended

jsdom tests for attributes

Recently a contributor to jsdom noticed that our implementation of attributes was a holdover from the old W3C DOM days, and did some impressive work (jsdom/jsdom@4a630a3) to bring us up to spec with the WHATWG DOM spec.

In the course of doing so, he wrote some tests that I thought might be useful to you folks:

https://github.com/tmpvar/jsdom/blob/0c92f20d2a458c016fa82cd8742d15262770d563/test/living-dom/attributes.js

I unfortunately don't have the bandwidth currently to convert these into WPT format, but I thought it'd be cool to make you aware of it in case someone does want to take this on. (And yes, I know that ideally jsdom should just be running all the web platform tests; that's jsdom/jsdom#666.)

XMLHttpRequest/send-entity-body-get-head* tests should not fail if Content-Length is 0

From http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html

For response messages, whether or not a message-body is included with a message is dependent on both the request method and the response status code (section 6.1.1). All responses to the HEAD request method MUST NOT include a message-body, even though the presence of entity- header fields might lead one to believe they do.

So, what you really want to assert here, is that there is no request message-body, not whether there is a Content-Length header or not.

drawCustomFocusRing

web-platform-tests / 2dcontext / drawing-paths-to-the-canvas / canvas_focus_drawCustomFocusRing_001.html

will need to be revisited once we know what can be done with it.

new Worker('data:...') should not throw (Bug 24074)

Workers test case bug 24074:

[[
https://www.w3.org/Bugs/Public/show_bug.cgi?id=24074

http://w3c-test.org/web-platform-tests/master/workers/Worker_cross_origin_security_err.htm has the wrong pass condition.

[[
If the scheme component of worker URL is not "data", and the origin of worker URL is not the same as the origin specified by the incumbent settings object, then throw a SecurityError exception and abort these steps.
]]
http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#dom-worker
]]

second-argument-null.html worker test is incorrect

This bug was filed as Bugzilla bug 24077. Here is comment #1 but note there are additional comments in the bug:

[[
https://www.w3.org/Bugs/Public/show_bug.cgi?id=24077

The test has:

try {
postMessage(1, null);
} catch(e) {
postMessage(''+e);
}

and asserts that 1 is posted.

But the spec for postMessage is:

void postMessage(any message, optional sequence transfer);

and passing null to the second argument of that should throw, per webidl.

I recommend we do three things:

  1. Add a copy of this test that replaces the first postMessage line with:
 postMessage(1);
  1. Add a copy of this test that replaces the first postMessage line with:
 postMessage(1, undefined);
  1. Modify this test to check that postMessage(1, null) in fact throws.
    #1 and #2 would test correct handling of the optional argument when it's not actually passed and #3 would test correct handling of null here.

]]

Possible improvements to the CORS test suite

Matt Wobensmith, SQA Engineer at Mozilla did an awesomesauce review, that I have not fixed (originally from #112 ):


General:

  • CORS can be used for other network requests besides XHR
    • img, script, css, fonts
  • Cross-protocol - access a resource that is hosted via protocol that provides headers
    • FTP, HTTP, HTTPS to HTTP, HTTPS - various combinations

Access-Control-Allow-Origin response header

  • Simple request: when using "*" it cannot be used for a resource that supports credentials
  • Boundary/error values: long domain names, large amount of domain tokens, IP addresses, International Domain Names
  • Default request method for cross-origin request is GET
  • Default request headers empty by default.
  • Default entity body empty by default
  • Exclude Referer header if source origin is a globally unique identifier
  • if header value is "*" and omit credentials flag is false, fail

Access-Control-Allow-Methods

  • if request method is not case-sensitive match for methods and is not a simple method, error
  • If method is a simple method, including method value here - while not required - should not fail

Origin Request header

  • Verify that it is emitted from both x-domain request and preflight request

Access-Control-Allow-Credentials

  • If omit-credentials flag is not set and response includes 0 or more than one Access-Control-Allow-Credentials headers, fail.
  • If omit-credentials flag is not set and Access-Control-Allow-Credentials header value is not case-sensitive match for "true", fail.

Preflight:

  • Includes Access-Control-Request-Method header that includes the request method, even when this is a simple method
  • Includes Access-Control-Request-Headers with comma-seperated list of headers, in lexographical order, converted to ASCII lowercase even when one or more are a simple header
  • excludes author request headers
  • excludes user credentials
  • excludes the request entity body
  • if header parsing fails, error
  • in case of unable to cache due to disk space - proceed to actual request

Preflight cache:

  • Case-insensitive match for Origin invalidates preflight result cache
  • Access-Control-Max-Age - validate correct caching time
  • Access-Control-Max-Age - maximum cache time
  • Access-Control-Max-Age - error arguments (too large, too small, non-numeric)
  • Access-Control-Max-Age - if UA imposes high-end limit but response's max-age is higher, let maximum be equal to the response's max-age
  • If Access-Control-Max-Age is missing, duplicated or parsing failed, let max-age be at the discretion of UA (zero is allowed)
  • Cache match testing
    • Based on rules in spec, determine whether a resource is properly cached or not
    • Verify that an expired resource no longer in cache invokes new preflight request
    • If removed and then reinstated into cache, new values should be respected
    • Origin is removed from cache if error occurs
    • If list of exposed headers in a response is not empty, and Access-Control-Expose-Headers does not contain values, the preflight cache can be cleared for all case-sensitive matches to this Origin and URL.

Fix generator for canvas tests

When we moved the tests, the Python script that generates them was not updated. It needs to be fixed to take the new structure into account. This will likely require data about the spec's layout.

Also check that proper warnings for the edition of generated tests are included.

cite attribute test fails for the wrong reason

On line 39 https://github.com/w3c/web-platform-tests/blob/master/html/semantics/grouping-content/the-blockquote-element/grouping-blockquote.sub.html#L39

The test fails.

{actual: "blehblah", resolved: document.location.protocol + "//" + document.location.host + "/blehblah"},

It seems there should be the local context of the file for the path, aka the start of document.location.pathname without the final file.

A link in http://example.com/foo/bar/blah.html with the following markup

<a href="blehblah">boo</a>

would link to http://example.com/foo/bar/blehblah

A way to fix the test is to just test with '/'

{actual: "/blehblah", resolved: document.location.protocol + "//" + document.location.host + "/blehblah"},
or to extract the file from the document.location.pathname part, but a bit more annoying to do.

Some HTML5 i18n tests missing

There is mention on the W3 website (http://www.w3.org/International/tests/html5/the-input-byte-stream/results-basics) of some files like "the-input-byte-stream-027.html" which are not present in this repository.

They are however mentioned in the htaccess file (https://github.com/w3c/web-platform-tests/blob/master/html/syntax/parsing-html-fragments/.htaccess).

I though for a moment it was because they are "Exploratory tests" but then the "the-input-byte-stream-030.html" should not be there. (I'd prefer it they were all here ;-)

Thanks in advance!

<template> and XMLHttpRequest

var x = new XMLHttpRequest
x.open("GET", "data:text/xml,<template xmlns='http://www.w3.org/1999/xhtml'><test/></template>", false)
x.send()
w(x.responseXML.documentElement.content.firstChild.localName == "test")

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.