mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-22 21:23:43 +00: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 user2 = 'user2@example.com'
|
||||
|
||||
const testProjectName = `project-${uuid()}`
|
||||
let testProjectName = ''
|
||||
let testProjectId = ''
|
||||
const deletedProjectName = `deleted-project-${uuid()}`
|
||||
let deletedProjectName = ''
|
||||
let projectToDeleteId = ''
|
||||
|
||||
const findProjectRow = (projectName: string) => {
|
||||
|
@ -29,6 +29,8 @@ describe('admin panel', function () {
|
|||
ensureUserExists({ email: user2 })
|
||||
|
||||
beforeWithReRunOnTestRetry(() => {
|
||||
testProjectName = `project-${uuid()}`
|
||||
deletedProjectName = `deleted-project-${uuid()}`
|
||||
login(user1)
|
||||
cy.visit('/project')
|
||||
createProject(testProjectName).then(id => (testProjectId = id))
|
||||
|
@ -180,7 +182,7 @@ describe('admin panel', function () {
|
|||
|
||||
cy.log('delete project')
|
||||
findProjectRow(deletedProjectName).within(() =>
|
||||
cy.get('button[aria-label="Trash"]').click()
|
||||
cy.contains('Trash').click()
|
||||
)
|
||||
cy.get('button').contains('Confirm').click()
|
||||
cy.findByText(deletedProjectName).should('not.exist')
|
||||
|
@ -190,7 +192,7 @@ describe('admin panel', function () {
|
|||
cy.findByText('Trashed Projects').click()
|
||||
})
|
||||
findProjectRow(deletedProjectName).within(() =>
|
||||
cy.get('button[aria-label="Delete"]').click()
|
||||
cy.contains('Delete').click()
|
||||
)
|
||||
cy.get('button').contains('Confirm').click()
|
||||
cy.findByText(deletedProjectName).should('not.exist')
|
||||
|
|
|
@ -28,15 +28,12 @@ describe('Project List', () => {
|
|||
|
||||
describe('user with projects', () => {
|
||||
const projectName = `test-project-${uuid()}`
|
||||
let projectId: string | undefined
|
||||
ensureUserExists({ email: REGULAR_USER })
|
||||
|
||||
before(() => {
|
||||
login(REGULAR_USER)
|
||||
cy.visit('/project')
|
||||
createProject(projectName, { type: 'Example Project' }).then(
|
||||
id => (projectId = id)
|
||||
)
|
||||
createProject(projectName, { type: 'Example Project' })
|
||||
})
|
||||
|
||||
it('Can download project sources', () => {
|
||||
|
@ -44,7 +41,7 @@ describe('Project List', () => {
|
|||
cy.visit('/project')
|
||||
|
||||
findProjectRow(projectName).within(() =>
|
||||
cy.get(`[aria-label="Download .zip file"]`).click()
|
||||
cy.contains(`Download .zip file`).click()
|
||||
)
|
||||
|
||||
cy.task('readFileInZip', {
|
||||
|
@ -58,7 +55,7 @@ describe('Project List', () => {
|
|||
cy.visit('/project')
|
||||
|
||||
findProjectRow(projectName).within(() =>
|
||||
cy.get(`[aria-label="Download PDF"]`).click()
|
||||
cy.contains(`Download PDF`).click()
|
||||
)
|
||||
|
||||
const pdfName = projectName.replaceAll('-', '_')
|
||||
|
@ -74,7 +71,7 @@ describe('Project List', () => {
|
|||
cy.visit('/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.get('button[aria-label="Tags"]').click()
|
||||
|
@ -98,7 +95,7 @@ describe('Project List', () => {
|
|||
cy.visit('/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')
|
||||
const tagName = uuid().slice(0, 7) // long tag names are truncated in the UI, which affects selectors
|
||||
|
|
Loading…
Reference in a new issue