From 62fe65d53a4e044e3f7e0ad1255c9aed8d24cee8 Mon Sep 17 00:00:00 2001 From: Annie Huang Date: Mon, 13 Nov 2023 22:30:22 +0800 Subject: [PATCH] Update tests: - Add public command to press enter until story end - Add public command to check status pending (cherry picked from commit c86163fd101553d56d9280b363d18b1ef80877eb) --- tests/cypress/e2e/helloworld.cy.js | 33 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/tests/cypress/e2e/helloworld.cy.js b/tests/cypress/e2e/helloworld.cy.js index d6b097e..cbdd011 100644 --- a/tests/cypress/e2e/helloworld.cy.js +++ b/tests/cypress/e2e/helloworld.cy.js @@ -1,5 +1,4 @@ /// - export default function checkLoginUI() { cy.get('h1.text-text-primary') .should('contain', 'Linux Odyssey') @@ -49,6 +48,12 @@ describe('example helloworld app', () => { 'be.visible' ) }) + it('Check login fail', () => { + cy.LoginWithPassword('dddd', '123456') + cy.get('p').contains('Wrong username or password.').should('be.visible') + cy.LoginWithPassword(`ddd\``, '123456') + cy.get('p').contains('Invalid username or password.').should('be.visible') + }) it('Login-Password Already Register', () => { cy.LoginWithPassword( Cypress.env('defaultAccount'), @@ -64,6 +69,8 @@ describe('example helloworld app', () => { cy.findByRole('button', { name: 'Hello, Linux World!' }).should( 'be.visible' ) + cy.findByRole('link', { name: 'Bug Report' }).should('be.visible') + cy.findByRole('button', { name: 'Sign Out' }).should('be.visible') }) it('Check QuestInfo', () => { cy.get('#topic').should('contain', 'Hello, Linux World!') @@ -128,10 +135,8 @@ describe('example helloworld app', () => { // Stage1 cy.log('Stage1') cy.typeInCommand(answerarr[0]) - cy.get('input[id="currentStatus"]', { timeout: 1000000 }).should( - 'have.value', - 'active' - ) + cy.checkPending() + cy.waitUntilActive() cy.get('#Lbutton').should('be.visible').and('be.disabled') cy.get('#Rbutton').should('be.visible').and('be.disabled') cy.checkHint(1, 1) @@ -140,10 +145,8 @@ describe('example helloworld app', () => { // Stage2 cy.log('Stage2') cy.typeInCommand(answerarr[1]) - cy.get('input[id="currentStatus"]', { timeout: 1000000 }).should( - 'have.value', - 'active' - ) + cy.checkPending() + cy.waitUntilActive() cy.get('#tree') .get('a') .should('contain', 'forgotten_scroll.txt') @@ -158,20 +161,16 @@ describe('example helloworld app', () => { // Stage3 cy.log('Stage3') cy.typeInCommand(answerarr[2]) - cy.get('input[id="currentStatus"]', { timeout: 1000000 }).should( - 'have.value', - 'active' - ) + cy.checkPending() + cy.waitUntilActive() cy.getQuestInfo('✓ 查看卷軸').should('be.visible') cy.getQuestInfo('解除封印').should('be.visible') cy.checkHint(3, 3) // Stage4 cy.log('Stage4') cy.typeInCommand(answerarr[3]) - cy.get('input[id="currentStatus"]', { timeout: 1000000 }).should( - 'have.value', - 'active' - ) + cy.checkPending() + cy.waitUntilActive() cy.getQuestInfo('✓ 解除封印').should('be.visible') cy.findByRole( 'heading',