Skip to content

Commit 6028f2b

Browse files
committed
eslint fixes
1 parent 10e8c3d commit 6028f2b

File tree

13 files changed

+261
-237
lines changed

13 files changed

+261
-237
lines changed

.eslintrc.json

+25-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,31 @@
307307
"mocha": true
308308
},
309309
"parserOptions": {
310-
"ecmaVersion": 2020
310+
"ecmaVersion": 2020,
311+
"sourceType": "module"
312+
},
313+
"rules": {
314+
"no-console": "off",
315+
"no-unused-vars": "off",
316+
"no-redeclare": "off"
317+
}
318+
},
319+
{
320+
"files": [
321+
"ui-tests/**/*.js"
322+
],
323+
"env": {
324+
"es6": true,
325+
"node": true,
326+
"mocha": true
327+
},
328+
"globals": {
329+
"Cypress": "readonly",
330+
"cy": "readonly"
331+
},
332+
"parserOptions": {
333+
"ecmaVersion": 2020,
334+
"sourceType": "module"
311335
},
312336
"rules": {
313337
"no-console": "off",

ui-tests/cypress.config.sample.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
const { defineConfig } = require("cypress");
22

33
module.exports = defineConfig({
4-
e2e: {
5-
baseUrl: "http://localhost",
6-
defaultCommandTimeout: 30000,
7-
viewportWidth: 2000,
8-
viewportHeight: 1100,
9-
numTestsKeptInMemory: 0,
10-
projectId: "000000",
11-
chromeWebSecurity: false,
12-
watchForFileChanges: true,
13-
retries: {
14-
runMode: 0,
15-
openMode: 0,
4+
e2e: {
5+
baseUrl: "http://localhost",
6+
defaultCommandTimeout: 30000,
7+
viewportWidth: 2000,
8+
viewportHeight: 1100,
9+
numTestsKeptInMemory: 0,
10+
projectId: "000000",
11+
chromeWebSecurity: false,
12+
watchForFileChanges: true,
13+
retries: {
14+
runMode: 0,
15+
openMode: 0,
16+
},
1617
},
17-
},
1818
});
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import user from '../../../fixtures/user.json'
2-
const loginHelpers = require('../../../lib/login')
3-
const navigationHelpers = require('../../../support/navigations')
4-
const analyticsLoyaltyUserActivityHelpers = require('../../../lib/analytics/loyalty/userActivity')
1+
import user from '../../../fixtures/user.json';
2+
const loginHelpers = require('../../../lib/login');
3+
const navigationHelpers = require('../../../support/navigations');
4+
const analyticsLoyaltyUserActivityHelpers = require('../../../lib/analytics/loyalty/userActivity');
55

66
describe('Visitor Activity', () => {
7-
beforeEach(function () {
8-
navigationHelpers.goToLoginPage()
9-
})
7+
beforeEach(function() {
8+
navigationHelpers.goToLoginPage();
9+
});
1010

11-
it('should be visible all elements on empty state', function () {
12-
loginHelpers.login(user.username, user.password)
13-
navigationHelpers.goToVisitorLoyalty()
14-
analyticsLoyaltyUserActivityHelpers.verifyEmptyPageElements()
15-
})
16-
})
11+
it('should be visible all elements on empty state', function() {
12+
loginHelpers.login(user.username, user.password);
13+
navigationHelpers.goToVisitorLoyalty();
14+
analyticsLoyaltyUserActivityHelpers.verifyEmptyPageElements();
15+
});
16+
});

ui-tests/cypress/e2e/login.cy.js

+28-28
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
import user from '../fixtures/user.json'
2-
const loginHelpers = require('../lib/login')
3-
const navigationHelpers = require('../support/navigations')
1+
import user from '../fixtures/user.json';
2+
const loginHelpers = require('../lib/login');
3+
const navigationHelpers = require('../support/navigations');
44

55
describe('Login', () => {
6-
beforeEach(function () {
7-
navigationHelpers.goToLoginPage()
8-
})
6+
beforeEach(function() {
7+
navigationHelpers.goToLoginPage();
8+
});
99

10-
it('should be visible all elements on empty state', function () {
11-
loginHelpers.verifyEmptyPageElements()
12-
})
10+
it('should be visible all elements on empty state', function() {
11+
loginHelpers.verifyEmptyPageElements();
12+
});
1313

14-
it('should successfully log in to with valid username and password', function () {
15-
loginHelpers.typeUsername(user.username)
16-
loginHelpers.typePassword(user.password)
17-
loginHelpers.clickLoginButton()
18-
navigationHelpers.isNavigatedToDashboard()
19-
})
14+
it('should successfully log in to with valid username and password', function() {
15+
loginHelpers.typeUsername(user.username);
16+
loginHelpers.typePassword(user.password);
17+
loginHelpers.clickLoginButton();
18+
navigationHelpers.isNavigatedToDashboard();
19+
});
2020

21-
it('should successfully log in to with valid e-mail and password', function () {
22-
loginHelpers.typeUsername(user.email)
23-
loginHelpers.typePassword(user.password)
24-
loginHelpers.clickLoginButton()
25-
navigationHelpers.isNavigatedToDashboard()
26-
})
21+
it('should successfully log in to with valid e-mail and password', function() {
22+
loginHelpers.typeUsername(user.email);
23+
loginHelpers.typePassword(user.password);
24+
loginHelpers.clickLoginButton();
25+
navigationHelpers.isNavigatedToDashboard();
26+
});
2727

28-
it('should display an error message with invalid password', function () {
29-
loginHelpers.typeUsername(user.email)
30-
loginHelpers.typePassword('invalidpassword')
31-
loginHelpers.clickLoginButton()
32-
loginHelpers.verifyLoginFailedMessage()
33-
})
34-
})
28+
it('should display an error message with invalid password', function() {
29+
loginHelpers.typeUsername(user.email);
30+
loginHelpers.typePassword('invalidpassword');
31+
loginHelpers.clickLoginButton();
32+
loginHelpers.verifyLoginFailedMessage();
33+
});
34+
});
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import analyticsLoyaltyUserActivityPageElements from "../../../support/elements/analytics/loyalty/userActivity";
22

33
const verifyEmptyPageElements = () => {
4-
cy.shouldBeVisible(analyticsLoyaltyUserActivityPageElements.VISITOR_ACTIVITY_LABEL)
5-
cy.shouldContainText(analyticsLoyaltyUserActivityPageElements.VISITOR_ACTIVITY_LABEL, "User Activity")
4+
cy.shouldBeVisible(analyticsLoyaltyUserActivityPageElements.VISITOR_ACTIVITY_LABEL);
5+
cy.shouldContainText(analyticsLoyaltyUserActivityPageElements.VISITOR_ACTIVITY_LABEL, "User Activity");
66
};
77

88
module.exports = {
9-
verifyEmptyPageElements,
9+
verifyEmptyPageElements,
1010
};

ui-tests/cypress/lib/login.js

+43-43
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
1-
import loginPageElements from '../support/elements/login'
1+
import loginPageElements from '../support/elements/login';
22

33
const typeUsername = username => {
4-
cy.typeInput(loginPageElements.USERNAME, username)
5-
}
4+
cy.typeInput(loginPageElements.USERNAME, username);
5+
};
66

77
const typePassword = password => {
8-
cy.typeInput(loginPageElements.PASSWORD, password)
9-
}
8+
cy.typeInput(loginPageElements.PASSWORD, password);
9+
};
1010

1111
const clickLoginButton = () => {
12-
cy.clickElement(loginPageElements.LOGIN_BUTTON)
13-
}
12+
cy.clickElement(loginPageElements.LOGIN_BUTTON);
13+
};
1414

1515
const verifyLoginFailedMessage = () => {
16-
cy.shouldBeVisible(loginPageElements.NOTIFICATION_IMAGE)
17-
cy.shouldContainText(loginPageElements.FAILED_MESSAGE, 'Login Failed')
18-
}
16+
cy.shouldBeVisible(loginPageElements.NOTIFICATION_IMAGE);
17+
cy.shouldContainText(loginPageElements.FAILED_MESSAGE, 'Login Failed');
18+
};
1919

2020
const verifyUnvalidUsernameOrEmailMessage = () => {
21-
cy.shouldBeVisible(loginPageElements.USERNAME_ERROR_MESSAGE)
22-
cy.shouldContainText(loginPageElements.USERNAME_ERROR_MESSAGE,'Please enter a valid username or email.')
23-
}
21+
cy.shouldBeVisible(loginPageElements.USERNAME_ERROR_MESSAGE);
22+
cy.shouldContainText(loginPageElements.USERNAME_ERROR_MESSAGE, 'Please enter a valid username or email.');
23+
};
2424

2525
const verifyEmptyPageElements = () => {
26-
cy.shouldBeVisible(loginPageElements.LOGO)
27-
cy.shouldBeVisible(loginPageElements.LANGUAGE)
28-
cy.shouldBeVisible(loginPageElements.SIGN_IN_LABEL)
29-
cy.shouldContainText(loginPageElements.SIGN_IN_LABEL, "Sign In")
30-
cy.shouldBeVisible(loginPageElements.USERNAME)
31-
cy.shouldPlaceholderContainText(loginPageElements.USERNAME, "Username or Email")
32-
cy.shouldBeVisible(loginPageElements.PASSWORD)
33-
cy.shouldPlaceholderContainText(loginPageElements.PASSWORD, "Enter your password")
34-
cy.shouldBeVisible(loginPageElements.FORGOT_PASSWORD_LINK);
35-
cy.shouldContainText(loginPageElements.FORGOT_PASSWORD_LINK, "Forgot password?")
36-
cy.shouldHrefContainUrl(loginPageElements.FORGOT_PASSWORD_LINK, "./forgot")
37-
cy.shouldBeVisible(loginPageElements.LOGIN_BUTTON);
38-
cy.shouldHaveValue(loginPageElements.LOGIN_BUTTON, "Sign In")
39-
cy.shouldBeVisible(loginPageElements.FOOTER)
40-
41-
cy.clickElement(loginPageElements.LOGIN_BUTTON)
42-
verifyUnvalidUsernameOrEmailMessage()
43-
}
26+
cy.shouldBeVisible(loginPageElements.LOGO);
27+
cy.shouldBeVisible(loginPageElements.LANGUAGE);
28+
cy.shouldBeVisible(loginPageElements.SIGN_IN_LABEL);
29+
cy.shouldContainText(loginPageElements.SIGN_IN_LABEL, "Sign In");
30+
cy.shouldBeVisible(loginPageElements.USERNAME);
31+
cy.shouldPlaceholderContainText(loginPageElements.USERNAME, "Username or Email");
32+
cy.shouldBeVisible(loginPageElements.PASSWORD);
33+
cy.shouldPlaceholderContainText(loginPageElements.PASSWORD, "Enter your password");
34+
cy.shouldBeVisible(loginPageElements.FORGOT_PASSWORD_LINK);
35+
cy.shouldContainText(loginPageElements.FORGOT_PASSWORD_LINK, "Forgot password?");
36+
cy.shouldHrefContainUrl(loginPageElements.FORGOT_PASSWORD_LINK, "./forgot");
37+
cy.shouldBeVisible(loginPageElements.LOGIN_BUTTON);
38+
cy.shouldHaveValue(loginPageElements.LOGIN_BUTTON, "Sign In");
39+
cy.shouldBeVisible(loginPageElements.FOOTER);
40+
41+
cy.clickElement(loginPageElements.LOGIN_BUTTON);
42+
verifyUnvalidUsernameOrEmailMessage();
43+
};
4444

4545
const login = (username, password) => {
46-
typeUsername(username)
47-
typePassword(password)
48-
clickLoginButton()
49-
}
46+
typeUsername(username);
47+
typePassword(password);
48+
clickLoginButton();
49+
};
5050

5151
module.exports = {
52-
typeUsername,
53-
typePassword,
54-
clickLoginButton,
55-
verifyLoginFailedMessage,
56-
verifyUnvalidUsernameOrEmailMessage,
57-
verifyEmptyPageElements,
58-
login,
59-
}
52+
typeUsername,
53+
typePassword,
54+
clickLoginButton,
55+
verifyLoginFailedMessage,
56+
verifyUnvalidUsernameOrEmailMessage,
57+
verifyEmptyPageElements,
58+
login,
59+
};

ui-tests/cypress/plugins/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
* @type {Cypress.PluginConfig}
1717
*/
1818
module.exports = (on, config) => {
19-
// `on` is used to hook into various events Cypress emits
20-
// `config` is the resolved Cypress config
21-
}
19+
// `on` is used to hook into various events Cypress emits
20+
// `config` is the resolved Cypress config
21+
};

ui-tests/cypress/support/commands.js

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,54 @@
11
Cypress.Commands.add("typeInput", (element, tag) => {
2-
cy.get(element).type(tag);
2+
cy.get(element).type(tag);
33
});
44

55
Cypress.Commands.add("clickElement", (element, index = 0) => {
6-
cy.get(element).eq(index).click({force: true});
7-
cy.checkPaceRunning();
6+
cy.get(element).eq(index).click({force: true});
7+
cy.checkPaceRunning();
88
});
99

1010
Cypress.Commands.add("shouldBeVisible", (element) => {
11-
cy.get(element).should("be.visible");
11+
cy.get(element).should("be.visible");
1212
});
1313

1414
Cypress.Commands.add("shouldContainText", (element, text) => {
15-
cy.get(element).should("contain", text);
15+
cy.get(element).should("contain", text);
1616
});
1717

1818
Cypress.Commands.add("shouldPlaceholderContainText", (element, text) => {
19-
cy.get(element).invoke("attr", "placeholder").should("contain", text);
19+
cy.get(element).invoke("attr", "placeholder").should("contain", text);
2020
});
2121

2222
Cypress.Commands.add("shouldHrefContainUrl", (element, url) => {
23-
cy.get(element).invoke("attr", "href").should("contain", url);
23+
cy.get(element).invoke("attr", "href").should("contain", url);
2424
});
2525

2626
Cypress.Commands.add("shouldHaveValue", (element, value) => {
27-
cy.get(element).should("have.value", value);
27+
cy.get(element).should("have.value", value);
2828
});
2929

3030
Cypress.Commands.add("shouldUrlInclude", (url) => {
31-
cy.url().should('include', url)
31+
cy.url().should('include', url);
3232
});
3333

3434
Cypress.Commands.add('elementExists', (selector) => {
35-
cy
36-
.get('body')
37-
.then(($body) => {
38-
return $body.find(selector).length > 0;
39-
});
35+
cy
36+
.get('body')
37+
.then(($body) => {
38+
return $body.find(selector).length > 0;
39+
});
4040
});
4141

4242
Cypress.Commands.add('shouldNotExist', (element) => {
43-
cy.get(element).should('not.exist');
43+
cy.get(element).should('not.exist');
4444
});
4545

4646
Cypress.Commands.add('checkPaceRunning', () => {
47-
cy
48-
.elementExists('.pace-running')
49-
.then((isExists) => {
50-
if (isExists) {
51-
cy.shouldNotExist('.pace-running');
52-
}
53-
});
47+
cy
48+
.elementExists('.pace-running')
49+
.then((isExists) => {
50+
if (isExists) {
51+
cy.shouldNotExist('.pace-running');
52+
}
53+
});
5454
});

ui-tests/cypress/support/e2e.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
// ***********************************************************
1515

1616
// Import commands.js using ES2015 syntax:
17-
import './commands'
18-
17+
import './commands';
18+
1919
//When Cypress detects uncaught errors originating from application it will automatically fail the current test.
2020
//This behavior is configurable, and you can choose to turn this off by listening to the uncaught:exception event.
2121
//Open the below code block after the "Cannot read properties of undefined..." errors occurred.
2222
//But firstly open an issue about the error.
2323
Cypress.on('uncaught:exception', (err, runnable) => {
2424
// returning false here prevents Cypress from failing the test
25-
return false
26-
});
25+
return false;
26+
});
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export default {
2-
VISITOR_ACTIVITY_LABEL: '[data-test-id=header-title]',
3-
}
2+
VISITOR_ACTIVITY_LABEL: '[data-test-id=header-title]',
3+
};

0 commit comments

Comments
 (0)