From 581e75ee577715181ad7d0d613ebc98d20be0258 Mon Sep 17 00:00:00 2001 From: Annie Huang Date: Sat, 9 Dec 2023 21:18:03 +0800 Subject: [PATCH] Add configs retrying and longer timeout to load --- tests/cypress.config.js | 3 +++ tests/cypress/support/commands.js | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/cypress.config.js b/tests/cypress.config.js index 1b6910c..b2bb72e 100644 --- a/tests/cypress.config.js +++ b/tests/cypress.config.js @@ -20,6 +20,9 @@ module.exports = defineConfig({ viewportWidth: 1920, viewportHeight: 1080, pageLoadTimeout: 120000, + redirectionLimit: 20, + defaultCommandTimeout: 10000, + retries: { runMode: 5, openMode: 5 }, }, env: { defaultAccount: getOrFail('TESTING_USERNAME'), diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index 625d0df..f3b8a02 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -22,10 +22,11 @@ Cypress.Commands.add('PrepareForGame', () => { cy.url().should('include', '/map') cy.visit('/game/get-started') cy.url().should('include', '/game/get-started') - cy.get('.xterm-screen', { timeout: 10000 }) + // check task first so the terminal has better possibility loaded + cy.checkTaskInit() + cy.get('.xterm-screen', { timeout: 100000 }) .as('Terminaltextbox') .should('be.visible') - cy.checkTaskInit() cy.CheckTextElement('#reset', '重來', 'Reset').click() cy.checkTaskInit() cy.InitTerminal() @@ -83,7 +84,7 @@ Cypress.Commands.add('checkPending', () => { }) Cypress.Commands.add('CompleteStageWithCommands', (stagename) => { cy.visit(`/game/${stagename}`) - cy.url().should('include', `/game/${stagename}`) + cy.url().should('include', `/game/${stagename}`, { timeout: 50000 }) cy.log(`Completing stage :${stagename}`) cy.checkTaskInit() cy.CheckTextElement('#reset', '重來', 'Reset').click()