-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
126 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* eslint-disable cypress/no-unnecessary-waiting */ | ||
const API_KEY = Cypress.env('apiKey') | ||
const WRONG_APIKEY = Cypress.env('wrongApiKey') | ||
const WAITING_TIME = Cypress.env('waitingTime') | ||
|
||
describe(`Test API key required with query params`, () => { | ||
before(() => { | ||
cy.deleteAllIndexes() | ||
|
||
cy.wait(WAITING_TIME) | ||
cy.createIndex('movies') | ||
cy.wait(WAITING_TIME) | ||
cy.fixture('movies.json').then((movies) => { | ||
cy.addDocuments('movies', movies) | ||
cy.wait(WAITING_TIME) | ||
}) | ||
}) | ||
|
||
beforeEach(() => { | ||
cy.visit(`/?api_key=${API_KEY}`) | ||
}) | ||
|
||
it('Should display the movies', () => { | ||
cy.get('ul') | ||
.children() | ||
.should(($p) => { | ||
expect($p).to.have.length(20) | ||
}) | ||
}) | ||
|
||
it('Should have the api key written in the modal', () => { | ||
// Test if the query parameter is written in the modal | ||
// meaning it is added in the local storage | ||
cy.get('span').contains('Api Key').parent().click() | ||
cy.get('div[aria-label=settings-api-key]').within(() => { | ||
cy.get('input[name="apiKey"]').should('have.value', API_KEY) | ||
cy.get('button').contains('Go').click() | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.