Skip to content

Commit

Permalink
refactor(eslint): e2e test code changes from tslint to eslint
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Switch linting from `tslint` to `eslint`.
  • Loading branch information
SGrueber authored and MaxKless committed Jan 17, 2022
1 parent c98c4d1 commit eb211be
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion e2e/cypress/integration/framework/b2b-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function createB2BUserViaREST(user: Partial<Registration>) {

cy.request(
'POST',
Cypress.env('ICM_BASE_URL') + '/INTERSHOP/rest/WFS/inSPIRED-inTRONICS_Business-Site/-/customers',
`${Cypress.env('ICM_BASE_URL')}/INTERSHOP/rest/WFS/inSPIRED-inTRONICS_Business-Site/-/customers`,
customer
).then(response => {
expect(response.status).to.equal(201);
Expand Down
7 changes: 4 additions & 3 deletions e2e/cypress/integration/framework/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ export function performAddToCart(

button().click();

return cy
.wait('@basket')
.then(result => (result.response.statusCode >= 400 ? result : cy.wait('@basketCurrent').then(() => result))) as any;
return cy.wait('@basket').then(
result => (result.response.statusCode >= 400 ? result : cy.wait('@basketCurrent').then(() => result))
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) as any;
}
10 changes: 5 additions & 5 deletions e2e/cypress/integration/framework/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function createUserViaREST(user: Partial<Registration>) {

cy.request(
'POST',
Cypress.env('ICM_BASE_URL') + '/INTERSHOP/rest/WFS/inSPIRED-inTRONICS-Site/-/customers',
`${Cypress.env('ICM_BASE_URL')}/INTERSHOP/rest/WFS/inSPIRED-inTRONICS-Site/-/customers`,
customer
).then(response => {
expect(response.status).to.equal(201);
Expand All @@ -40,7 +40,7 @@ export function createUserViaREST(user: Partial<Registration>) {
export function createBasketViaREST(user: Partial<Registration>, lineItems: { [sku: string]: number }) {
cy.request({
method: 'POST',
url: Cypress.env('ICM_BASE_URL') + '/INTERSHOP/rest/WFS/inSPIRED-inTRONICS-Site/-/baskets',
url: `${Cypress.env('ICM_BASE_URL')}/INTERSHOP/rest/WFS/inSPIRED-inTRONICS-Site/-/baskets`,
body: {},
auth: {
user: user.login,
Expand All @@ -54,7 +54,7 @@ export function createBasketViaREST(user: Partial<Registration>, lineItems: { [s

const basketUrl = basketCreationResponse.body.links.self.replace(
/.*\/INTERSHOP/,
Cypress.env('ICM_BASE_URL') + '/INTERSHOP'
`${Cypress.env('ICM_BASE_URL')}/INTERSHOP`
);
expect(basketUrl).not.to.be.empty;
const authToken = basketCreationResponse.headers['authentication-token'];
Expand All @@ -64,7 +64,7 @@ export function createBasketViaREST(user: Partial<Registration>, lineItems: { [s

cy.request({
method: 'GET',
url: basketUrl + '/items',
url: `${basketUrl}/items`,
headers: {
'authentication-token': authToken,
Accept: 'application/vnd.intershop.basket.v1+json',
Expand All @@ -75,7 +75,7 @@ export function createBasketViaREST(user: Partial<Registration>, lineItems: { [s

cy.request({
method: 'POST',
url: basketUrl + '/items',
url: `${basketUrl}/items`,
body,
headers: {
'authentication-token': authToken,
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/integration/pages/account/login.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class LoginPage {

static navigateTo(returnUrl = '/account') {
cy.clearCookie('apiToken');
cy.visit('/login?returnUrl=' + returnUrl.replace(/\//g, '%2F'));
cy.visit(`/login?returnUrl=${returnUrl.replace(/\//g, '%2F')}`);
}

get content() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class SearchBoxModule {
private readonly selector = '[data-testing-id="search-box-desktop"]';

private inputField() {
return cy.get(this.selector + ' input.searchTerm');
return cy.get(`${this.selector} input.searchTerm`);
}

private suggestionsOverlay() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const _ = {

describe('Shopping User B2B', () => {
it('should proceed a checkout with cost center', () => {
LoginPage.navigateTo('/sku' + _.sku);
LoginPage.navigateTo(`/sku${_.sku}`);
at(LoginPage, page => {
page.fillForm(_.user.login, _.user.password);
page.submit().its('response.statusCode').should('equal', 200);
Expand Down
8 changes: 2 additions & 6 deletions e2e/cypress/integration/specs/cms/server-html.b2c.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ describe('Server Html', () => {

waitLoadingEnd();

cy.location()
.its('pathname')
.should('equal', '/page/' + _.pageId);
cy.location().its('pathname').should('equal', `/page/${_.pageId}`);
});
});

Expand All @@ -93,9 +91,7 @@ describe('Server Html', () => {

waitLoadingEnd();

cy.location()
.its('pathname')
.should('equal', '/' + _.route);
cy.location().its('pathname').should('equal', `/${_.route}`);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('Missing Data', () => {
at(HomePage, page => page.header.gotoCategoryPage(_.catalog));
at(CategoryPage, page => page.gotoSubCategory(_.categoryid));
at(NotFoundPage);
cy.url().should('contain', 'cat' + _.categoryid);
cy.url().should('contain', `cat${_.categoryid}`);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ describe('Returning User', () => {
it('should log out and loose the cookie', () => {
at(MyAccountPage, page => page.header.logout());
at(HomePage);
// eslint-disable-next-line unicorn/no-null
cy.getCookie('apiToken').should('equal', null);
});
});
Expand Down

0 comments on commit eb211be

Please sign in to comment.