mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-14 20:40:17 -05:00
Merge pull request #19380 from overleaf/jpa-fix-e2e-tests
[server-ce] fix e2e tests GitOrigin-RevId: 0c19e09fee02d4fd048c12b5468ce3bf5ca87f13
This commit is contained in:
parent
2108cc5422
commit
3ebab56455
2 changed files with 11 additions and 12 deletions
|
@ -10,9 +10,9 @@ describe('admin panel', function () {
|
||||||
const user1 = 'user@example.com'
|
const user1 = 'user@example.com'
|
||||||
const user2 = 'user2@example.com'
|
const user2 = 'user2@example.com'
|
||||||
|
|
||||||
const testProjectName = `project-${uuid()}`
|
let testProjectName = ''
|
||||||
let testProjectId = ''
|
let testProjectId = ''
|
||||||
const deletedProjectName = `deleted-project-${uuid()}`
|
let deletedProjectName = ''
|
||||||
let projectToDeleteId = ''
|
let projectToDeleteId = ''
|
||||||
|
|
||||||
const findProjectRow = (projectName: string) => {
|
const findProjectRow = (projectName: string) => {
|
||||||
|
@ -29,6 +29,8 @@ describe('admin panel', function () {
|
||||||
ensureUserExists({ email: user2 })
|
ensureUserExists({ email: user2 })
|
||||||
|
|
||||||
beforeWithReRunOnTestRetry(() => {
|
beforeWithReRunOnTestRetry(() => {
|
||||||
|
testProjectName = `project-${uuid()}`
|
||||||
|
deletedProjectName = `deleted-project-${uuid()}`
|
||||||
login(user1)
|
login(user1)
|
||||||
cy.visit('/project')
|
cy.visit('/project')
|
||||||
createProject(testProjectName).then(id => (testProjectId = id))
|
createProject(testProjectName).then(id => (testProjectId = id))
|
||||||
|
@ -180,7 +182,7 @@ describe('admin panel', function () {
|
||||||
|
|
||||||
cy.log('delete project')
|
cy.log('delete project')
|
||||||
findProjectRow(deletedProjectName).within(() =>
|
findProjectRow(deletedProjectName).within(() =>
|
||||||
cy.get('button[aria-label="Trash"]').click()
|
cy.contains('Trash').click()
|
||||||
)
|
)
|
||||||
cy.get('button').contains('Confirm').click()
|
cy.get('button').contains('Confirm').click()
|
||||||
cy.findByText(deletedProjectName).should('not.exist')
|
cy.findByText(deletedProjectName).should('not.exist')
|
||||||
|
@ -190,7 +192,7 @@ describe('admin panel', function () {
|
||||||
cy.findByText('Trashed Projects').click()
|
cy.findByText('Trashed Projects').click()
|
||||||
})
|
})
|
||||||
findProjectRow(deletedProjectName).within(() =>
|
findProjectRow(deletedProjectName).within(() =>
|
||||||
cy.get('button[aria-label="Delete"]').click()
|
cy.contains('Delete').click()
|
||||||
)
|
)
|
||||||
cy.get('button').contains('Confirm').click()
|
cy.get('button').contains('Confirm').click()
|
||||||
cy.findByText(deletedProjectName).should('not.exist')
|
cy.findByText(deletedProjectName).should('not.exist')
|
||||||
|
|
|
@ -28,15 +28,12 @@ describe('Project List', () => {
|
||||||
|
|
||||||
describe('user with projects', () => {
|
describe('user with projects', () => {
|
||||||
const projectName = `test-project-${uuid()}`
|
const projectName = `test-project-${uuid()}`
|
||||||
let projectId: string | undefined
|
|
||||||
ensureUserExists({ email: REGULAR_USER })
|
ensureUserExists({ email: REGULAR_USER })
|
||||||
|
|
||||||
before(() => {
|
before(() => {
|
||||||
login(REGULAR_USER)
|
login(REGULAR_USER)
|
||||||
cy.visit('/project')
|
cy.visit('/project')
|
||||||
createProject(projectName, { type: 'Example Project' }).then(
|
createProject(projectName, { type: 'Example Project' })
|
||||||
id => (projectId = id)
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Can download project sources', () => {
|
it('Can download project sources', () => {
|
||||||
|
@ -44,7 +41,7 @@ describe('Project List', () => {
|
||||||
cy.visit('/project')
|
cy.visit('/project')
|
||||||
|
|
||||||
findProjectRow(projectName).within(() =>
|
findProjectRow(projectName).within(() =>
|
||||||
cy.get(`[aria-label="Download .zip file"]`).click()
|
cy.contains(`Download .zip file`).click()
|
||||||
)
|
)
|
||||||
|
|
||||||
cy.task('readFileInZip', {
|
cy.task('readFileInZip', {
|
||||||
|
@ -58,7 +55,7 @@ describe('Project List', () => {
|
||||||
cy.visit('/project')
|
cy.visit('/project')
|
||||||
|
|
||||||
findProjectRow(projectName).within(() =>
|
findProjectRow(projectName).within(() =>
|
||||||
cy.get(`[aria-label="Download PDF"]`).click()
|
cy.contains(`Download PDF`).click()
|
||||||
)
|
)
|
||||||
|
|
||||||
const pdfName = projectName.replaceAll('-', '_')
|
const pdfName = projectName.replaceAll('-', '_')
|
||||||
|
@ -74,7 +71,7 @@ describe('Project List', () => {
|
||||||
cy.visit('/project')
|
cy.visit('/project')
|
||||||
|
|
||||||
cy.log('select project')
|
cy.log('select project')
|
||||||
cy.get(`[id="select-project-${projectId}"`).click()
|
cy.get(`[aria-label="Select ${projectName}"]`).click()
|
||||||
|
|
||||||
cy.log('add tag to project')
|
cy.log('add tag to project')
|
||||||
cy.get('button[aria-label="Tags"]').click()
|
cy.get('button[aria-label="Tags"]').click()
|
||||||
|
@ -98,7 +95,7 @@ describe('Project List', () => {
|
||||||
cy.visit('/project')
|
cy.visit('/project')
|
||||||
|
|
||||||
cy.log('select project')
|
cy.log('select project')
|
||||||
cy.get(`[id="select-project-${projectId}"`).click()
|
cy.get(`[aria-label="Select ${projectName}"]`).click()
|
||||||
|
|
||||||
cy.log('add tag to project')
|
cy.log('add tag to project')
|
||||||
const tagName = uuid().slice(0, 7) // long tag names are truncated in the UI, which affects selectors
|
const tagName = uuid().slice(0, 7) // long tag names are truncated in the UI, which affects selectors
|
||||||
|
|
Loading…
Reference in a new issue