mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 05:37:20 +03:00
docs(readme): fix API link to always point to last released API
This commit is contained in:
parent
f114255a3d
commit
0f1a42a5d3
@ -1,7 +1,7 @@
|
||||
# Playwright
|
||||
[![npm version](https://img.shields.io/npm/v/playwright.svg?style=flat)](https://www.npmjs.com/package/playwright) [![Chromium version](https://img.shields.io/badge/chromium-81.0.4044-blue.svg)](https://www.chromium.org/Home) [![Firefox version](https://img.shields.io/badge/firefox-73.0b3-blue.svg)](https://www.mozilla.org/en-US/firefox/new/) [![WebKit version](https://img.shields.io/badge/webkit-13.0.4-blue.svg)](https://webkit.org/) [![Join Slack](https://img.shields.io/badge/join-slack-infomational)](https://join.slack.com/t/playwright/shared_invite/enQtOTEyMTUxMzgxMjIwLThjMDUxZmIyNTRiMTJjNjIyMzdmZDA3MTQxZWUwZTFjZjQwNGYxZGM5MzRmNzZlMWI5ZWUyOTkzMjE5Njg1NDg)
|
||||
|
||||
###### [API v0.10.0](https://github.com/microsoft/playwright/blob/master/docs/api-0.10.0.md) | [API latest](https://github.com/microsoft/playwright/blob/master/docs/api.md) | [FAQ](#faq) | [Contributing](#contributing)
|
||||
###### [API](https://github.com/microsoft/playwright/blob/v0.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](#contributing)
|
||||
|
||||
|
||||
Playwright is a Node library to automate the [Chromium](https://www.chromium.org/Home), [WebKit](https://webkit.org/) and [Firefox](https://www.mozilla.org/en-US/firefox/new/) browsers with a single API. It enables **cross-browser** web automation that is **ever-green**, **capable**, **reliable** and **fast**.
|
||||
|
3879
docs/api-0.10.0.md
3879
docs/api-0.10.0.md
File diff suppressed because it is too large
Load Diff
@ -18,8 +18,8 @@ const Message = require('../Message');
|
||||
|
||||
module.exports.ensureReleasedAPILinks = function(sources, version) {
|
||||
// Release version is everything that doesn't include "-".
|
||||
const apiLinkRegex = /https:\/\/github.com\/Microsoft\/playwright\/blob\/v[^/]*\/docs\/api.md/ig;
|
||||
const lastReleasedAPI = `https://github.com/Microsoft/playwright/blob/v${version.split('-')[0]}/docs/api.md`;
|
||||
const apiLinkRegex = /https:\/\/github.com\/microsoft\/playwright\/blob\/v[^/]*\/docs\/api.md/ig;
|
||||
const lastReleasedAPI = `https://github.com/microsoft/playwright/blob/v${version.split('-')[0]}/docs/api.md`;
|
||||
|
||||
const messages = [];
|
||||
for (const source of sources) {
|
||||
|
@ -28,36 +28,36 @@ const {expect} = new Matchers();
|
||||
describe('ensureReleasedAPILinks', function() {
|
||||
it('should work with non-release version', function() {
|
||||
const source = new Source('doc.md', `
|
||||
[API](https://github.com/Microsoft/playwright/blob/v1.1.0/docs/api.md#class-page)
|
||||
[API](https://github.com/microsoft/playwright/blob/v1.1.0/docs/api.md#class-page)
|
||||
`);
|
||||
const messages = ensureReleasedAPILinks([source], '1.3.0-post');
|
||||
expect(messages.length).toBe(1);
|
||||
expect(messages[0].type).toBe('warning');
|
||||
expect(messages[0].text).toContain('doc.md');
|
||||
expect(source.text()).toBe(`
|
||||
[API](https://github.com/Microsoft/playwright/blob/v1.3.0/docs/api.md#class-page)
|
||||
[API](https://github.com/microsoft/playwright/blob/v1.3.0/docs/api.md#class-page)
|
||||
`);
|
||||
});
|
||||
it('should work with release version', function() {
|
||||
const source = new Source('doc.md', `
|
||||
[API](https://github.com/Microsoft/playwright/blob/v1.1.0/docs/api.md#class-page)
|
||||
[API](https://github.com/microsoft/playwright/blob/v1.1.0/docs/api.md#class-page)
|
||||
`);
|
||||
const messages = ensureReleasedAPILinks([source], '1.3.0');
|
||||
expect(messages.length).toBe(1);
|
||||
expect(messages[0].type).toBe('warning');
|
||||
expect(messages[0].text).toContain('doc.md');
|
||||
expect(source.text()).toBe(`
|
||||
[API](https://github.com/Microsoft/playwright/blob/v1.3.0/docs/api.md#class-page)
|
||||
[API](https://github.com/microsoft/playwright/blob/v1.3.0/docs/api.md#class-page)
|
||||
`);
|
||||
});
|
||||
it('should keep master links intact', function() {
|
||||
const source = new Source('doc.md', `
|
||||
[API](https://github.com/Microsoft/playwright/blob/master/docs/api.md#class-page)
|
||||
[API](https://github.com/microsoft/playwright/blob/master/docs/api.md#class-page)
|
||||
`);
|
||||
const messages = ensureReleasedAPILinks([source], '1.3.0');
|
||||
expect(messages.length).toBe(0);
|
||||
expect(source.text()).toBe(`
|
||||
[API](https://github.com/Microsoft/playwright/blob/master/docs/api.md#class-page)
|
||||
[API](https://github.com/microsoft/playwright/blob/master/docs/api.md#class-page)
|
||||
`);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user