forked from ustaxcourt/ef-cms
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactoring approach for login in cypress
- Loading branch information
1 parent
6ebadf2
commit 7666ef2
Showing
10 changed files
with
264 additions
and
236 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 |
---|---|---|
|
@@ -31,16 +31,16 @@ const DEFAULT_ACCOUNT_PASS = Cypress.env('DEFAULT_ACCOUNT_PASS'); | |
let token = null; | ||
let testData = { createdPaperDocketNumber: '' }; | ||
|
||
const { closeScannerSetupDialog, getUserToken, login } = | ||
getEnvironmentSpecificFunctions(); | ||
const { closeScannerSetupDialog, login } = getEnvironmentSpecificFunctions(); | ||
|
||
describe('Petitioner', () => { | ||
before(async () => { | ||
const results = await getUserToken( | ||
'[email protected]', | ||
DEFAULT_ACCOUNT_PASS, | ||
); | ||
token = results.AuthenticationResult.IdToken; | ||
before(() => { | ||
cy.task('getUserToken', { | ||
email: '[email protected]', | ||
password: DEFAULT_ACCOUNT_PASS, | ||
}).then(result => { | ||
token = result.AuthenticationResult.IdToken; | ||
}); | ||
}); | ||
|
||
it('should be able to login', () => { | ||
|
@@ -76,12 +76,13 @@ describe('Petitioner', () => { | |
}); | ||
|
||
describe('Private practitioner', () => { | ||
before(async () => { | ||
const results = await getUserToken( | ||
'[email protected]', | ||
DEFAULT_ACCOUNT_PASS, | ||
); | ||
token = results.AuthenticationResult.IdToken; | ||
before(() => { | ||
cy.task('getUserToken', { | ||
email: '[email protected]', | ||
password: DEFAULT_ACCOUNT_PASS, | ||
}).then(result => { | ||
token = result.AuthenticationResult.IdToken; | ||
}); | ||
}); | ||
|
||
it('should be able to login', () => { | ||
|
@@ -116,12 +117,13 @@ describe('Private practitioner', () => { | |
}); | ||
|
||
describe('Petitions clerk', () => { | ||
before(async () => { | ||
const results = await getUserToken( | ||
'[email protected]', | ||
DEFAULT_ACCOUNT_PASS, | ||
); | ||
token = results.AuthenticationResult.IdToken; | ||
before(() => { | ||
cy.task('getUserToken', { | ||
email: '[email protected]', | ||
password: DEFAULT_ACCOUNT_PASS, | ||
}).then(result => { | ||
token = result.AuthenticationResult.IdToken; | ||
}); | ||
}); | ||
|
||
it('should be able to login', () => { | ||
|
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 |
---|---|---|
|
@@ -7,19 +7,20 @@ import { | |
updateAddress1, | ||
} from '../support/pages/my-account'; | ||
|
||
const { getUserToken, login } = getEnvironmentSpecificFunctions(); | ||
const { login } = getEnvironmentSpecificFunctions(); | ||
|
||
const DEFAULT_ACCOUNT_PASS = Cypress.env('DEFAULT_ACCOUNT_PASS'); | ||
|
||
describe('Private practitioner', () => { | ||
let token = null; | ||
|
||
before(async () => { | ||
const results = await getUserToken( | ||
'[email protected]', | ||
DEFAULT_ACCOUNT_PASS, | ||
); | ||
token = results.AuthenticationResult.IdToken; | ||
before(() => { | ||
cy.task('getUserToken', { | ||
email: '[email protected]', | ||
password: DEFAULT_ACCOUNT_PASS, | ||
}).then(result => { | ||
token = result.AuthenticationResult.IdToken; | ||
}); | ||
}); | ||
|
||
it('logs in', () => { | ||
|
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 |
---|---|---|
|
@@ -44,16 +44,16 @@ const testData = {}; | |
|
||
const DEFAULT_ACCOUNT_PASS = Cypress.env('DEFAULT_ACCOUNT_PASS'); | ||
|
||
const { closeScannerSetupDialog, getUserToken, login } = | ||
getEnvironmentSpecificFunctions(); | ||
const { closeScannerSetupDialog, login } = getEnvironmentSpecificFunctions(); | ||
|
||
describe('Petitioner', () => { | ||
before(async () => { | ||
const results = await getUserToken( | ||
'[email protected]', | ||
DEFAULT_ACCOUNT_PASS, | ||
); | ||
token = results.AuthenticationResult.IdToken; | ||
before(() => { | ||
cy.task('getUserToken', { | ||
email: '[email protected]', | ||
password: DEFAULT_ACCOUNT_PASS, | ||
}).then(result => { | ||
token = result.AuthenticationResult.IdToken; | ||
}); | ||
}); | ||
|
||
it('should be able to login', () => { | ||
|
@@ -89,12 +89,13 @@ describe('Petitioner', () => { | |
}); | ||
|
||
describe('Petitions clerk', () => { | ||
before(async () => { | ||
const results = await getUserToken( | ||
'[email protected]', | ||
DEFAULT_ACCOUNT_PASS, | ||
); | ||
token = results.AuthenticationResult.IdToken; | ||
before(() => { | ||
cy.task('getUserToken', { | ||
email: '[email protected]', | ||
password: DEFAULT_ACCOUNT_PASS, | ||
}).then(result => { | ||
token = result.AuthenticationResult.IdToken; | ||
}); | ||
}); | ||
|
||
it('should be able to login', () => { | ||
|
@@ -117,12 +118,13 @@ describe('Petitions clerk', () => { | |
}); | ||
|
||
describe('Docket Clerk', () => { | ||
before(async () => { | ||
const results = await getUserToken( | ||
'[email protected]', | ||
DEFAULT_ACCOUNT_PASS, | ||
); | ||
token = results.AuthenticationResult.IdToken; | ||
before(() => { | ||
cy.task('getUserToken', { | ||
email: '[email protected]', | ||
password: DEFAULT_ACCOUNT_PASS, | ||
}).then(result => { | ||
token = result.AuthenticationResult.IdToken; | ||
}); | ||
}); | ||
|
||
it('should be able to login', () => { | ||
|
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 |
---|---|---|
|
@@ -46,6 +46,8 @@ import { waitForElasticsearch } from '../support/helpers'; | |
|
||
const DEFAULT_ACCOUNT_PASS = Cypress.env('DEFAULT_ACCOUNT_PASS'); | ||
|
||
console.log('gg', DEFAULT_ACCOUNT_PASS); | ||
|
||
faker.seed(faker.number.int()); | ||
|
||
let docketClerkToken = null; | ||
|
@@ -54,37 +56,42 @@ const testData = { | |
preferredTrialCity: 'Mobile, Alabama', | ||
trialSessionIds: [], | ||
}; | ||
const { login } = getEnvironmentSpecificFunctions(); | ||
|
||
let firstDocketNumber; | ||
let secondDocketNumber; | ||
const caseTestData = { docketNumbers: [] }; | ||
|
||
describe('Petitions Clerk', () => { | ||
const { getUserToken, login } = getEnvironmentSpecificFunctions(); | ||
|
||
before(async () => { | ||
let result = await getUserToken( | ||
'[email protected]', | ||
DEFAULT_ACCOUNT_PASS, | ||
); | ||
petitionsClerkToken = result.AuthenticationResult.IdToken; | ||
result = await getUserToken( | ||
'[email protected]', | ||
DEFAULT_ACCOUNT_PASS, | ||
); | ||
docketClerkToken = result.AuthenticationResult.IdToken; | ||
before(() => { | ||
cy.task('getUserToken', { | ||
email: '[email protected]', | ||
password: DEFAULT_ACCOUNT_PASS, | ||
}).then(result => { | ||
petitionsClerkToken = result.AuthenticationResult.IdToken; | ||
}); | ||
}); | ||
|
||
before(() => { | ||
cy.task('getUserToken', { | ||
email: '[email protected]', | ||
password: DEFAULT_ACCOUNT_PASS, | ||
}).then(result => { | ||
docketClerkToken = result.AuthenticationResult.IdToken; | ||
}); | ||
}); | ||
|
||
describe('Petitioner creates cases', () => { | ||
let petitionerToken; | ||
|
||
describe('Petitioner', () => { | ||
before(async () => { | ||
const results = await getUserToken( | ||
'[email protected]', | ||
DEFAULT_ACCOUNT_PASS, | ||
); | ||
petitionerToken = results.AuthenticationResult.IdToken; | ||
before(() => { | ||
cy.task('getUserToken', { | ||
email: '[email protected]', | ||
password: DEFAULT_ACCOUNT_PASS, | ||
}).then(result => { | ||
token = result.AuthenticationResult.IdToken; | ||
}); | ||
}); | ||
|
||
it('should be able to login', () => { | ||
|
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 |
---|---|---|
|
@@ -27,16 +27,16 @@ let testData = {}; | |
let token; | ||
const DEFAULT_ACCOUNT_PASS = Cypress.env('DEFAULT_ACCOUNT_PASS'); | ||
|
||
const { closeScannerSetupDialog, getUserToken, login } = | ||
getEnvironmentSpecificFunctions(); | ||
const { closeScannerSetupDialog, login } = getEnvironmentSpecificFunctions(); | ||
|
||
describe('Create and serve a case to search for', () => { | ||
before(async () => { | ||
const results = await getUserToken( | ||
'[email protected]', | ||
DEFAULT_ACCOUNT_PASS, | ||
); | ||
token = results.AuthenticationResult.IdToken; | ||
before(() => { | ||
cy.task('getUserToken', { | ||
email: '[email protected]', | ||
password: DEFAULT_ACCOUNT_PASS, | ||
}).then(result => { | ||
token = result.AuthenticationResult.IdToken; | ||
}); | ||
}); | ||
|
||
it('should be able to login', () => { | ||
|
@@ -55,12 +55,13 @@ describe('Create and serve a case to search for', () => { | |
}); | ||
|
||
describe('Case Advanced Search', () => { | ||
before(async () => { | ||
const results = await getUserToken( | ||
'[email protected]', | ||
DEFAULT_ACCOUNT_PASS, | ||
); | ||
token = results.AuthenticationResult.IdToken; | ||
before(() => { | ||
cy.task('getUserToken', { | ||
email: '[email protected]', | ||
password: DEFAULT_ACCOUNT_PASS, | ||
}).then(result => { | ||
token = result.AuthenticationResult.IdToken; | ||
}); | ||
}); | ||
|
||
it('should be able to login', () => { | ||
|
@@ -79,12 +80,13 @@ describe('Case Advanced Search', () => { | |
}); | ||
|
||
describe('Practitioner Search', () => { | ||
before(async () => { | ||
const results = await getUserToken( | ||
'[email protected]', | ||
DEFAULT_ACCOUNT_PASS, | ||
); | ||
token = results.AuthenticationResult.IdToken; | ||
before(() => { | ||
cy.task('getUserToken', { | ||
email: '[email protected]', | ||
password: DEFAULT_ACCOUNT_PASS, | ||
}).then(result => { | ||
token = result.AuthenticationResult.IdToken; | ||
}); | ||
}); | ||
|
||
it('should be able to login', () => { | ||
|
@@ -103,12 +105,13 @@ describe('Practitioner Search', () => { | |
}); | ||
|
||
describe('Opinion Search', () => { | ||
before(async () => { | ||
const results = await getUserToken( | ||
'[email protected]', | ||
DEFAULT_ACCOUNT_PASS, | ||
); | ||
token = results.AuthenticationResult.IdToken; | ||
before(() => { | ||
cy.task('getUserToken', { | ||
email: '[email protected]', | ||
password: DEFAULT_ACCOUNT_PASS, | ||
}).then(result => { | ||
token = result.AuthenticationResult.IdToken; | ||
}); | ||
}); | ||
|
||
it('should be able to login', () => { | ||
|
Oops, something went wrong.