mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 23:57:55 -05:00
Merge pull request #4306 from LLK/release/2020-08-12
[Master] Release 2020-08-12
This commit is contained in:
commit
61b6b118d8
5 changed files with 998 additions and 600 deletions
1532
package-lock.json
generated
1532
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -68,7 +68,7 @@
|
|||
"babel-preset-react": "6.22.0",
|
||||
"bowser": "1.9.4",
|
||||
"cheerio": "1.0.0-rc.2",
|
||||
"chromedriver": "76.0.0",
|
||||
"chromedriver": "84.0.1",
|
||||
"classnames": "2.2.5",
|
||||
"cookie": "0.4.1",
|
||||
"copy-webpack-plugin": "0.2.0",
|
||||
|
@ -128,7 +128,7 @@
|
|||
"redux-mock-store": "^1.2.3",
|
||||
"redux-thunk": "2.0.1",
|
||||
"sass-loader": "6.0.6",
|
||||
"scratch-gui": "0.1.0-prerelease.20200806190218",
|
||||
"scratch-gui": "0.1.0-prerelease.20200812071833",
|
||||
"scratch-l10n": "latest",
|
||||
"selenium-webdriver": "3.6.0",
|
||||
"slick-carousel": "1.6.0",
|
||||
|
|
|
@ -78,7 +78,8 @@ const Jar = {
|
|||
set: (name, value, opts) => {
|
||||
opts = opts || {};
|
||||
defaults(opts, {
|
||||
expires: new Date(new Date().setYear(new Date().getFullYear() + 1))
|
||||
expires: new Date(new Date().setYear(new Date().getFullYear() + 1)),
|
||||
sameSite: 'Lax' // cookie library requires this capitialization of sameSite
|
||||
});
|
||||
opts.path = '/';
|
||||
const obj = cookie.serialize(name, value, opts);
|
||||
|
|
|
@ -17,6 +17,8 @@ let wwwURL = rootUrl;
|
|||
|
||||
if (remote){
|
||||
jest.setTimeout(60000);
|
||||
} else {
|
||||
jest.setTimeout(10000);
|
||||
}
|
||||
|
||||
let driver;
|
||||
|
@ -41,8 +43,10 @@ describe('www-integration sign-in-and-out', () => {
|
|||
await name.sendKeys(username);
|
||||
let word = await findByXpath('//input[@id="frc-password-1088"]');
|
||||
await word.sendKeys(password);
|
||||
await driver.sleep(500);
|
||||
await clickXpath('//button[contains(@class, "button") and ' +
|
||||
'contains(@class, "submit-button") and contains(@class, "white")]');
|
||||
await driver.sleep(500);
|
||||
let element = await findByXpath('//span[contains(@class, "profile-name")]');
|
||||
let text = await element.getText();
|
||||
await expect(text.toLowerCase()).toEqual(username.toLowerCase());
|
||||
|
@ -70,8 +74,10 @@ describe('www-integration sign-in-and-out', () => {
|
|||
await name.sendKeys(username);
|
||||
let word = await findByXpath('//input[@id="frc-password-1088"]');
|
||||
await word.sendKeys(password);
|
||||
await driver.sleep(500);
|
||||
await clickXpath('//button[contains(@class, "button") and ' +
|
||||
'contains(@class, "submit-button") and contains(@class, "white")]');
|
||||
await driver.sleep(500);
|
||||
});
|
||||
|
||||
test('sign out on www', async () => {
|
||||
|
|
53
test/unit/lib/jar.test.js
Normal file
53
test/unit/lib/jar.test.js
Normal file
|
@ -0,0 +1,53 @@
|
|||
const jar = require('../../../src/lib/jar');
|
||||
const cookie = require('cookie');
|
||||
|
||||
jest.mock('cookie', () => ({serialize: jest.fn()}));
|
||||
describe('unit test lib/jar.js', () => {
|
||||
|
||||
test('simple set test with no opts', () => {
|
||||
jar.set('name', 'value');
|
||||
expect(cookie.serialize).toHaveBeenCalled();
|
||||
expect(cookie.serialize).toHaveBeenCalledWith('name', 'value',
|
||||
expect.objectContaining({
|
||||
path: '/',
|
||||
sameSite: 'Lax',
|
||||
expires: expect.anything() // not specifically matching the date because it is hard to mock
|
||||
}));
|
||||
});
|
||||
test('test with opts', () => {
|
||||
jar.set('a', 'b', {option: 'one'});
|
||||
expect(cookie.serialize).toHaveBeenCalled();
|
||||
expect(cookie.serialize).toHaveBeenCalledWith('a', 'b',
|
||||
expect.objectContaining({
|
||||
option: 'one',
|
||||
path: '/',
|
||||
sameSite: 'Lax',
|
||||
expires: expect.anything() // not specifically matching the date because it is hard to mock
|
||||
}));
|
||||
});
|
||||
test('expires opts overrides default', () => {
|
||||
jar.set('a', 'b', {
|
||||
option: 'one',
|
||||
expires: 'someday'
|
||||
});
|
||||
expect(cookie.serialize).toHaveBeenCalled();
|
||||
expect(cookie.serialize).toHaveBeenCalledWith('a', 'b',
|
||||
expect.objectContaining({
|
||||
option: 'one',
|
||||
path: '/',
|
||||
expires: 'someday'
|
||||
}));
|
||||
});
|
||||
test('sameSite opts overrides default', () => {
|
||||
jar.set('a', 'b', {
|
||||
option: 'one',
|
||||
sameSite: 'override'
|
||||
});
|
||||
expect(cookie.serialize).toHaveBeenCalled();
|
||||
expect(cookie.serialize).toHaveBeenCalledWith('a', 'b',
|
||||
expect.objectContaining({
|
||||
option: 'one',
|
||||
sameSite: 'override'
|
||||
}));
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue