Skip to content

Commit

Permalink
Merge pull request #1277 from KhalisFoundation/dev
Browse files Browse the repository at this point in the history
Release v1.11.0
  • Loading branch information
saintsoldierx authored Oct 15, 2020
2 parents 66e795c + 1364dc2 commit b1621a7
Show file tree
Hide file tree
Showing 89 changed files with 1,616 additions and 878 deletions.
1 change: 1 addition & 0 deletions client_id
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
145754ce-3fc3-45c4-95fd-c7d59099cba4
7 changes: 6 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
"baseUrl": "http://localhost:8080",
"_baseUrl": "https://stg.sikhitothemax.org",
"__baseUrl": "https://sikhitothemax.org",
"experimentalFetchPolyfill": true
"experimentalFetchPolyfill": true,
"env": {
"colors": {
"sttmBlue": "rgb(1, 102, 155)"
}
}
}
3 changes: 1 addition & 2 deletions cypress/integration/navigation/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { raagIndices } from '../../../src/js/pages/GranthIndex/constants/raag-indices';

describe('Navigation', () => {
context('Index page', () => {
describe('Index page', () => {

const { SGGS, DG } = raagIndices;
const totalSggsRows = SGGS.indices.length;
Expand All @@ -21,7 +21,6 @@ describe('Navigation', () => {

cy.get('li[data-cy=index] a')
.click();

})

it('should open with indexes of SGGS, SDGS, Amrit Keertan', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/navigation/random-shabads.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable cypress/no-unnecessary-waiting */

describe('Navigation', () => {
context('Random Shabad page', () => {
describe('Random Shabad page', () => {

beforeEach(() => {
cy.visit('/');
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/navigation/sundar-gutka.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('Navigation', () => {
const sundarGutkaBaanis = 104;
const searchString = 'jaa';

context('Sundar-Gutka page', () => {
describe('Sundar-Gutka page', () => {
beforeEach(() => {
cy.visit('/');

Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/navigation/sync.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe('Navigation', () => {
context('Sync', () => {
describe('Sync', () => {
beforeEach(() => {
cy.visit('/');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

describe('Home page Search tests', () => {
describe('Search', () => {
describe('First Letter Search from anywhere(G)', () => {
it('should return search results for "ApAb" in drop-down', () => {
cy.visit('/');
Expand Down Expand Up @@ -45,7 +45,7 @@ describe('Home page Search tests', () => {
.should('have.text', 'Show full results')
.click({ force: true });

cy.url().should('include', '/search?q=ApAb&type=1&source=G');
cy.url().should('include', '/search?q=ApAb&type=1&source=all');
});

it('should open all search results page on typing "ApAb" in search field and pressing enter', () => {
Expand All @@ -62,7 +62,7 @@ describe('Home page Search tests', () => {

cy.get('.search-form').submit();

cy.url().should('include', '/search?q=ApAb&type=1&source=G');
cy.url().should('include', '/search?q=ApAb&type=1&source=all');
});

it('should open Shabad page on typing "ApAb" in search field, highlight search result and pressing enter', () => {
Expand All @@ -84,7 +84,7 @@ describe('Home page Search tests', () => {
.type('{downarrow}')
.type('{enter}');

cy.url().should('include', '&q=ApAb&type=1&source=G&highlight=');
cy.url().should('include', '&q=ApAb&type=1&source=all&highlight=');
});

it('should open Shabad page on typing "ApAb" in search field and clicking a search result', () => {
Expand All @@ -103,7 +103,7 @@ describe('Home page Search tests', () => {
.first()
.click();

cy.url().should('include', "&q=ApAb&type=1&source=G&highlight=");
cy.url().should('include', "&q=ApAb&type=1&source=all&highlight=");
});
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('Home page Search tests', () => {
describe('Search', () => {
describe('First Letter Search from Start(G)', () => {
it('should return search results for "bhb" in drop-down', () => {
cy.visit('/');
Expand Down
99 changes: 99 additions & 0 deletions cypress/integration/search/full-word-gurmukhi.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import { buildApiUrl } from '@sttm/banidb';
import { API_URL } from '../../../common/constants';

import { SEARCH_TYPES } from '../../../src/js/constants';
const searchType = SEARCH_TYPES.GURMUKHI_WORD.toString();

describe('Search', () => {
const searchString = 'sMqoK';
const searchString2 = 'bhb';
const searchString3 = 'Apwr';
const showFullResults = 'Show full results';
const { sttmBlue } = Cypress.env().colors;

describe('Full Word(G)', () => {
beforeEach(() => {
cy.visit('/');

cy.get('.toast-notification-close-button')
.click();

cy.get('#search-type')
.select(searchType);
});

it(`should return search results for string: ${searchString} in drop-down`, () => {
cy.get('#search')
.type(searchString);

cy.get('.search-result span')
.should('contain', ' sMqoKI') //Santokhi
.should('contain', ' sMqoKu') //Santokhu
.should('contain', 'sMqoK') //Santokh
});

it(`should return highlight search result words for string: ${searchString} in drop-down`, () => {
cy.get('#search')
.type(searchString);

cy.get('.search-highlight-word')
.should('contain', ' sMqoKI') //Santokhi
.should('contain', ' sMqoKu') //Santokhu
.should('contain', 'sMqoK') //Santokh
.should('have.css', 'color', sttmBlue)
})

it(`should open correct shabad page on clicking link in dropdown on search results of string: ${searchString}`, () => {
cy.get('#search')
.type(searchString);

cy.get('.search-result li:first-child a')
.click();

cy.url().should('contain', `shabad?id=10&q=${searchString}&type=${searchType}&source=all&highlight=73`)
})

it(`should open "all search results page" on pressing enter after searching for string: ${searchString2}`, () => {
cy.get('#search')
.type(searchString2);

cy.get('.search-form').submit();

cy.url().should('include', `/search?q=${searchString2}&type=${searchType}&source=all`);
});

it(`should open highlighted shabad on clicking or pressing enter for string: ${searchString3}`, () => {
cy.server();

cy.get('#search')
.type(searchString3);

const url = 'http:' + buildApiUrl({ offset: 1, source: 'all', q: searchString3, type: searchType, API_URL, livesearch: true });
cy.route({ url }).as('result')

cy.wait('@result')

cy.get('#search')
.click()
.trigger('keydown', { keyCode: 40 }) //DownArrow
.trigger('keydown', { keyCode: 13 }) //Enter

cy.url().should('contain', `shabad?id=4&q=${searchString3}&type=${searchType}&source=all&highlight=31`)
})

it(`should open "all search results page" on clicking the ${showFullResults} link`, () => {

cy.get('#search')
.type(searchString2)

cy.get('#suggestions')
.scrollTo('bottom')
.find('.show-all-results a')
.should('exist')
.scrollIntoView()
.click({ force: true })

cy.url().should('include', `/search?q=${searchString2}&type=${searchType}&source=all`);
})
})
})
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { SEARCH_TYPES } from '../../../src/js/constants';
const searchType = SEARCH_TYPES.ROMANIZED_FIRST_LETTERS_ANYWHERE.toString();

describe('Home page Search tests', () => {
describe('Search', () => {
const searchString = 'jmtatssd';
const searchString2 = 'jmta';
const showAllResultsBtn = 'Show full results';
const showFullResults = 'Show full results';

describe('Romanized First Letter Search anywhere(E)', () => {
beforeEach(() => {
Expand Down Expand Up @@ -53,22 +53,19 @@ describe('Home page Search tests', () => {
});
})

it(`should open all search results page on clicking the ${showAllResultsBtn} button`, () => {
it(`should open all search results page on clicking the ${showFullResults} link`, () => {

cy.get('#search')
.type(searchString2)

cy.get('#suggestions')
.as('suggestions')

cy.get('@suggestions')
.scrollTo('bottom')
.find('.show-all-results a')
.should('exist')
.scrollIntoView()
.click({ force: true })

cy.url().should('include', `/search?q=${searchString2}&type=${searchType}&source=G`);
cy.url().should('include', `/search?q=${searchString2}&type=${searchType}&source=all`);
})
})
})
4 changes: 2 additions & 2 deletions cypress/integration/settings/sources.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('Settings', () => {
cy.get('[data-cy=Display]')
.click()
.find('ul')
.last()
.eq(1)
.as('translations');
})

Expand All @@ -89,7 +89,7 @@ describe('Settings', () => {
.find(`${controlPrefix}-punjabi`)
.click({ force: true })

cy.get(`${shabadClassNamePrefix}-punjabi`).should('be.visible');
cy.get('.mixed-view-baani-steek-bani db').should('be.visible');
})

it('should show spanish translations, on selecting spanish translation option', () => {
Expand Down
4 changes: 2 additions & 2 deletions cypress/support/sundar-gutka.commands.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Cypress.Commands.add('checkSgCard', ({ childNo, english, gurmukhi }) => {
const sttmBlue = 'rgb(1, 102, 155)';
Cypress.Commands.add('checkSgCard', function checkGranthIndices({ childNo, english, gurmukhi }) {
const { sttmBlue } = Cypress.env().colors;
const em = 18; //no of pixel

// sundar gutka card
Expand Down
Loading

0 comments on commit b1621a7

Please sign in to comment.