Skip to content

Commit d17bfba

Browse files
committed
lint fix
1 parent 6b4b9b2 commit d17bfba

File tree

13 files changed

+106
-105
lines changed

13 files changed

+106
-105
lines changed

lib/helper/JSONResponse.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ class JSONResponse extends Helper {
7272
if (!this.helpers[this.options.requestHelper]) {
7373
throw new Error(`Error setting JSONResponse, helper ${this.options.requestHelper} is not enabled in config, helpers: ${Object.keys(this.helpers)}`)
7474
}
75-
const origOnResponse = this.helpers[this.options.requestHelper].config.onResponse;
75+
const origOnResponse = this.helpers[this.options.requestHelper].config.onResponse
7676
this.helpers[this.options.requestHelper].config.onResponse = response => {
77-
this.response = response;
78-
if (typeof origOnResponse === 'function') origOnResponse(response);
79-
};
77+
this.response = response
78+
if (typeof origOnResponse === 'function') origOnResponse(response)
79+
}
8080
}
8181

8282
_before() {

lib/helper/WebDriver.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ class WebDriver extends Helper {
998998
* {{ react }}
999999
*/
10001000
async click(locator, context = null) {
1001-
const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick'
1001+
const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick'
10021002
const locateFn = prepareLocateFn.call(this, context)
10031003

10041004
const res = await findClickable.call(this, locator, locateFn)
@@ -1217,7 +1217,7 @@ class WebDriver extends Helper {
12171217
* {{> checkOption }}
12181218
*/
12191219
async checkOption(field, context = null) {
1220-
const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick'
1220+
const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick'
12211221
const locateFn = prepareLocateFn.call(this, context)
12221222

12231223
const res = await findCheckable.call(this, field, locateFn)
@@ -1237,7 +1237,7 @@ class WebDriver extends Helper {
12371237
* {{> uncheckOption }}
12381238
*/
12391239
async uncheckOption(field, context = null) {
1240-
const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick'
1240+
const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick'
12411241
const locateFn = prepareLocateFn.call(this, context)
12421242

12431243
const res = await findCheckable.call(this, field, locateFn)

lib/listener/steps.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ module.exports = function () {
7979
return currentHook.steps.push(step)
8080
}
8181
if (!currentTest || !currentTest.steps) return
82-
82+
8383
// Check if we're in a session that should be excluded from main test steps
8484
const currentSessionId = recorder.getCurrentSessionId()
8585
if (currentSessionId && EXCLUDED_SESSIONS.includes(currentSessionId)) {
8686
// Skip adding this step to the main test steps
8787
return
8888
}
89-
89+
9090
currentTest.steps.push(step)
9191
})
9292

lib/plugin/htmlReporter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ module.exports = function (config) {
288288
finalState: test.state,
289289
duration: test.duration || 0,
290290
})
291-
output.debug(`HTML Reporter: Fallback retry detection for failed test ${test.title}, attempts: ${fallbackAttempts}`)
291+
output.debug(`HTML Reporter: Fallback retry detection for failed test ${test.title}, attempts: ${fallbackAttempts}`)
292292
}
293293
})
294294

test/acceptance/config_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Scenario('change config 5 @WebDriverIO @Puppeteer @Playwright', ({ I }) => {
3232

3333
Scenario('make API call and check response @Playwright', ({ I }) => {
3434
I.amOnPage('/')
35-
I.makeApiRequest('get', 'http://localhost:3001/api/users?page=2', { headers: {'x-api-key': 'reqres-free-v1'}})
35+
I.makeApiRequest('get', 'http://localhost:3001/api/users?page=2', { headers: { 'x-api-key': 'reqres-free-v1' } })
3636
I.seeResponseCodeIsSuccessful()
3737
})
3838

test/helper/Playwright_test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,9 +1041,9 @@ describe('Playwright', function () {
10411041

10421042
describe('#makeApiRequest', () => {
10431043
it('should make 3rd party API request', async () => {
1044-
const response = await I.makeApiRequest('get', 'http://localhost:3001/api/users?page=2')
1045-
expect(response.status()).to.equal(200)
1046-
expect(await response.json()).to.include.keys(['data'])
1044+
const response = await I.makeApiRequest('get', 'http://localhost:3001/api/users?page=2')
1045+
expect(response.status()).to.equal(200)
1046+
expect(await response.json()).to.include.keys(['data'])
10471047
})
10481048

10491049
it('should make local API request', async () => {
@@ -1054,10 +1054,10 @@ describe('Playwright', function () {
10541054
it('should convert to axios response with onResponse hook', async () => {
10551055
let response
10561056
I.config.onResponse = resp => (response = resp)
1057-
await I.makeApiRequest('get', 'http://localhost:3001/api/users?page=2')
1058-
expect(response).to.be.ok
1059-
expect(response.status).to.equal(200)
1060-
expect(response.data).to.include.keys(['data'])
1057+
await I.makeApiRequest('get', 'http://localhost:3001/api/users?page=2')
1058+
expect(response).to.be.ok
1059+
expect(response.status).to.equal(200)
1060+
expect(response.data).to.include.keys(['data'])
10611061
})
10621062
})
10631063

test/helper/WebDriver.noSeleniumServer_test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,6 @@ describe('WebDriver - No Selenium server started', function () {
382382
})
383383
})
384384

385-
386385
describe('#seeTitleEquals', () => {
387386
it('should check that title is equal to provided one', async () => {
388387
await wd.amOnPage('/')

test/mock-server/server.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
1-
const express = require('express');
2-
const app = express();
3-
app.use(express.json());
1+
const express = require('express')
2+
const app = express()
3+
app.use(express.json())
44

55
// Example users data
66
let users = [
77
{ id: 1, name: 'John Doe', email: 'john@example.com' },
8-
{ id: 2, name: 'Jane Smith', email: 'jane@example.com' }
9-
];
8+
{ id: 2, name: 'Jane Smith', email: 'jane@example.com' },
9+
]
1010

1111
// GET /api/users
1212
app.get('/api/users', (req, res) => {
13-
res.json({ data: users });
14-
});
13+
res.json({ data: users })
14+
})
1515

1616
// GET /api/users/:id
1717
app.get('/api/users/:id', (req, res) => {
18-
const user = users.find(u => u.id === parseInt(req.params.id));
19-
if (user) return res.json(user);
20-
res.status(404).json({ error: 'User not found' });
21-
});
18+
const user = users.find(u => u.id === parseInt(req.params.id))
19+
if (user) return res.json(user)
20+
res.status(404).json({ error: 'User not found' })
21+
})
2222

2323
// POST /api/users
2424
app.post('/api/users', (req, res) => {
25-
const { name, email } = req.body;
26-
const newUser = { id: users.length + 1, name, email };
27-
users.push(newUser);
28-
res.status(201).json(newUser);
29-
});
25+
const { name, email } = req.body
26+
const newUser = { id: users.length + 1, name, email }
27+
users.push(newUser)
28+
res.status(201).json(newUser)
29+
})
3030

3131
// PUT /api/users/:id
3232
app.put('/api/users/:id', (req, res) => {
33-
const user = users.find(u => u.id === parseInt(req.params.id));
34-
if (!user) return res.status(404).json({ error: 'User not found' });
35-
user.name = req.body.name || user.name;
36-
user.email = req.body.email || user.email;
37-
res.json(user);
38-
});
33+
const user = users.find(u => u.id === parseInt(req.params.id))
34+
if (!user) return res.status(404).json({ error: 'User not found' })
35+
user.name = req.body.name || user.name
36+
user.email = req.body.email || user.email
37+
res.json(user)
38+
})
3939

4040
// DELETE /api/users/:id
4141
app.delete('/api/users/:id', (req, res) => {
42-
users = users.filter(u => u.id !== parseInt(req.params.id));
43-
res.status(204).send();
44-
});
42+
users = users.filter(u => u.id !== parseInt(req.params.id))
43+
res.status(204).send()
44+
})
4545

4646
// Start server
47-
const PORT = process.env.PORT || 3001;
47+
const PORT = process.env.PORT || 3001
4848
app.listen(PORT, () => {
49-
console.log(`Mock REST server running on port ${PORT}`);
50-
});
49+
console.log(`Mock REST server running on port ${PORT}`)
50+
})
Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,43 @@
1-
const { spawn } = require('child_process');
2-
const http = require('http');
1+
const { spawn } = require('child_process')
2+
const http = require('http')
33

4-
const PORT = process.env.PORT || 3001;
5-
const MAX_RETRIES = 20;
6-
const RETRY_DELAY = 500;
4+
const PORT = process.env.PORT || 3001
5+
const MAX_RETRIES = 20
6+
const RETRY_DELAY = 500
77

88
function waitForServer(retries = 0) {
99
return new Promise((resolve, reject) => {
10-
http.get(`http://localhost:${PORT}/api/users`, res => {
11-
if (res.statusCode === 200) return resolve(true);
12-
res.resume();
13-
reject();
14-
}).on('error', () => {
15-
if (retries < MAX_RETRIES) {
16-
setTimeout(() => {
17-
resolve(waitForServer(retries + 1));
18-
}, RETRY_DELAY);
19-
} else {
20-
reject(new Error('Mock server did not start in time'));
21-
}
22-
});
23-
});
10+
http
11+
.get(`http://localhost:${PORT}/api/users`, res => {
12+
if (res.statusCode === 200) return resolve(true)
13+
res.resume()
14+
reject()
15+
})
16+
.on('error', () => {
17+
if (retries < MAX_RETRIES) {
18+
setTimeout(() => {
19+
resolve(waitForServer(retries + 1))
20+
}, RETRY_DELAY)
21+
} else {
22+
reject(new Error('Mock server did not start in time'))
23+
}
24+
})
25+
})
2426
}
2527

2628
const serverProcess = spawn('node', ['server.js'], {
2729
cwd: __dirname,
2830
stdio: 'inherit',
2931
env: process.env,
30-
});
32+
})
3133

32-
console.log('Starting mock server...');
34+
console.log('Starting mock server...')
3335
waitForServer()
3436
.then(() => {
35-
console.log('Mock server is up and running!');
37+
console.log('Mock server is up and running!')
3638
})
3739
.catch(err => {
38-
console.error(err.message);
39-
serverProcess.kill();
40-
process.exit(1);
41-
});
40+
console.error(err.message)
41+
serverProcess.kill()
42+
process.exit(1)
43+
})

test/rest/REST_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ describe('REST', () => {
150150
})
151151

152152
it('should be able to parse JSON responses', async () => {
153-
await I.sendGetRequest('http://localhost:3001/api/comments/1', { 'x-api-key': 'reqres-free-v1'})
153+
await I.sendGetRequest('http://localhost:3001/api/comments/1', { 'x-api-key': 'reqres-free-v1' })
154154
await jsonResponse.seeResponseCodeIsSuccessful()
155155
await jsonResponse.seeResponseContainsKeys(['data', 'support'])
156156
})

0 commit comments

Comments
 (0)