Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isolate dashboard tests #117

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/automatic-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
DEBUG: '@cypress/github-action'
with:
#command: npm run tag:stable:${{ matrix.spec }}
command: npm run cy:run
browser: chrome

- name: 📬 Upload test artifacts 📬
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/manual-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ jobs:
DEBUG: '@cypress/github-action'
with:
#command: npm run tag:stable:${{ matrix.spec }}
command: npm run cy:run
browser: chrome

- name: 📬 Upload test artifacts 📬
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/scheduled-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
DEBUG: '@cypress/github-action'
with:
#command: npm run tag:stable:${{ matrix.spec }}
command: npm run cy:run
browser: chrome

- name: 📬 Upload test artifacts 📬
Expand Down
2 changes: 1 addition & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = defineConfig({
viewportHeight: 768,
videoCompression: 18,
chromeWebSecurity: true,
pageLoadTimeout: 80000,
pageLoadTimeout: 180000,
defaultCommandTimeout: 80000,
requestTimeout: 60000,
responseTimeout: 60000,
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/dashboard/dashboard.feature
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ Feature: Dashboard - To check contents on the dashboard
And I click on manage team members option
Then I see team participants overview page
When I select the student 'Herbert Kraft' and click on delete icon
Then I see 'Herbert Kraft' is not visible on the table
Then I see 'Herbert Kraft' is not visible on the table
2 changes: 1 addition & 1 deletion cypress/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ module.exports = (on, config) => {
fs.writeFile("cypress/.run/results.json", JSON.stringify(results));
}
})
}
}
5 changes: 4 additions & 1 deletion cypress/support/pages/account/pageAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ class Account {
}

selectLanguage (sel, language) {
return cy.contains(sel, language).should('be.visible').click().wait(500)
return cy.contains(sel, language)
.should('be.visible')
.click()
.wait(['@alerts_api'])
}

assertLanguageUpdate (updatedText) {
Expand Down
4 changes: 2 additions & 2 deletions cypress/support/pages/admin/pageAdministration.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ class Management {
clickOnAddButton (role) {
if (!(role == 'student')) {
cy.intercept('POST', '**/teachers').as('post_role_api')
cy.intercept('GET', '**/teachers?**').as('get_roles_api')
cy.intercept('GET', '**/teachers**').as('get_roles_api')
} else {
cy.intercept('POST', '**/students').as('post_role_api')
cy.intercept('GET', '**/students?**').as('get_roles_api')
cy.intercept('GET', '**/students**').as('get_roles_api')
}
cy.get(Management.#addButton)
.click()
Expand Down
67 changes: 63 additions & 4 deletions cypress/support/pages/course/pageCourses.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ class Courses {

navigateToRoomsOverview () {
cy.get(Courses.#courseOverviewNavigationButton)
.should('exist')
.click()
cy.wait('@courses_api')
cy.wait(['@dashboard_api', '@courses_api'])
}

navigateToRoomBoard (roomName) {
Expand All @@ -65,15 +66,19 @@ class Courses {
const htmlTitlePage = $title.text()
if (htmlTitlePage.includes('Kurse')) {
cy.get(`[aria-label="Kurs ${roomName}"]`)
.should('exist')
.click()
} else if (htmlTitlePage.includes('courses')) {
cy.get(`[aria-label="Course ${roomName}"]`)
.should('exist')
.click()
} else if (htmlTitlePage.includes('Cursos')) {
cy.get(`[aria-label="Curso ${roomName}"]`)
.should('exist')
.click()
} else if (htmlTitlePage.includes('Поточні')) {
cy.get(`[aria-label="Курс ${roomName}"]`)
.should('exist')
.click()
}
})
Expand Down Expand Up @@ -215,6 +220,7 @@ class Courses {
.then(interceptions => {
expect(interceptions.response.statusCode).to.equal(200)
})
.wait(['@course_api'])
}

showCourseEditPage () {
Expand Down Expand Up @@ -299,7 +305,7 @@ class Courses {
}

performRoomDeletion () {
cy.get(Courses.#deleteButton).click()
cy.get(Courses.#deleteButton).should('exist').click()
cy.get(Courses.#confirmDeletionPopup)
.click({
multiple: true,
Expand All @@ -313,7 +319,8 @@ class Courses {
'@roles_api',
'@schools_api',
'@alert_api',
'@dashboard_api'
'@dashboard_api',
'@rooms_overview_api'
],
{ timeout: 80000 }
)
Expand Down Expand Up @@ -393,7 +400,59 @@ class Courses {
cy.get(Courses.#chosenContainer).should('contain', userFullName)
}


deleteAllCoursesMatchingName (roomName) {
cy.get('h1')
.eq(0)
.then($title => {
const htmlTitlePage = $title.text()
if (htmlTitlePage.includes('Kurse')) {
this.deleteCursesByName('Kurs', roomName)
} else if (htmlTitlePage.includes('courses')) {
this.deleteCursesByName('Course', roomName)
} else if (htmlTitlePage.includes('Cursos')) {
this.deleteCursesByName('Curso', roomName)
} else if (htmlTitlePage.includes('Поточні')) {
this.deleteCursesByName('Курс', roomName)
}
})
}

deleteCursesByName (courseLabel, roomName) {
cy.get(`[class="rooms-container"]`).then($roomsContainer => {
if ($roomsContainer.find(`[aria-label="${courseLabel} ${roomName}"]`).length) {
cy.get(`[aria-label="${courseLabel} ${roomName}"]`).then(($rooms) => {
if ($rooms) {
cy.wrap($rooms).first().click()
cy.wait(['@board_api', '@userPermissions_api', '@rooms_api']);
this.openCourseEditPage();
cy.get(Courses.#deleteButton).should('exist').click()
cy.get(Courses.#confirmDeletionPopup)
.click({
multiple: true,
force: true
})
.wait(
[
'@runtime_config_api',
'@public_api',
'@me_api',
'@roles_api',
'@schools_api',
'@alert_api',
'@dashboard_api',
'@rooms_overview_api'
],
{timeout: 80000}
)

if ($rooms.length > 1) {
this.deleteAllCoursesMatchingName(roomName)
}
}
})
}
})
}

}
export default Courses
6 changes: 5 additions & 1 deletion cypress/support/pages/news/pageNews.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class News {
confirmDeletionOnDialogBox () {
cy.get(News.#deleteNewsConfirmation)
.contains('Löschen')
.should('exist')
.click()
}

Expand All @@ -43,14 +44,17 @@ class News {
openNewsDetailPage (newsName) {
cy.get(News.#newsName)
.contains(newsName)
.should('exist')
.click()
}

seeCreatedNews (newsTitle, newsDesc) {
cy.get(News.#newsTitle)
.contains(newsTitle)
.should('exist')
cy.get(News.#newsDescriptionVisible)
.contains(newsDesc)
.should('exist')
}

clickOnCreateNewsSaveButton () {
Expand Down Expand Up @@ -101,4 +105,4 @@ class News {
cy.get(News.#newsText).contains(descriptionOfNews).should('exist')
}
}
export default News
export default News
9 changes: 9 additions & 0 deletions cypress/support/pages/tasks/pageTasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -606,5 +606,14 @@ class Tasks {
clickLowerTaskSectionIcon () {
cy.get(Tasks.#lowerTaskSectionIcon).click()
}

taskExists (taskTitle) {
cy.get(Tasks.#taskCardTitle)
.then($tasks => {
return $tasks.find(taskTitle).length
})

return false
}
}
export default Tasks
14 changes: 8 additions & 6 deletions cypress/support/pages/teams/pageTeams.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Teams {
static #videoConferenceNotStartedIcon = '[data-testid="video-conference-not-started-info-icon"]'
static #videoConferenceNotStartedInfoModal = '[data-testid="modal_content"]'
static #teamEventTitleOnCalanderTab = '[data-testid="team-event-calender-title"]'
static #pageTitleTeamsOverview = '[id="page-title"]'
static #pageTitleTeamsOverview = '[id="titlebar"]'
static #teamsMembersOverviewPageTitle = '[id="page-title"]'


Expand Down Expand Up @@ -319,10 +319,10 @@ class Teams {

navigateToTeamsOverview () {
cy.get(Teams.#teamsOverviewNavigationButton)
.should("exist")
.click()
cy.url()
.should('include', '/teams')
cy.get(Teams.#pageTitleTeamsOverview).should('exist')
cy.wait('@teams_api')
cy.get(Teams.#pageTitleTeamsOverview, { timeout: 200000 }).should('exist')
}

selectTeam (teamName) {
Expand Down Expand Up @@ -424,12 +424,14 @@ class Teams {
}

clickOnAddTeam () {
cy.get(Teams.#teamMainSection).then(($element) => {
cy.get(Teams.#teamMainSection).should("exist").then(($element) => {
if ($element.hasClass('empty-state')) {
cy.get(Teams.#addNewTeamEmptyOverviewButton)
.should("exist")
.click()
} else {
cy.get(Teams.#addNewTeamButton)
.should("exist")
.click()
}
})
Expand Down Expand Up @@ -474,4 +476,4 @@ class Teams {
.should('be.visible')
}
}
export default Teams
export default Teams
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ Before(() => {
cy.intercept('**/homework/**').as('homework_api')
cy.intercept('**/rooms/**').as('rooms_api')
cy.intercept('**/delete/**').as('delete_api')
cy.intercept('**/teams**').as('teams_api')
cy.intercept('**/courses/**').as('course_api')
cy.intercept('**/rooms-overview**').as('rooms_overview_api')
})

Given('I am logged in as a {string} at {string}', (username, environment) => {
cy.login(username, environment)
})
})
32 changes: 31 additions & 1 deletion cypress/support/step_definition/course/commonCourseSteps.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,36 @@ import Courses from '../../pages/course/pageCourses'

const courses = new Courses()

before(() => {
cy.intercept('**/public').as('public_api');
cy.intercept('**/me').as('me_api');
cy.intercept('**/user/**').as('roles_api');
cy.intercept('**/schools/**').as('schools_api');
cy.intercept('**/dashboard').as('dashboard_api');
cy.intercept('**/userPermissions?**').as('userPermissions_api');
cy.intercept('**/classes?**').as('classes_api');
cy.intercept('**/students?**').as('students_api');
cy.intercept('**/locales/**').as('locales_api');
cy.intercept('**/alerts').as('alerts_api');
cy.intercept('**/alert').as('alert_api');
cy.intercept('**/tasks**').as('tasks_api');
cy.intercept('**/runtime.config.json').as('runtime_config_api');
cy.intercept('**/board').as('board_api');
cy.intercept('**/courses?**').as('courses_api');
cy.intercept('**/courses/**').as('course_api');
cy.intercept('**/homework/**').as('homework_api');
cy.intercept('**/rooms/**').as('rooms_api');
cy.intercept('**/delete/**').as('delete_api');
cy.intercept('**/teams**').as('teams_api');
cy.intercept('**/rooms-overview**').as('rooms_overview_api');
cy.login('teacher', 'brb');
courses.navigateToRoomsOverview();
['Cypress Test Creation and Deletion', 'Cypress Testkurs Edit'].forEach((courseName => {
courses.deleteAllCoursesMatchingName(courseName);
courses.courseIsNotVisiblOnOverviewPage(courseName);
}))
})

When('I go to rooms overview', () => {
courses.navigateToRoomsOverview()
})
Expand Down Expand Up @@ -145,4 +175,4 @@ And('I clear substitute teacher field', () => {

And('I add substitute teacher {string}', username => {
courses.addSubstituteTeacher(username)
})
})
42 changes: 42 additions & 0 deletions cypress/support/step_definition/tasks/commonTaskSteps.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,49 @@
import Tasks from '../../pages/tasks/pageTasks'
import Courses from "../../pages/course/pageCourses";
import Dashboard from "../../pages/dashboard/pageDashboard";

const tasks = new Tasks()

before(() => {
cy.intercept('**/public').as('public_api');
cy.intercept('**/me').as('me_api');
cy.intercept('**/user/**').as('roles_api');
cy.intercept('**/schools/**').as('schools_api');
cy.intercept('**/dashboard').as('dashboard_api');
cy.intercept('**/userPermissions?**').as('userPermissions_api');
cy.intercept('**/classes?**').as('classes_api');
cy.intercept('**/students?**').as('students_api');
cy.intercept('**/locales/**').as('locales_api');
cy.intercept('**/alerts').as('alerts_api');
cy.intercept('**/alert').as('alert_api');
cy.intercept('**/tasks**').as('tasks_api');
cy.intercept('**/runtime.config.json').as('runtime_config_api');
cy.intercept('**/board').as('board_api');
cy.intercept('**/courses?**').as('courses_api');
cy.intercept('**/courses/**').as('course_api');
cy.intercept('**/homework/**').as('homework_api');
cy.intercept('**/rooms/**').as('rooms_api');
cy.intercept('**/delete/**').as('delete_api');
cy.intercept('**/teams**').as('teams_api');
cy.intercept('**/rooms-overview**').as('rooms_overview_api');
cy.login('teacher', 'brb');
const courses = new Courses();
const dashboard = new Dashboard();
tasks.navigateToTasksOverview();
tasks.clickOnTabDraftTasks();
['Cy Task Creating from Task Overview Test', 'Cy Task to be delete on task page'].forEach((taskName => {
if (tasks.taskExists(taskName)) {
tasks.openThreeDotMenuForTask(taskName);
tasks.clickDeleteTaskInDotMenu();
courses.clickDeleteInConfirmationWindow();
dashboard.arriveOnDashboard();
tasks.navigateToTasksOverview();
tasks.clickOnTabDraftTasks();
tasks.taskIsNotVisibleOnTasksOverviewPage(taskName);
}
}))
})

When('I go to tasks overview', () => {
tasks.navigateToTasksOverview()
})
Expand Down
Loading