This commit is contained in:
Henry Jameson 2022-07-31 12:35:48 +03:00
commit fddb531ed2
133 changed files with 507 additions and 448 deletions

View file

@ -16,7 +16,7 @@ exports.assertion = function (selector, count) {
return res.value
}
this.command = function (cb) {
var self = this
const self = this
return this.api.execute(function (selector) {
return document.querySelectorAll(selector).length
}, [selector], function (res) {

View file

@ -1,45 +1,45 @@
require('@babel/register')
var config = require('../../config')
const config = require('../../config')
// http://nightwatchjs.org/guide#settings-file
module.exports = {
'src_folders': ['test/e2e/specs'],
'output_folder': 'test/e2e/reports',
'custom_assertions_path': ['test/e2e/custom-assertions'],
src_folders: ['test/e2e/specs'],
output_folder: 'test/e2e/reports',
custom_assertions_path: ['test/e2e/custom-assertions'],
'selenium': {
'start_process': true,
'server_path': 'node_modules/selenium-server/lib/runner/selenium-server-standalone-2.53.1.jar',
'host': '127.0.0.1',
'port': 4444,
'cli_args': {
selenium: {
start_process: true,
server_path: 'node_modules/selenium-server/lib/runner/selenium-server-standalone-2.53.1.jar',
host: '127.0.0.1',
port: 4444,
cli_args: {
'webdriver.chrome.driver': require('chromedriver').path
}
},
'test_settings': {
'default': {
'selenium_port': 4444,
'selenium_host': 'localhost',
'silent': true,
'globals': {
'devServerURL': 'http://localhost:' + (process.env.PORT || config.dev.port)
test_settings: {
default: {
selenium_port: 4444,
selenium_host: 'localhost',
silent: true,
globals: {
devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port)
}
},
'chrome': {
'desiredCapabilities': {
'browserName': 'chrome',
'javascriptEnabled': true,
'acceptSslCerts': true
chrome: {
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true
}
},
'firefox': {
'desiredCapabilities': {
'browserName': 'firefox',
'javascriptEnabled': true,
'acceptSslCerts': true
firefox: {
desiredCapabilities: {
browserName: 'firefox',
javascriptEnabled: true,
acceptSslCerts: true
}
}
}

View file

@ -1,6 +1,6 @@
// 1. start the dev server using production config
process.env.NODE_ENV = 'testing'
var server = require('../../build/dev-server.js')
const server = require('../../build/dev-server.js')
// 2. run the nightwatch test suite against it
// to run in additional browsers:
@ -9,7 +9,7 @@ var server = require('../../build/dev-server.js')
// or override the environment flag, for example: `npm run e2e -- --env chrome,firefox`
// For more information on Nightwatch's config file, see
// http://nightwatchjs.org/guide#settings-file
var opts = process.argv.slice(2)
let opts = process.argv.slice(2)
if (opts.indexOf('--config') === -1) {
opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js'])
}
@ -17,8 +17,8 @@ if (opts.indexOf('--env') === -1) {
opts = opts.concat(['--env', 'chrome'])
}
var spawn = require('cross-spawn')
var runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' })
const spawn = require('cross-spawn')
const runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' })
runner.on('exit', function (code) {
server.close()

View file

@ -4,14 +4,14 @@
// https://github.com/webpack/karma-webpack
// var path = require('path')
var merge = require('webpack-merge')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var baseConfig = require('../../build/webpack.base.conf')
var utils = require('../../build/utils')
var webpack = require('webpack')
const merge = require('webpack-merge')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const baseConfig = require('../../build/webpack.base.conf')
const utils = require('../../build/utils')
const webpack = require('webpack')
// var projectRoot = path.resolve(__dirname, '../../')
var webpackConfig = merge(baseConfig, {
const webpackConfig = merge(baseConfig, {
// use inline sourcemap for karma-sourcemap-loader
module: {
rules: utils.styleLoaders()
@ -63,7 +63,7 @@ module.exports = function (config) {
frameworks: ['mocha', 'sinon-chai'],
reporters: ['mocha'],
customLaunchers: {
'FirefoxHeadless': {
FirefoxHeadless: {
base: 'Firefox',
flags: [
'-headless'

View file

@ -29,7 +29,7 @@ const generateInput = (value, padEmoji = true) => {
modelValue: value
},
slots: {
'default': () => h('input', '')
default: () => h('input', '')
}
})
return wrapper

View file

@ -4,7 +4,7 @@ import RichContent from 'src/components/rich_content/rich_content.jsx'
const attentions = []
const global = {
mocks: {
'$store': {
$store: {
state: {},
getters: {
mergedConfig: () => ({

View file

@ -163,7 +163,7 @@ const localProfileStore = createStore({
currentUser: {
credentials: ''
},
usersObject: { 100: localUser, 'testuser': localUser },
usersObject: { 100: localUser, testuser: localUser },
users: [localUser],
relationships: {}
}
@ -175,7 +175,7 @@ describe.skip('UserProfile', () => {
it('renders external profile', () => {
const wrapper = mount(UserProfile, {
global: {
plugins: [ externalProfileStore ],
plugins: [externalProfileStore],
mocks: {
$route: {
params: { id: 100 },
@ -192,7 +192,7 @@ describe.skip('UserProfile', () => {
it('renders local profile', () => {
const wrapper = mount(UserProfile, {
global: {
plugins: [ localProfileStore ],
plugins: [localProfileStore],
mocks: {
$route: {
params: { name: 'testUser' },

View file

@ -245,7 +245,7 @@ describe('Statuses module', () => {
it('increments count in existing reaction', () => {
const state = defaultState()
const status = makeMockStatus({ id: '1' })
status.emoji_reactions = [ { name: '😂', count: 1, accounts: [] } ]
status.emoji_reactions = [{ name: '😂', count: 1, accounts: [] }]
mutations.addNewStatuses(state, { statuses: [status], showImmediately: true, timeline: 'public' })
mutations.addOwnReaction(state, { id: '1', emoji: '😂', currentUser: { id: 'me' } })
@ -269,7 +269,7 @@ describe('Statuses module', () => {
it('decreases count in existing reaction', () => {
const state = defaultState()
const status = makeMockStatus({ id: '1' })
status.emoji_reactions = [ { name: '😂', count: 2, accounts: [{ id: 'me' }] } ]
status.emoji_reactions = [{ name: '😂', count: 2, accounts: [{ id: 'me' }] }]
mutations.addNewStatuses(state, { statuses: [status], showImmediately: true, timeline: 'public' })
mutations.removeOwnReaction(state, { id: '1', emoji: '😂', currentUser: { id: 'me' } })

View file

@ -24,23 +24,23 @@ describe('chatService', () => {
describe('.add', () => {
it("Doesn't add duplicates", () => {
const chat = chatService.empty()
chatService.add(chat, { messages: [ message1 ] })
chatService.add(chat, { messages: [ message1 ] })
chatService.add(chat, { messages: [message1] })
chatService.add(chat, { messages: [message1] })
expect(chat.messages.length).to.eql(1)
chatService.add(chat, { messages: [ message2 ] })
chatService.add(chat, { messages: [message2] })
expect(chat.messages.length).to.eql(2)
})
it('Updates minId and lastMessage and newMessageCount', () => {
const chat = chatService.empty()
chatService.add(chat, { messages: [ message1 ] })
chatService.add(chat, { messages: [message1] })
expect(chat.maxId).to.eql(message1.id)
expect(chat.minId).to.eql(message1.id)
expect(chat.newMessageCount).to.eql(1)
chatService.add(chat, { messages: [ message2 ] })
chatService.add(chat, { messages: [message2] })
expect(chat.maxId).to.eql(message2.id)
expect(chat.minId).to.eql(message1.id)
expect(chat.newMessageCount).to.eql(2)
@ -50,7 +50,7 @@ describe('chatService', () => {
expect(chat.lastSeenMessageId).to.eql(message2.id)
// Add message with higher id
chatService.add(chat, { messages: [ message3 ] })
chatService.add(chat, { messages: [message3] })
expect(chat.newMessageCount).to.eql(1)
})
})
@ -59,9 +59,9 @@ describe('chatService', () => {
it('Updates minId and lastMessage', () => {
const chat = chatService.empty()
chatService.add(chat, { messages: [ message1 ] })
chatService.add(chat, { messages: [ message2 ] })
chatService.add(chat, { messages: [ message3 ] })
chatService.add(chat, { messages: [message1] })
chatService.add(chat, { messages: [message2] })
chatService.add(chat, { messages: [message3] })
expect(chat.maxId).to.eql(message3.id)
expect(chat.minId).to.eql(message1.id)
@ -80,9 +80,9 @@ describe('chatService', () => {
it('Inserts date separators', () => {
const chat = chatService.empty()
chatService.add(chat, { messages: [ message1 ] })
chatService.add(chat, { messages: [ message2 ] })
chatService.add(chat, { messages: [ message3 ] })
chatService.add(chat, { messages: [message1] })
chatService.add(chat, { messages: [message2] })
chatService.add(chat, { messages: [message3] })
const view = chatService.getView(chat)
expect(view.map(i => i.type)).to.eql(['date', 'message', 'message', 'date', 'message'])

View file

@ -314,8 +314,8 @@ describe('API Entities normalizer', () => {
const linkHeader = '<https://example.com/api/v1/notifications?max_id=861676>; rel="next", <https://example.com/api/v1/notifications?min_id=861741>; rel="prev"'
const result = parseLinkHeaderPagination(linkHeader)
expect(result).to.eql({
'maxId': 861676,
'minId': 861741
maxId: 861676,
minId: 861741
})
})
@ -323,8 +323,8 @@ describe('API Entities normalizer', () => {
const linkHeader = '<http://example.com/api/v1/timelines/home?max_id=9waQx5IIS48qVue2Ai>; rel="next", <http://example.com/api/v1/timelines/home?min_id=9wi61nIPnfn674xgie>; rel="prev"'
const result = parseLinkHeaderPagination(linkHeader, { flakeId: true })
expect(result).to.eql({
'maxId': '9waQx5IIS48qVue2Ai',
'minId': '9wi61nIPnfn674xgie'
maxId: '9waQx5IIS48qVue2Ai',
minId: '9wi61nIPnfn674xgie'
})
})
})

View file

@ -25,8 +25,8 @@ describe('fileSizeFormat', () => {
}
]
var res = []
for (var value in values) {
const res = []
for (const value in values) {
res.push(fileSizeFormatService.fileSizeFormat(values[value]))
}
expect(res).to.eql(expected)